Stuff
This commit is contained in:
parent
be0b83f80f
commit
90128eb8e5
7 changed files with 17 additions and 37 deletions
|
@ -1,5 +1,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#define DEBUG_MODE
|
#define DEBUG_MODE
|
||||||
|
|
||||||
#ifdef DEBUG_MODE
|
#ifdef DEBUG_MODE
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
FIND_PACKAGE(GTK)
|
find_package(wxWidgets)
|
||||||
FIND_PACKAGE(GDK)
|
include(${wxWidgets_USE_FILE})
|
||||||
|
|
||||||
IF(GTK_FOUND)
|
add_executable(gui1 gui1.cpp)
|
||||||
message(STATUS "GTK found compiling GUI apps")
|
target_link_libraries(gui1 PRIVATE ${wxWidgets_LIBRARIES})
|
||||||
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)
|
|
|
@ -1,23 +0,0 @@
|
||||||
// Include gtk
|
|
||||||
//#include <gtk/gtk.h>
|
|
||||||
#include <gtk-2.0/gdk/gdk.h>
|
|
||||||
#include <gtk-2.0/gtk/gtk.h>
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
|
@ -1 +1,2 @@
|
||||||
add_subdirectory(memory)
|
add_subdirectory(memory)
|
||||||
|
add_subdirectory(dec)
|
|
@ -1,2 +1,4 @@
|
||||||
add_executable(memorymodel model.cpp)
|
add_executable(memorymodel model.cpp)
|
||||||
add_executable(volatile volatile.cpp)
|
add_executable(volatile volatile.cpp)
|
||||||
|
add_executable(cmem cmem.c)
|
||||||
|
add_executable(cautofree cautofree.c)
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#include "../../../include/misc/memory/model.h"
|
#include "../../../include/misc/memory/model.h"
|
||||||
#include "../../../include/misc/util/debug.h"
|
#include "../../../include/misc/util/debug.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
#define UPtr std::unique_ptr
|
#define UPtr std::unique_ptr
|
||||||
#define SPtr std::shared_ptr
|
#define SPtr std::shared_ptr
|
||||||
|
#define Atomic std::atomic
|
||||||
|
|
||||||
template <typename Object>
|
template <typename Object>
|
||||||
Box<Object>::Box(Object *ref)
|
Box<Object>::Box(Object *ref)
|
||||||
|
@ -95,5 +97,7 @@ int main(void)
|
||||||
printBoxContent(box1);
|
printBoxContent(box1);
|
||||||
Box<Point2D<int>> box2=box1;
|
Box<Point2D<int>> box2=box1;
|
||||||
printBoxContent(box2);
|
printBoxContent(box2);
|
||||||
|
Atomic<int> atomic_int(12);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
inline unsigned long getTimestamp(){
|
inline unsigned long getTimestamp(){
|
||||||
unsigned hi,lo;
|
unsigned hi,lo;
|
||||||
asm ("rdtsc": "=a" (lo), "=d" (hi) );
|
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(){
|
inline unsigned long getTimestampVolatile(){
|
||||||
|
|
Loading…
Reference in a new issue