1 #pragma once
2 
3 /*max@home*/
4 #ifndef __GLOBAL_DEF_H__
5 #define __GLOBAL_DEF_H__
6 #ifdef _WIN32
7 #define GLOBAL_LOCK(P) GlobalLock(P)
8 #define GLOBAL_ALLOC(T, S) GlobalAlloc(T, S)
9 #define GLOBAL_FREE(P) GlobalFree(P)
10 #define GLOBAL_UNLOCK(P) GlobalUnlock(P)
11 #else
12 #ifdef __APPLE__
13 /*
14 #define GLOBAL_LOCK(P)      *(P)
15 //#define GLOBAL_ALLOC(T, S)  NewHandle(S)
16 //#define GLOBAL_FREE(P)      DisposeHandle( (char**)P)
17 #define GLOBAL_ALLOC(T, S)  (TW_HANDLE)NewPtr(S)
18 #define GLOBAL_FREE(S)      DisposePtr(S)
19 #define GLOBAL_UNLOCK(P)    {}
20 */
21 
22 #define GLOBAL_ALLOC(T, S) NewHandle(S)
23 #define GLOBAL_FREE(P) DisposeHandle(P)
24 //#define GLOBAL_ALLOC(T, S)  (TW_HANDLE)NewPtr(S)
25 //#define GLOBAL_FREE(S)      DisposePtr((char*)S)
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 TW_HANDLE GLOBAL_LOCK(TW_HANDLE S);
32 
33 #ifdef __cplusplus
34 }
35 #endif
36 
37 #define GLOBAL_UNLOCK(P) HUnlock((TW_HANDLE)P)
38 
39 #else /* UNIX */
40 
41 #include <stdlib.h>
42 /* just some hack to get it built */
43 typedef void *TW_HANDLE;
44 #define GLOBAL_LOCK(P) (P)
45 #define GLOBAL_ALLOC(T, S) malloc(S)
46 #define GLOBAL_FREE(P) free(P)
47 #define GLOBAL_UNLOCK(P)
48 
49 #endif
50 #endif
51 #endif /*__GLOBAL_DEF_H__*/
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 void TTWAIN_ErrorBox(const char *msg);
58 
59 #ifdef __cplusplus
60 }
61 #endif
62