2019-04-19 11:32:13 -05:00
// 19 april 2019
2019-06-01 08:27:17 -05:00
# include <errno.h>
2019-06-08 17:22:16 -05:00
# include <inttypes.h>
2019-05-31 21:07:51 -05:00
# include <stdarg.h>
2019-06-01 08:27:17 -05:00
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "ui.h"
# ifdef uiprivOSHeader
# include uiprivOSHeader
# endif
2019-05-31 21:07:51 -05:00
2019-04-21 14:08:09 -05:00
# ifdef __cplusplus
extern " C " {
# endif
2019-05-27 10:02:23 -05:00
// TODO figure out why this is needed despite what https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2013/b0084kay(v=vs.120) says
# ifdef _MSC_VER
# define uiprivFunc __FUNCTION__
# else
# define uiprivFunc __func__
# endif
2019-06-01 19:46:41 -05:00
// TODO {
// WHY IS THIS NEEDED?!?!?!?!!?!??!Q https://stackoverflow.com/questions/15610053/correct-printf-format-specifier-for-size-t-zu-or-iu SAYS THAT VS2013 DOES SUPPORT %zu
// AND WHY IS MINGW AFFECTED?!?!?!?!
// Oh and even better: the -Wno-pedantic-ms-printf stuff doesn't result in a warning about this either...
// }
2019-05-27 10:36:59 -05:00
# ifdef _WIN32
2019-05-27 10:18:05 -05:00
# define uiprivSizetPrintf "Iu"
# else
# define uiprivSizetPrintf "zu"
# endif
2019-06-01 19:20:11 -05:00
# include "../sharedbits/printfwarn_header.h"
# define uiprivPrintfFunc(decl, fmtpos, appos) sharedbitsPrintfFunc(decl, fmtpos, appos)
2019-06-01 10:24:34 -05:00
// main.c
2019-05-29 20:10:44 -05:00
extern bool uiprivSysInit ( void * options , uiInitError * err ) ;
2019-06-01 19:20:11 -05:00
uiprivPrintfFunc (
extern bool uiprivInitReturnErrorf ( uiInitError * err , const char * fmt , . . . ) ,
2 , 3 ) ;
2019-05-30 00:39:43 -05:00
extern void uiprivSysQueueMain ( void ( * f ) ( void * data ) , void * data ) ;
2019-05-28 20:54:13 -05:00
extern bool uiprivCheckInitializedAndThreadImpl ( const char * func ) ;
# define uiprivCheckInitializedAndThread() uiprivCheckInitializedAndThreadImpl(uiprivFunc)
extern bool uiprivSysCheckThread ( void ) ;
2019-04-21 14:08:09 -05:00
2019-05-16 22:02:03 -05:00
// alloc.c
2019-05-30 22:11:08 -05:00
# define sharedbitsPrefix uipriv
2019-06-01 08:27:17 -05:00
// TODO determine if we need the ../ or not, and if not, figure out if we should use it everywhere (including ui.h) or not
2019-05-30 22:11:08 -05:00
# include "../sharedbits/alloc_header.h"
2019-06-08 17:22:16 -05:00
# define uiprivNew(T) ((T *) uiprivAlloc(sizeof (T), #T))
2019-05-30 22:47:07 -05:00
# include "../sharedbits/array_header.h"
2019-05-19 17:06:58 -05:00
# define uiprivArrayStaticInit(T, grow, whatstr) { NULL, 0, 0, sizeof (T), grow, whatstr }
2019-05-30 22:47:07 -05:00
# define uiprivArrayInit(arr, T, nGrow, what) uiprivArrayInitFull(&(arr), sizeof (T), nGrow, what)
# define uiprivArrayFree(arr) uiprivArrayFreeFull(&(arr))
2019-05-19 11:52:06 -05:00
# define uiprivArrayAt(arr, T, n) (((T *) (arr.buf)) + (n))
2019-05-31 01:52:51 -05:00
# include "../sharedbits/strsafe_header.h"
2019-06-08 17:39:59 -05:00
# include "../sharedbits/strdup_header.h"
2019-05-30 22:11:08 -05:00
# undef sharedbitsPrefix
2019-05-16 22:02:03 -05:00
2019-05-13 09:46:42 -05:00
// errors.c
2019-06-01 19:20:11 -05:00
uiprivPrintfFunc (
extern void uiprivInternalError ( const char * fmt , . . . ) ,
1 , 2 ) ;
2019-06-02 01:23:12 -05:00
uiprivPrintfFunc (
extern void uiprivProgrammerError ( const char * fmt , . . . ) ,
1 , 2 ) ;
2019-06-02 07:35:40 -05:00
# include "programmererrors.h"
2019-05-13 20:30:18 -05:00
extern void uiprivReportError ( const char * prefix , const char * msg , const char * suffix , bool internal ) ;
2019-05-12 21:17:24 -05:00
2019-06-08 17:22:16 -05:00
// controls.c
extern bool uiprivOSVtableValid ( uiControlOSVtable * osVtable , const char * func ) ;
extern uiControlOSVtable * uiprivCloneOSVtable ( uiControlOSVtable * osVtable ) ;
2019-04-21 14:08:09 -05:00
# ifdef __cplusplus
}
# endif