diff --git a/include/misc/util/debug.h b/include/misc/util/debug.h index 08ed307..20214e8 100644 --- a/include/misc/util/debug.h +++ b/include/misc/util/debug.h @@ -1,5 +1,8 @@ + #pragma once +#include + #define DEBUG_MODE #ifdef DEBUG_MODE diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index c2916fc..7523d76 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -1,12 +1,5 @@ -FIND_PACKAGE(GTK) -FIND_PACKAGE(GDK) +find_package(wxWidgets) +include(${wxWidgets_USE_FILE}) -IF(GTK_FOUND) - message(STATUS "GTK found compiling GUI apps") - ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER}) - ADD_EXECUTABLE(gtk1 gtk1.cpp) - INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(gtk1 ${GTK_LIBRARIES}) -ELSE() - message(STATUS "GTK not found.") -ENDIF(GTK_FOUND) \ No newline at end of file +add_executable(gui1 gui1.cpp) +target_link_libraries(gui1 PRIVATE ${wxWidgets_LIBRARIES}) \ No newline at end of file diff --git a/src/gui/gtk1.cpp b/src/gui/gtk1.cpp deleted file mode 100644 index 8b10940..0000000 --- a/src/gui/gtk1.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Include gtk -//#include -#include -#include - -static void on_activate (GtkApplication *app) { - // Create a new window - GtkWidget *window = gtk_application_window_new (app); - // Create a new button - GtkWidget *button = gtk_button_new_with_label ("Hello, World!"); - // When the button is clicked, close the window passed as an argument - g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_close), window); - gtk_window_set_child (GTK_WINDOW (window), button); - gtk_window_present (GTK_WINDOW (window)); -} - -int main (int argc, char *argv[]) { - // Create a new application - GtkApplication *app = gtk_application_new ("com.example.GtkApplication", - G_APPLICATION_FLAGS_NONE); - g_signal_connect (app, "activate", G_CALLBACK (on_activate), NULL); - return g_application_run (G_APPLICATION (app), argc, argv); -} diff --git a/src/misc/CMakeLists.txt b/src/misc/CMakeLists.txt index f70a548..3e5874e 100644 --- a/src/misc/CMakeLists.txt +++ b/src/misc/CMakeLists.txt @@ -1 +1,2 @@ -add_subdirectory(memory) \ No newline at end of file +add_subdirectory(memory) +add_subdirectory(dec) \ No newline at end of file diff --git a/src/misc/memory/CMakeLists.txt b/src/misc/memory/CMakeLists.txt index e124e94..84d4b01 100644 --- a/src/misc/memory/CMakeLists.txt +++ b/src/misc/memory/CMakeLists.txt @@ -1,2 +1,4 @@ add_executable(memorymodel model.cpp) add_executable(volatile volatile.cpp) +add_executable(cmem cmem.c) +add_executable(cautofree cautofree.c) diff --git a/src/misc/memory/model.cpp b/src/misc/memory/model.cpp index eb8f9a1..bf50ce9 100644 --- a/src/misc/memory/model.cpp +++ b/src/misc/memory/model.cpp @@ -1,9 +1,11 @@ #include "../../../include/misc/memory/model.h" #include "../../../include/misc/util/debug.h" #include +#include #define UPtr std::unique_ptr #define SPtr std::shared_ptr +#define Atomic std::atomic template Box::Box(Object *ref) @@ -95,5 +97,7 @@ int main(void) printBoxContent(box1); Box> box2=box1; printBoxContent(box2); - + Atomic atomic_int(12); + + return 0; } \ No newline at end of file diff --git a/src/misc/memory/volatile.cpp b/src/misc/memory/volatile.cpp index b72debe..b4a6849 100644 --- a/src/misc/memory/volatile.cpp +++ b/src/misc/memory/volatile.cpp @@ -3,7 +3,7 @@ inline unsigned long getTimestamp(){ unsigned hi,lo; asm ("rdtsc": "=a" (lo), "=d" (hi) ); - return ((unsigned long) lo )| ((unsigned long) hi << 32); + return ((unsigned long) lo ) | ((unsigned long) hi << 32); } inline unsigned long getTimestampVolatile(){