-
Notifications
You must be signed in to change notification settings - Fork 0
/
sack_ucb_typelib.h
7614 lines (7614 loc) · 340 KB
/
sack_ucb_typelib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#define NO_OPEN_MACRO
#define __STATIC__
#define __NO_OPTIONS__
#define __NO_ODBC__
#define NO_FILEOP_ALIAS
#define SACK_BAG_EXPORTS
//#define TYPELIB_SOURCE
#define __NO_INTERFACE_SUPPORT__
#include <stdio.h>
#include <stdarg.h>
/* Includes the system platform as required or appropriate. If
under a linux system, include appropriate basic linux type
headers, if under windows pull "windows.h".
Includes the MOST stuff here ( a full windows.h parse is many
many lines of code.) */
/* A macro to build a wide character string of __FILE__ */
#define _WIDE__FILE__(n) n
#define WIDE__FILE__ _WIDE__FILE__(__FILE__)
#if _XOPEN_SOURCE < 500
# undef _XOPEN_SOURCE
# define _XOPEN_SOURCE 500
#endif
# ifndef _GNU_SOURCE
# define _GNU_SOURCE
# endif
#ifndef STANDARD_HEADERS_INCLUDED
/* multiple inclusion protection symbol */
#define STANDARD_HEADERS_INCLUDED
#if _POSIX_C_SOURCE < 200112L
# ifdef _POSIX_C_SOURCE
# undef _POSIX_C_SOURCE
# endif
# define _POSIX_C_SOURCE 200112L
#endif
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#if _MSC_VER
# ifdef EXCLUDE_SAFEINT_H
# define _INTSAFE_H_INCLUDED_
# endif
//_MSC_VER
#endif
#ifndef WINVER
# define WINVER 0x0601
#endif
#ifndef _WIN32
# ifndef __LINUX__
# define __LINUX__
# endif
#endif
#if !defined(__LINUX__)
# ifndef STRICT
# define STRICT
# endif
# define WIN32_LEAN_AND_MEAN
// #define NOGDICAPMASKS // CC_*, LC_*, PC_*, CP_*, TC_*, RC_
// #define NOVIRTUALKEYCODES // VK_*
// #define NOWINMESSAGES // WM_*, EM_*, LB_*, CB_*
// #define NOWINSTYLES // WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_*
// #define NOSYSMETRICS // SM_*
// #define NOMENUS // MF_*
// #define NOICONS // IDI_*
// #define NOKEYSTATES // MK_*
// #define NOSYSCOMMANDS // SC_*
// #define NORASTEROPS // Binary and Tertiary raster ops
// #define NOSHOWWINDOW // SW_*
// OEM Resource values
# define OEMRESOURCE
// #define NOATOM // Atom Manager routines
# ifndef _INCLUDE_CLIPBOARD
// Clipboard routines
# define NOCLIPBOARD
# endif
// #define NOCOLOR // Screen colors
// #define NOCTLMGR // Control and Dialog routines
//(spv) #define NODRAWTEXT // DrawText() and DT_*
// #define NOGDI // All GDI defines and routines
// #define NOKERNEL // All KERNEL defines and routines
// #define NOUSER // All USER defines and routines
# ifndef _ARM_
# ifndef _INCLUDE_NLS
// All NLS defines and routines
# define NONLS
# endif
# endif
// #define NOMB // MB_* and MessageBox()
// GMEM_*, LMEM_*, GHND, LHND, associated routines
# define NOMEMMGR
// typedef METAFILEPICT
# define NOMETAFILE
# ifndef NOMINMAX
// Macros min(a,b) and max(a,b)
# define NOMINMAX
# endif
// #define NOMSG // typedef MSG and associated routines
// #define NOOPENFILE // OpenFile(), OemToAnsi, AnsiToOem, and OF_*
// #define NOSCROLL // SB_* and scrolling routines
// All Service Controller routines, SERVICE_ equates, etc.
# define NOSERVICE
//#define NOSOUND // Sound driver routines
# ifndef _INCLUDE_TEXTMETRIC
// typedef TEXTMETRIC and associated routines
# define NOTEXTMETRIC
# endif
// #define NOWH // SetWindowsHook and WH_*
// #define NOWINOFFSETS // GWL_*, GCL_*, associated routines
// #define NOCOMM // COMM driver routines
// Kanji support stuff.
# define NOKANJI
// Help engine interface.
# define NOHELP
// Profiler interface.
# define NOPROFILER
//#define NODEFERWINDOWPOS // DeferWindowPos routines
// Modem Configuration Extensions
# define NOMCX
// no StrCat StrCmp StrCpy etc functions. (used internally)
# define NO_SHLWAPI_STRFCNS
// This also has defines that override StrCmp StrCpy etc... but no override
# define STRSAFE_NO_DEPRECATE
# ifdef _MSC_VER
# ifndef _WIN32_WINDOWS
// needed at least this for what - updatelayeredwindow?
# define _WIN32_WINDOWS 0x0601
# endif
# endif
// INCLUDE WINDOWS.H
# ifdef __WATCOMC__
# undef _WINDOWS_
# endif
# ifdef UNDER_CE
// just in case windows.h also fails after undef WIN32
// these will be the correct order for primitives we require.
# include <excpt.h>
# include <windef.h>
# include <winnt.h>
# include <winbase.h>
# include <wingdi.h>
# include <wtypes.h>
# include <winuser.h>
# undef WIN32
# endif
# define _WINSOCKAPI_
# include <windows.h>
# undef _WINSOCKAPI_
# if defined( WIN32 ) && defined( NEED_SHLOBJ )
# include <shlobj.h>
# endif
# if _MSC_VER > 1500
# define fileno _fileno
# define stricmp _stricmp
# define strdup _strdup
# endif
# ifdef WANT_MMSYSTEM
# include <mmsystem.h>
# endif
# if USE_NATIVE_TIME_GET_TIME
//# include <windowsx.h>
// we like timeGetTime() instead of GetTickCount()
//# include <mmsystem.h>
# ifdef __cplusplus
extern "C"
# endif
__declspec(dllimport) DWORD WINAPI timeGetTime(void);
# endif
# ifdef WIN32
# if defined( NEED_SHLAPI )
# include <shlwapi.h>
# include <shellapi.h>
# endif
# ifdef NEED_V4W
# include <vfw.h>
# endif
# endif
# if defined( HAVE_ENVIRONMENT )
# define getenv(name) OSALOT_GetEnvironmentVariable(name)
# define setenv(name,val) SetEnvironmentVariable(name,val)
# endif
# define Relinquish() Sleep(0)
//#pragma pragnoteonly("GetFunctionAddress is lazy and has no library cleanup - needs to be a lib func")
//#define GetFunctionAddress( lib, proc ) GetProcAddress( LoadLibrary( lib ), (proc) )
# ifdef __cplusplus_cli
# include <vcclr.h>
/*lprintf( */
# define DebugBreak() System::Console::WriteLine(gcnew System::String( WIDE__FILE__ "(" STRSYM(__LINE__) ") Would DebugBreak here..." ) );
//typedef unsigned int HANDLE;
//typedef unsigned int HMODULE;
//typedef unsigned int HWND;
//typedef unsigned int HRC;
//typedef unsigned int HMENU;
//typedef unsigned int HICON;
//typedef unsigned int HINSTANCE;
# endif
// ifdef unix/linux
#else
# include <pthread.h>
# include <sched.h>
# include <unistd.h>
# include <sys/time.h>
# if defined( __ARM__ )
# define DebugBreak()
# else
/* A symbol used to cause a debugger to break at a certain
point. Sometimes dynamicly loaded plugins can be hard to set
the breakpoint in the debugger, so it becomes easier to
recompile with a breakpoint in the right place.
Example
<code lang="c++">
DebugBreak();
</code> */
# ifdef __ANDROID__
# define DebugBreak()
# else
# if defined( __EMSCRIPTEN__ ) || defined( __ARM__ )
# define DebugBreak()
# else
# define DebugBreak() __asm__("int $3\n" )
# endif
# endif
# endif
# ifdef __ANDROID_OLD_PLATFORM_SUPPORT__
extern __sighandler_t bsd_signal(int, __sighandler_t);
# endif
// moved into timers - please linnk vs timers to get Sleep...
//#define Sleep(n) (usleep((n)*1000))
# define Relinquish() sched_yield()
# define GetLastError() (int32_t)errno
/* return with a THREAD_ID that is a unique, universally
identifier for the thread for inter process communication. */
# define GetCurrentProcessId() ((uint32_t)getpid())
# define GetCurrentThreadId() ((uint32_t)getpid())
// end if( !__LINUX__ )
#endif
#include <errno.h>
#ifndef NEED_MIN_MAX
# ifndef NO_MIN_MAX_MACROS
# define NO_MIN_MAX_MACROS
# endif
#endif
#ifndef NO_MIN_MAX_MACROS
# ifdef __cplusplus
# ifdef __GNUC__
# ifndef min
# define min(a,b) ((a)<(b))?(a):(b)
# endif
# endif
# endif
/* Define a min(a,b) macro when the compiler lacks it. */
# ifndef min
# define min(a,b) (((a)<(b))?(a):(b))
# endif
/* Why not add the max macro, also? */
# ifndef max
# define max(a,b) (((a)>(b))?(a):(b))
# endif
#endif
#ifndef SACK_PRIMITIVE_TYPES_INCLUDED
#define SACK_PRIMITIVE_TYPES_INCLUDED
/* Define most of the sack core types on which everything else is
based. Also defines some of the primitive container
structures. We also handle a lot of platform/compiler
abstraction here.
A reFactoring for stdint.h and uint32_t etc would be USEFUL!
where types don't exist, define them as apprpritate types instead.
But WHO doesn't have stdint? BTW is sizeof( size_t ) == sizeof( void* )
This is automatically included with stdhdrs.h; however, when
including sack_types.h, the minimal headers are pulled. */
#define HAS_STDINT
//#define USE_SACK_CUSTOM_MEMORY_ALLOCATION
// this has to be a compile option (option from cmake)
// enables debug dump mem...
#ifdef USE_SACK_CUSTOM_MEMORY_ALLOCATION
# define USE_CUSTOM_ALLOCER 1
#else
# define USE_CUSTOM_ALLOCER 0
#endif
#ifndef __64__
# if defined( _WIN64 ) || defined( ENVIRONMENT64 ) || defined( __x86_64__ ) || defined( __ia64 ) || defined( __ppc64__ ) || defined( __LP64__ )
# define __64__ 1
# endif
#endif
#ifdef _MSC_VER
# ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x501
# endif
# ifndef WIN32
# ifdef _WIN32
# define WIN32 _WIN32
# endif
# endif
// force windows on __MSVC
# ifndef WIN32
# define WIN32
# endif
#endif
#if !defined( __NO_THREAD_LOCAL__ ) && ( defined( _MSC_VER ) || defined( __WATCOMC__ ) )
# define HAS_TLS 1
# ifdef __cplusplus
# define DeclareThreadLocal static thread_local
# define DeclareThreadVar thread_local
# else
# define DeclareThreadLocal static __declspec(thread)
# define DeclareThreadVar __declspec(thread)
# endif
#elif !defined( __NO_THREAD_LOCAL__ ) && ( defined( __GNUC__ ) || defined( __MAC__ ) )
# define HAS_TLS 1
# ifdef __cplusplus
# define DeclareThreadLocal static thread_local
# define DeclareThreadVar thread_local
# else
# define DeclareThreadLocal static __thread
# define DeclareThreadVar __thread
# endif
#else
// if no HAS_TLS
# define DeclareThreadLocal static
# define DeclareThreadVar
#endif
#ifdef __cplusplus_cli
// these things define a type called 'Byte'
// which causes confusion... so don't include vcclr for those guys.
# ifdef SACK_BAG_EXPORTS
// maybe only do this while building sack_bag project itself...
# if !defined( ZCONF_H ) && !defined( __FT2_BUILD_GENERIC_H__ ) && !defined( ZUTIL_H ) && !defined( SQLITE_PRIVATE ) && !defined( NETSERVICE_SOURCE ) && !defined( LIBRARY_DEF )
//using namespace System;
# endif
# endif
#endif
// Defined for building visual studio monolithic build. These symbols are not relavent with cmakelists.
#ifdef SACK_BAG_EXPORTS
# define SACK_BAG_CORE_EXPORTS
// exports don't really matter with CLI compilation.
# ifndef BAG
//#ifndef TARGETNAME
//# define TARGETNAME "sack_bag.dll" //$(TargetFileName)
//#endif
# define MD5_SOURCE
# define USE_SACK_FILE_IO
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define MEM_LIBRARY_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define SYSLOG_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define _TYPELIBRARY_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define HTTP_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define TIMER_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define IDLE_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define CLIENTMSG_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define FRACTION_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define NETWORK_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define CONFIGURATION_LIBRARY_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define FILESYSTEM_LIBRARY_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define SYSTEM_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define FILEMONITOR_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define VECTOR_LIBRARY_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
#define SHA1_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define CONSTRUCT_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define PROCREG_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define SQLPROXY_LIBRARY_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define TYPELIB_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define JSON_EMITTER_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define SERVICE_SOURCE
# ifndef __NO_SQL__
# ifndef __NO_OPTIONS__
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. and not NO_SQL and not NO_OPTIONS */
# define SQLGETOPTION_SOURCE
# endif
# endif
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define PSI_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define MNG_BUILD_DLL
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define BAGIMAGE_EXPORTS
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# ifndef IMAGE_LIBRARY_SOURCE
# define IMAGE_LIBRARY_SOURCE
# endif
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define SYSTRAY_LIBRARAY
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define SOURCE_PSI2
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
# define VIDEO_LIBRARY_SOURCE
/* Defined when SACK_BAG_EXPORTS is defined. This was an
individual library module once upon a time. */
/* define RENDER SOURCE when building monolithic. */
# ifndef RENDER_LIBRARY_SOURCE
# define RENDER_LIBRARY_SOURCE
# endif
// define a type that is a public name struct type...
// good thing that typedef and struct were split
// during the process of port to /clr option.
//#define PUBLIC_TYPE public
# else
//#define PUBLIC_TYPE
# ifdef __cplusplus_CLR
//using namespace System;
# endif
# endif
#endif
// wchar for X_16 definition
#include <wchar.h>
#include <sys/types.h>
#include <sys/stat.h>
#if !defined( _WIN32 ) && !defined( __MAC__ )
# include <sys/syscall.h>
#elif defined( __MAC__ )
#endif
#ifndef MY_TYPES_INCLUDED
# define MY_TYPES_INCLUDED
// include this before anything else
// thereby allowing us to redefine exit()
// CHAR_BIT
# include <limits.h>
// typelib requires this
# ifdef _MSC_VER
# ifndef UNDER_CE
// memlib requires this, and it MUST be included befoer string.h if it is used.
# include <intrin.h>
# endif
# endif
// typelib requires this
# include <string.h>
# if !defined( WIN32 ) && !defined( _WIN32 ) && !defined( _PNACL )
# include <dlfcn.h>
# endif
# if defined( _MSC_VER )
# define EMPTY_STRUCT struct { char nothing[]; }
# endif
# if defined( __WATCOMC__ )
# define EMPTY_STRUCT char
# endif
# ifdef __cplusplus
/* Could also consider defining 'SACK_NAMESPACE' as 'extern "C"
' {' and '..._END' as '}' */
# define SACK_NAMESPACE namespace sack {
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define SACK_NAMESPACE_END }
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _CONTAINER_NAMESPACE namespace containers {
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _CONTAINER_NAMESPACE_END }
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _LINKLIST_NAMESPACE namespace list {
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _LINKLIST_NAMESPACE_END }
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _DATALIST_NAMESPACE namespace data_list {
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _DATALIST_NAMESPACE_END }
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _SETS_NAMESPACE namespace sets {
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _SETS_NAMESPACE_END }
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _TEXT_NAMESPACE namespace text {
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _TEXT_NAMESPACE_END }
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define TEXT_NAMESPACE SACK_NAMESPACE _CONTAINER_NAMESPACE namespace text {
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define TEXT_NAMESPACE_END } _CONTAINER_NAMESPACE_END SACK_NAMESPACE_END
# else
/* Define the sack namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define SACK_NAMESPACE
/* Define the sack namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define SACK_NAMESPACE_END
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _CONTAINER_NAMESPACE
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _CONTAINER_NAMESPACE_END
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _LINKLIST_NAMESPACE
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _LINKLIST_NAMESPACE_END
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _DATALIST_NAMESPACE
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _DATALIST_NAMESPACE_END
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _SETS_NAMESPACE
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _SETS_NAMESPACE_END
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _TEXT_NAMESPACE
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define _TEXT_NAMESPACE_END
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define TEXT_NAMESPACE
/* Define the container namespace (when building with C++, the
wrappers are namespace{} instead of extern"c"{} ) */
# define TEXT_NAMESPACE_END
# endif
/* declare composite SACK_CONTAINER namespace to declare sack::container in a single line */
# define SACK_CONTAINER_NAMESPACE SACK_NAMESPACE _CONTAINER_NAMESPACE
/* declare composite SACK_CONTAINER namespace to close sack::container in a single line */
# define SACK_CONTAINER_NAMESPACE_END _CONTAINER_NAMESPACE_END SACK_NAMESPACE_END
/* declare composite SACK_CONTAINER namespace to declare sack::container::list in a single line */
# define SACK_CONTAINER_LINKLIST_NAMESPACE SACK_CONTAINER_NAMESPACE _LISTLIST_NAMESPACE
/* declare composite SACK_CONTAINER namespace to close sack::container::list in a single line */
# define SACK_CONTAINER_LINKLIST_NAMESPACE_END _LISTLIST_NAMESPACE_END SACK_CONTAINER_NAMESPACE
// this symbols is defined to enforce
// the C Procedure standard - using a stack, and resulting
// in EDX:EAX etc...
# define CPROC
# ifdef SACK_BAG_EXPORTS
# ifdef BUILD_GLUE
// this is used as the export method appropriate for C#?
# define EXPORT_METHOD [DllImport(LibName)] public
# else
# ifdef __cplusplus_cli
# if defined( __STATIC__ ) || defined( __LINUX__ ) || defined( __ANDROID__ )
# define EXPORT_METHOD
# define IMPORT_METHOD extern
# else
# define EXPORT_METHOD __declspec(dllexport)
# define IMPORT_METHOD __declspec(dllimport)
# endif
# define LITERAL_LIB_EXPORT_METHOD __declspec(dllexport)
# define LITERAL_LIB_IMPORT_METHOD extern
//__declspec(dllimport)
# else
# if defined( __STATIC__ ) || defined( __LINUX__ ) || defined( __ANDROID__ )
# define EXPORT_METHOD
# define IMPORT_METHOD extern
# else
/* Method to declare functions exported from a DLL. (nothign on
LINUX or building statically, but __declspec(dllimport) on
windows ) */
# define EXPORT_METHOD __declspec(dllexport)
/* method to define a function which will be Imported from a
library. Under windows, this is probably
__declspec(dllimport). Under linux this is probably 'extern'. */
# define IMPORT_METHOD __declspec(dllimport)
# endif
# define LITERAL_LIB_EXPORT_METHOD __declspec(dllexport)
# define LITERAL_LIB_IMPORT_METHOD __declspec(dllimport)
# endif
# endif
# else
# if ( !defined( __STATIC__ ) && defined( WIN32 ) && !defined( __cplusplus_cli) )
# define EXPORT_METHOD __declspec(dllexport)
# define IMPORT_METHOD __declspec(dllimport)
# define LITERAL_LIB_EXPORT_METHOD __declspec(dllexport)
# define LITERAL_LIB_IMPORT_METHOD __declspec(dllimport)
# else
// MRT: This is needed. Need to see what may be defined wrong and fix it.
# if defined( __LINUX__ ) || defined( __STATIC__ ) || defined( __ANDROID__ )
# define EXPORT_METHOD
# define IMPORT_METHOD extern
# define LITERAL_LIB_EXPORT_METHOD
# define LITERAL_LIB_IMPORT_METHOD extern
# else
# define EXPORT_METHOD __declspec(dllexport)
# define IMPORT_METHOD __declspec(dllimport)
/* Define how methods in LITERAL_LIBRARIES are exported.
literal_libraries are libraries that are used for plugins,
and are dynamically loaded by code. They break the rules of
system prefix and suffix extensions. LITERAL_LIBRARIES are
always dynamic, and never static. */
# define LITERAL_LIB_EXPORT_METHOD __declspec(dllexport)
/* Define how methods in LITERAL_LIBRARIES are imported.
literal_libraries are libraries that are used for plugins,
and are dynamically loaded by code. They break the rules of
system prefix and suffix extensions. LITERAL_LIBRARIES are
always dynamic, and never static. */
# define LITERAL_LIB_IMPORT_METHOD __declspec(dllimport)
# endif
# endif
#endif
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <emscripten/emscripten.h>
// Emscripten exports just need to be not optimized out.
# undef EXPORT_METHOD
# define EXPORT_METHOD EMSCRIPTEN_KEEPALIVE
# undef LITERAL_LIB_EXPORT_METHOD
# define LITERAL_LIB_EXPORT_METHOD EMSCRIPTEN_KEEPALIVE
#endif
// used when the keword specifying a structure is packed
// needs to prefix the struct keyword.
#define PREFIX_PACKED
// private thing left as a note, and forgotten. some compilers did not define offsetof
#define my_offsetof( ppstruc, member ) ((uintptr_t)&((*ppstruc)->member)) - ((uintptr_t)(*ppstruc))
SACK_NAMESPACE
#ifdef BCC16
#define __inline__
#define MAINPROC(type,name) type _pascal name
// winproc is intended for use at libmain/wep/winmain...
#define WINPROC(type,name) type _far _pascal _export name
// callbackproc is for things like timers, dlgprocs, wndprocs...
#define CALLBACKPROC(type,name) type _far _pascal _export name
#define PUBLIC(type,name) type STDPROC _export name
/* here would be if dwReason == process_attach */
#define LIBMAIN() WINPROC(int, LibMain)(HINSTANCE hInstance, WORD wDataSeg, WORD wHeapSize, LPSTR lpCmdLine ) { {
/* end if */
/*endproc*/
#define LIBEXIT() } } int STDPROC WEP(int nSystemExit ) {
#define LIBMAIN_END() }
// should use this define for all local defines...
// this will allow one place to modify ALL _pascal or not to _pascal decls.
#define STDPROC _far _pascal
#endif
#if defined( __LCC__ ) || defined( _MSC_VER ) || defined(__DMC__) || defined( __WATCOMC__ )
#ifdef __WATCOMC__
#undef CPROC
#define CPROC __cdecl
#define STDPROC __cdecl
#ifndef __WATCOMC__
// watcom windef.h headers define this
#define STDCALL _stdcall
#endif
#if __WATCOMC__ >= 1280
// watcom windef.h headers no longer define this.
#define STDCALL __stdcall
#endif
#undef PREFIX_PACKED
#define PREFIX_PACKED _Packed
#else
#undef CPROC
//#error blah
#define CPROC __cdecl
#define STDPROC
#define STDCALL _stdcall
#endif
#define far
#define huge
#define near
#define _far
#define _huge
#define _near
/* portability type for porting legacy 16 bit applications. */
/* portability macro for legacy 16 bit applications. */
#define __far
#ifndef FAR
#define FAR
#endif
//#define HUGE
//#ifndef NEAR
//#define NEAR
//#endif
#define _fastcall
#ifdef __cplusplus
#ifdef __cplusplus_cli
#define PUBLIC(type,name) extern "C" LITERAL_LIB_EXPORT_METHOD type CPROC name
#else
//#error what the hell!?
// okay Public functions are meant to be loaded with LoadFuncion( "library" , "function name" );
#define PUBLIC(type,name) extern "C" LITERAL_LIB_EXPORT_METHOD type CPROC name
#endif
#else
#define PUBLIC(type,name) LITERAL_LIB_EXPORT_METHOD type CPROC name
#endif
#define MAINPROC(type,name) type WINAPI name
#define WINPROC(type,name) type WINAPI name
#define CALLBACKPROC(type,name) type CALLBACK name
#if defined( __WATCOMC__ )
#define LIBMAIN() static int __LibMain( HINSTANCE ); PRELOAD( LibraryInitializer ) { __LibMain( GetModuleHandle(TARGETNAME) ); } static int __LibMain( HINSTANCE hInstance ) {
#define LIBEXIT() } static int LibExit( void ); ATEXIT( LiraryUninitializer ) { LibExit(); } int LibExit(void) {
#define LIBMAIN_END() }
#else
#ifdef TARGETNAME
#define LIBMAIN() static int __LibMain( HINSTANCE ); PRELOAD( LibraryInitializer ) { __LibMain( GetModuleHandle(TARGETNAME) ); } static int __LibMain( HINSTANCE hInstance ) {
#else
#define LIBMAIN() TARGETNAME_NOT_DEFINED
#endif
#define LIBEXIT() } static int LibExit( void ); ATEXIT( LiraryUninitializer ) { LibExit(); } int LibExit(void) {
#define LIBMAIN_END() }
#endif
#define PACKED
#endif
#if defined( __GNUC__ )
# ifndef STDPROC
# define STDPROC
# endif
# ifndef STDCALL
// for IsBadCodePtr which isn't a linux function...
# define STDCALL
# endif
# ifndef WINAPI
# ifdef __LINUX__
# define WINAPI
# else
# define WINAPI __stdcall
# endif
# endif
# ifndef PASCAL
//#define PASCAL
# endif
# define WINPROC(type,name) type WINAPI name
# define CALLBACKPROC( type, name ) type name
# define PUBLIC(type,name) EXPORT_METHOD type CPROC name
# define LIBMAIN() static int __LibMain( HINSTANCE ); PRELOAD( LibraryInitializer ) { __LibMain( GetModuleHandle(TARGETNAME) ); } static int __LibMain( HINSTANCE hInstance ) {
# define LIBEXIT() } static int LibExit( void ); ATEXIT( LiraryUninitializer ) { LibExit(); } int LibExit(void) {
# define LIBMAIN_END() }
/* Portability Macro for porting legacy code forward. */
# define FAR
# define NEAR
//#define HUGE
# define far
# define near
# define huge
# define PACKED __attribute__((packed))
#endif
#if defined( BCC32 )
#define far
#define huge
/* define obsolete keyword for porting purposes */
/* defined for porting from 16 bit environments */
#define near
/* portability macro for legacy 16 bit applications. */
#define _far
#define _huge
#define _near
/* portability type for porting to compilers that don't inline. */
/* portability macro for legacy 16 bit applications. */
#define __inline__
#define MAINPROC(type,name) type _pascal name
// winproc is intended for use at libmain/wep/winmain...
#define WINPROC(type,name) EXPORT_METHOD type _pascal name
// callbackproc is for things like timers, dlgprocs, wndprocs...
#define CALLBACKPROC(type,name) EXPORT_METHOD type _stdcall name
#define STDCALL _stdcall
#define PUBLIC(type,name) type STDPROC name
#ifdef __STATIC__
/*Log( "Library Enter" );*/
#define LIBMAIN() static WINPROC(int, LibMain)(HINSTANCE hInstance, DWORD dwReason, void *unused ) { if( dwReason == DLL_PROCESS_ATTACH ) {
/* end if */
#define LIBEXIT() } if( dwReason == DLL_PROCESS_DETACH ) {
#define LIBMAIN_END() } return 1; }
#else
/*Log( "Library Enter" );*/
#define LIBMAIN() WINPROC(int, LibMain)(HINSTANCE hInstance, DWORD dwReason, void *unused ) { if( dwReason == DLL_PROCESS_ATTACH ) {
/* end if */
#define LIBEXIT() } if( dwReason == DLL_PROCESS_DETACH ) {
#define LIBMAIN_END() } return 1; }
#endif
// should use this define for all local defines...
// this will allow one place to modify ALL _pascal or not to _pascal decls.
#define STDPROC _pascal
#define PACKED
#endif
#define TOCHR(n) #n[0]
#define TOSTR(n) #n
#define STRSYM(n) TOSTR(n)
#define _WIDE__FILE__(n) n
#define WIDE__FILE__ _WIDE__FILE__(__FILE__)
/* a constant text string that represents the current source
filename and line... fourmated as "source.c(11) :" */
#define FILELINE TEXT(__FILE__) "(" TEXT(STRSYM(__LINE__))" : ")
#if defined( _MSC_VER ) || defined( __PPCCPP__ )
/* try and define a way to emit comipler messages... but like no compilers support standard ways to do this accross the board.*/
#define pragnote(msg) message( FILELINE msg )
/* try and define a way to emit comipler messages... but like no compilers support standard ways to do this accross the board.*/
#define pragnoteonly(msg) message( msg )
#else
/* try and define a way to emit comipler messages... but like no compilers support standard ways to do this accross the board.*/
#define pragnote(msg) msg
/* try and define a way to emit comipler messages... but like no compilers support standard ways to do this accross the board.*/
#define pragnoteonly(msg) msg
#endif
/* specify a consistant macro to pass current file and line information. This are appended parameters, and common usage is to only use these with _DEBUG set. */
#define FILELINE_SRC , __FILE__, __LINE__
/* specify a consistant macro to pass current file and line information, to functions which void param lists. This are appended parameters, and common usage is to only use these with _DEBUG set. */
#define FILELINE_VOIDSRC __FILE__, __LINE__
//#define FILELINE_LEADSRC __FILE__, __LINE__,
/* specify a consistant macro to define file and line parameters, to functions with otherwise void param lists. This are appended parameters, and common usage is to only use these with _DEBUG set. */
#define FILELINE_VOIDPASS CTEXTSTR pFile, uint32_t nLine
//#define FILELINE_LEADPASS CTEXTSTR pFile, uint32_t nLine,
/* specify a consistant macro to define file and line parameters. This are appended parameters, and common usage is to only use these with _DEBUG set. */
#define FILELINE_PASS , CTEXTSTR pFile, uint32_t nLine
/* specify a consistant macro to forward file and line parameters. This are appended parameters, and common usage is to only use these with _DEBUG set. */
#define FILELINE_RELAY , pFile, nLine
/* specify a consistant macro to forward file and line parameters. This are appended parameters, and common usage is to only use these with _DEBUG set. */
#define FILELINE_NULL , NULL, 0
/* specify a consistant macro to forward file and line parameters, to functions which have void parameter lists without this information. This are appended parameters, and common usage is to only use these with _DEBUG set. */
#define FILELINE_VOIDRELAY pFile, nLine
/* specify a consistant macro to format file and line information for printf formated strings. */
#define FILELINE_FILELINEFMT "%s(%" _32f "): "
#define FILELINE_FILELINEFMT_MIN "%s(%" _32f ")"
#define FILELINE_NULL , NULL, 0
#define FILELINE_VOIDNULL NULL, 0
/* define static parameters which are the declaration's current file and line, for stubbing in where debugging is being stripped.
usage
FILELINE_VARSRC: // declare pFile and nLine variables.
*/
#define FILELINE_VARSRC CTEXTSTR pFile = __FILE__; uint32_t nLine = __LINE__
// this is for passing FILE, LINE information to allocate
// useful during DEBUG phases only...
// drop out these debug relay paramters for managed code...
// we're going to have the full call frame managed and known...
#if !defined( _DEBUG ) && !defined( _DEBUG_INFO )
# if defined( __LINUX__ ) && !defined( __PPCCPP__ )
//#warning "Setting DBG_PASS and DBG_FORWARD to be ignored."
# else
//#pragma pragnoteonly("Setting DBG_PASS and DBG_FORWARD to be ignored" )
# endif
#define DBG_AVAILABLE 0
/* in NDEBUG mode, pass nothing */
#define DBG_SRC
/* <combine sack::DBG_PASS>
in NDEBUG mode, pass nothing */
#define DBG_VOIDSRC
/* <combine sack::DBG_PASS>
\#define DBG_LEADSRC in NDEBUG mode, declare (void) */
/* <combine sack::DBG_PASS>
\ \ */
#define DBG_VOIDPASS void
/* <combine sack::DBG_PASS>
in NDEBUG mode, pass nothing */
#define DBG_PASS
/* <combine sack::DBG_PASS>
in NDEBUG mode, pass nothing */
#define DBG_RELAY
/* <combine sack::DBG_PASS>
in _DEBUG mode, pass FILELINE_NULL */
#define DBG_NULL
/* <combine sack::DBG_PASS>
in NDEBUG mode, pass nothing */
#define DBG_VOIDRELAY
/* <combine sack::DBG_PASS>
in NDEBUG mode, pass nothing */
#define DBG_FILELINEFMT
/* <combine sack::DBG_PASS>
in NDEBUG mode, pass nothing */
#define DBG_FILELINEFMT_MIN
/* <combine sack::DBG_PASS>
in NDEBUG mode, pass nothing
Example
printf( DBG_FILELINEFMT ": extra message" DBG_PASS ); */
#define DBG_VARSRC
#else
// these DBG_ formats are commented out from duplication in sharemem.h
# if defined( __LINUX__ ) && !defined( __PPCCPP__ )
//#warning "Setting DBG_PASS and DBG_FORWARD to work."
# else
//#pragma pragnoteonly("Setting DBG_PASS and DBG_FORWARD to work" )
# endif
// used to specify whether debug information is being passed - can be referenced in compiled code
#define DBG_AVAILABLE 1
/* <combine sack::DBG_PASS>
in _DEBUG mode, pass FILELINE_SRC */
#define DBG_SRC FILELINE_SRC
/* <combine sack::DBG_PASS>
in _DEBUG mode, pass FILELINE_VOIDSRC */
#define DBG_VOIDSRC FILELINE_VOIDSRC
/* <combine sack::DBG_PASS>
in _DEBUG mode, pass FILELINE_VOIDPASS */
#define DBG_VOIDPASS FILELINE_VOIDPASS
/* <combine sack::DBG_PASS>
in NDEBUG mode, pass nothing */
/* Example
This example shows forwarding debug information through a
chain of routines.
<code lang="c++">
void ReportFunction( int sum DBG_PASS )
{
printf( "%s(%d):started this whole mess\\n" DBG_RELAY );
}
void TrackingFunction( int a, int b DBG_PASS )
{
ReportFunction( a+b, DBG_RELAY );
}
void CallTrack( void )
{
TrackingFunction( 1, 2 DBG_SRC );
}
</code>
In this example, the debug information is passed to the
logging system. This allows logging to blame the user
application for allocations, releases, locks, etc...
<code lang="c++">
void MyAlloc( int size DBG_PASS )
{
_lprintf( DBG_RELAY )( ": alloc %d\\n", size );
}
void g( void )
{
lprintf( "Will Allocate %d\\n", 32 );
MyAlloc( 32 DBG_SRC );
}
</code>
This example uses the void argument macros
<code>
void SimpleFunction( DBG_VOIDPASS )
{
// this function usually has (void) parameters.
}
void f( void )
{
SimpleFunction( DBG_VOIDSRC );
}
</code>
Description
in NDEBUG mode, pass nothing.
This function allows specification of DBG_RELAY or DBG_SRC
under debug compilation. Otherwise, the simple AddLink macro
should be used. DBG_RELAY can be used to forward file and
line information which has been passed via DBG_PASS
declaration in the function parameters.
This is a part of a set of macros which allow additional
logging information to be passed.
These 3 are the most commonly used.
DBG_SRC - this passes the current __FILE__, __LINE__
\parameters.
DBG_PASS - this is used on a function declaration, is a
filename and line number from DBG_SRC or DBG_RELAY.
DBG_RELAY - this passes the file and line passed to this
function to another function with DBG_PASS defined on it.
DBG_VOIDPASS - used when the argument list is ( void )
without debugging information.
DBG_VOIDSRC - used to call a function who's argument list is
( void ) without debugging information.
DBG_VOIDRELAY - pass file and line information forward to
another function, who's argument list is ( void ) without
debugging information.
Remarks
The SACK library is highly instrumented with this sort of
information. Very commonly the only difference between a
specific function called 'MyFunctionName' and
'MyFunctionNameEx' is the addition of debug information
tracking.
The following code blocks show the evolution added to add