diff --git a/test/meson.build b/test/meson.build index 457dfe41..b9aa1168 100644 --- a/test/meson.build +++ b/test/meson.build @@ -23,6 +23,7 @@ elif libui_OS == 'darwin' else libui_test_sources += [ 'controls_unix.c', + 'controls_unix_errors.cpp', ] endif diff --git a/test/test_unix.h b/test/test_unix.h new file mode 100644 index 00000000..e2876e35 --- /dev/null +++ b/test/test_unix.h @@ -0,0 +1,3 @@ +// 10 june 2019 +#define libuiOSHeader "../ui_unix.h" +#include "test.h" diff --git a/ui_unix.h b/ui_unix.h index 8975c4cb..b7f0ccdf 100644 --- a/ui_unix.h +++ b/ui_unix.h @@ -11,6 +11,10 @@ This file assumes that you have included and "ui.h" beforehand. It p extern "C" { #endif +struct uiControlOSVtable { + size_t Size; +}; + #ifdef __cplusplus } #endif diff --git a/unix/controls.c b/unix/controls.c new file mode 100644 index 00000000..b0ff2c98 --- /dev/null +++ b/unix/controls.c @@ -0,0 +1,20 @@ +// 8 june 2019 +#include "uipriv_unix.h" + +bool uiprivOSVtableValid(const uiControlOSVtable *osVtable, const char *func) +{ + if (osVtable->Size != sizeof (uiControlOSVtable)) { + uiprivProgrammerErrorWrongStructSize(osVtable->Size, "uiControlOSVtable", func); + return false; + } + return true; +} + +uiControlOSVtable *uiprivCloneOSVtable(const uiControlOSVtable *osVtable) +{ + uiControlOSVtable *v2; + + v2 = uiprivNew(uiControlOSVtable); + *v2 = *osVtable; + return v2; +} diff --git a/unix/meson.build b/unix/meson.build index 3ba81095..f8a35ded 100644 --- a/unix/meson.build +++ b/unix/meson.build @@ -1,6 +1,7 @@ # 23 march 2019 libui_sources += [ + 'unix/controls.c', 'unix/main.c', ]