MiniGUI API Reference (MiniGUI-Threads)  v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
common.h
Go to the documentation of this file.
1 
46 /*
47  * $Id: common.h 13674 2010-12-06 06:45:01Z wanzheng $
48  *
49  * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks,
50  * pSOS, ThreadX, NuCleus, OSE, and Win32.
51  *
52  * The definitions of some data types and byte order macros
53  * borrowed from LGPL'ed SDL by Sam Lantinga.
54  *
55  * Fix point math routines come from Allegro (a gift software)
56  * by Shawn Hargreaves and others.
57  */
58 
59 #ifndef _MGUI_COMMON_H
60 
61 #define _MGUI_COMMON_H
62 
63 #ifndef MINIGUI_MAJOR_VERSION
64 # undef PACKAGE
65 # undef VERSION
66 # undef PACKAGE_BUGREPORT
67 # undef PACKAGE_NAME
68 # undef PACKAGE_STRING
69 # undef PACKAGE_TARNAME
70 # undef PACKAGE_VERSION
71 # ifdef __MINIGUI_LIB__
72 # ifdef _FOR_DATANG
73 # ifdef WIN32
74 # include <config-win32/mgconfig.h>
75 # elif defined (__THREADX__)
76 # include "config-threadx/mgconfig.h"
77 # elif defined (__NUCLEUS__)
78 # include "config-nucleus/mgconfig.h"
79 # endif
80 # else
81 # if defined(__CMAKE_PROJECT__) || defined(WIN32)
82 # include "mgconfig.h"
83 # else
84 # include "../mgconfig.h"
85 # endif
86 # endif
87 # else
88 # include "mgconfig.h"
89 # endif
90 #endif
91 
92 #include <stdio.h>
93 #include <stdlib.h>
94 #include <string.h>
95 #include <stdint.h>
96 #include <stdarg.h>
97 #include <errno.h>
98 #include <assert.h>
99 
120 #define _VERSION_CODE(major, minor, micro) (((major)<<16) | ((minor)<<8) | (micro))
121 
128 #define _MINIGUI_VERSION_CODE \
129  ((MINIGUI_MAJOR_VERSION << 16) | (MINIGUI_MINOR_VERSION << 8) | MINIGUI_MICRO_VERSION)
130 
142 typedef unsigned char Uint8;
147 typedef signed char Sint8;
152 typedef unsigned short Uint16;
157 typedef signed short Sint16;
162 typedef unsigned int Uint32;
167 typedef signed int Sint32;
168 
169 /* Figure out how to support 64-bit datatypes */
170 #if !defined(__STRICT_ANSI__)
171 # if defined(__GNUC__)
172 # define MGUI_HAS_64BIT_TYPE long long
173 # endif
174 # if defined(__CC_ARM)
175 # define MGUI_HAS_64BIT_TYPE long long
176 # endif
177 # if defined(_MSC_VER)
178 # define MGUI_HAS_64BIT_TYPE __int64
179 # endif
180 #endif /* !__STRICT_ANSI__ */
181 
182 /* The 64-bit datatype isn't supported on all platforms */
183 #ifdef MGUI_HAS_64BIT_TYPE
184 
191 typedef unsigned MGUI_HAS_64BIT_TYPE Uint64;
198 typedef signed MGUI_HAS_64BIT_TYPE Sint64;
199 #else
200 /* This is really just a hack to prevent the compiler from complaining */
201 typedef struct {
202  Uint32 hi;
203  Uint32 lo;
204 } Uint64, Sint64;
205 #endif
206 
207 /* Make sure the types really have the right sizes */
208 #define MGUI_COMPILE_TIME_ASSERT(name, x) \
209  typedef int MGUI_dummy_ ## name[(x) * 2 - 1]
210 
211 MGUI_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
212 MGUI_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
213 MGUI_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
214 MGUI_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
215 MGUI_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
216 MGUI_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
217 MGUI_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
218 MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
219 
220 #undef MGUI_COMPILE_TIME_ASSERT
221 
233 #define MGUI_LIL_ENDIAN 1234
234 
238 #define MGUI_BIG_ENDIAN 4321
239 
240 /* Pardon the mess, I'm trying to determine the endianness of this host.
241  * I'm doing it by preprocessor defines rather than some sort of configure
242  * script so that application code can use this too. The "right" way would
243  * be to dynamically generate this file on install, but that's a lot of work.
244  */
245 
263 #if defined(__i386__) || defined(__ia64__) || defined(__x86_64__) || defined(__amd64) || \
264  (defined(__alpha__) || defined(__alpha)) || \
265  defined(__arm__) || \
266  (defined(__CC_ARM) && !defined(__BIG_ENDIAN)) || \
267  (defined(__mips__) && defined(__MIPSEL__)) || \
268  defined(__LITTLE_ENDIAN__) || \
269  defined(WIN32)
270 # define MGUI_BYTEORDER MGUI_LIL_ENDIAN
271 #else
272 # define MGUI_BYTEORDER MGUI_BIG_ENDIAN
273 #endif
274 
287 typedef void *PVOID;
288 
293 #ifndef BOOL
294 typedef int BOOL;
295 #endif
296 
301 #ifndef FALSE
302  #define FALSE 0
303 #endif
304 
308 #ifndef TRUE
309  #define TRUE 1
310 #endif
311 
316 #ifndef NULL
317 # ifdef __cplusplus
318 # define NULL (0)
319 # else
320 # define NULL ((void *)0)
321 # endif
322 #endif
323 
328 #define INV_PTR ((void *)-1)
329 
330 #define GUIAPI
331 
332 #if !defined(__NODLL__) && (defined (WIN32) || defined (__NUCLEUS_MNT__))
333 # if defined(__MINIGUI_LIB__)
334 # define MG_EXPORT __declspec(dllexport)
335 # else
336 # define MG_EXPORT __declspec(dllimport)
337 # endif
338 #else
339 # define MG_EXPORT
340 #endif
341 
353 typedef PVOID GHANDLE;
358 typedef GHANDLE HWND;
363 typedef GHANDLE HDC;
373 typedef GHANDLE HCURSOR;
378 typedef GHANDLE HICON;
383 typedef GHANDLE HMENU;
388 typedef GHANDLE HACCEL;
393 typedef GHANDLE HDLG;
398 typedef GHANDLE HHOOK;
399 
411 typedef unsigned char BYTE;
412 
417 typedef signed char SBYTE;
418 
427 #if defined(_WIN64)
428 # define SIZEOF_PTR 8
429 # define SIZEOF_HPTR 4
430 #elif defined(__LP64__)
431 # define SIZEOF_PTR 8
432 # define SIZEOF_HPTR 4
433 #else
434 # define SIZEOF_PTR 4
435 # define SIZEOF_HPTR 2
436 #endif
437 
438 #if SIZEOF_PTR == 8
439 # define NR_BITS_BYTE (8)
440 # define NR_BITS_WORD (32)
441 # define NR_BITS_DWORD (64)
442 
443 # define BITMASK_BYTE (0xFF)
444 # define BITMASK_WORD (0xFFFFFFFF)
445 # define BITMASK_DWORD (0xFFFFFFFFFFFFFFFF)
446 
447 # define INT_PTR_MIN (-9223372036854775807L-1)
448 # define INT_PTR_MAX (9223372036854775807L)
449 # define UINT_PTR_MAX (18446744073709551615UL)
450 #else
451 # define NR_BITS_BYTE (8)
452 # define NR_BITS_WORD (16)
453 # define NR_BITS_DWORD (32)
454 
455 # define BITMASK_BYTE (0xFF)
456 # define BITMASK_WORD (0xFFFF)
457 # define BITMASK_DWORD (0xFFFFFFFF)
458 
459 # define INT_PTR_MIN (-2147483647-1)
460 # define INT_PTR_MAX (2147483647)
461 # define UINT_PTR_MAX (4294967295U)
462 #endif
463 
468 #if defined(_WIN64)
469 typedef unsigned int WORD_HPTR;
470 #elif defined(__LP64__)
471 typedef unsigned int WORD_HPTR;
472 #else
473 typedef unsigned short WORD_HPTR;
474 #endif
475 
480 #if defined(_WIN64)
481 typedef signed int SWORD_HPTR;
482 #elif defined(__LP64__)
483 typedef signed int SWORD_HPTR;
484 #else
485 typedef signed short SWORD_HPTR;
486 #endif
487 
492 typedef WORD_HPTR WORD;
493 
499 
504 typedef unsigned short WORD16;
505 
510 typedef signed short SWORD16;
511 
516 #if defined(_WIN64)
517 typedef __int64 LONG_PTR;
518 #elif defined(__LP64__)
519 typedef long LONG_PTR;
520 #else
521 typedef long LONG_PTR;
522 #endif
523 
528 typedef LONG_PTR LINT;
529 
535 
543 #if defined(_WIN64)
544 typedef unsigned __int64 DWORD_PTR;
545 #elif defined(__LP64__)
546 typedef unsigned long DWORD_PTR;
547 #else
548 typedef unsigned long DWORD_PTR;
549 #endif
550 
555 typedef DWORD_PTR DWORD;
556 
561 typedef unsigned int DWORD32;
562 
570 #if defined(_WIN64)
571 typedef signed __int64 SDWORD_PTR;
572 #elif defined(__LP64__)
573 typedef signed long SDWORD_PTR;
574 #else
575 typedef signed long SDWORD_PTR;
576 #endif
577 
583 
588 typedef signed int SDWORD32;
589 
594 typedef unsigned int UINT;
595 
600 #if defined(_WIN64)
601 typedef __int64 INT_PTR;
602 #elif defined(__LP64__)
603 typedef long INT_PTR;
604 #else
605 typedef int INT_PTR;
606 #endif
607 
612 #if defined(_WIN64)
613 typedef unsigned __int64 UINT_PTR;
614 #elif defined(__LP64__)
615 typedef unsigned long UINT_PTR;
616 #else
617 typedef unsigned long UINT_PTR;
618 #endif
619 
624 typedef long LONG;
625 
630 typedef unsigned long ULONG;
631 
636 typedef UINT_PTR WPARAM;
637 
642 typedef UINT_PTR LPARAM;
643 
650 #define LOBYTE(w) ((BYTE)(w))
651 
658 #define HIBYTE(w) ((BYTE)(((WORD)(w) >> NR_BITS_BYTE) & BITMASK_BYTE))
659 
666 #define MAKEWORD(low, high) ((WORD)(((BYTE)(low)) | (((WORD)((BYTE)(high))) << NR_BITS_BYTE)))
667 
674 #define MAKEWORD16(low, high) ((WORD16)(((BYTE)(low)) | (((WORD16)((BYTE)(high))) << 8)))
675 
682 #define MAKEWPARAM(first, second, third, fourth) \
683  ((WPARAM)( \
684  ((BYTE)(first)) | \
685  (((WPARAM)((BYTE)(second))) << 8) | \
686  (((WPARAM)((BYTE)(third))) << 16) | \
687  (((WPARAM)((BYTE)(fourth))) << 24) \
688  ))
689 
696 #define FIRSTBYTE(w) ((BYTE)(w))
697 
704 #define SECONDBYTE(w) ((BYTE)(((DWORD32)(w)) >> 8))
705 
712 #define THIRDBYTE(w) ((BYTE)(((DWORD32)(w)) >> 16))
713 
720 #define FOURTHBYTE(w) ((BYTE)(((DWORD32)(w)) >> 24))
721 
728 #define LOWORD(l) ((WORD)(DWORD)(l))
729 
735 #define HIWORD(l) ((WORD)((((DWORD)(l)) >> NR_BITS_WORD) & BITMASK_WORD))
736 
743 #define LOSWORD(l) ((SWORD)(DWORD)(l))
744 
750 #define HISWORD(l) ((SWORD)((((DWORD)(l)) >> NR_BITS_WORD) & BITMASK_WORD))
751 
757 #define MAKELONG32(low, high) ((DWORD32)(((WORD16)(low)) | (((DWORD32)((WORD16)(high))) << 16)))
758 
764 #define MAKELONG(low, high) ((DWORD)(((WORD)(low)) | (((DWORD)((WORD)(high))) << NR_BITS_WORD)))
765 
771 
780 #define GetRValue(rgba) ((BYTE)(rgba))
781 
789 #define GetGValue(rgba) ((BYTE)(((DWORD32)(rgba)) >> 8))
790 
798 #define GetBValue(rgba) ((BYTE)((DWORD32)(rgba) >> 16))
799 
807 #define GetAValue(rgba) ((BYTE)((DWORD32)(rgba) >> 24))
808 
819 #define MakeRGBA(r, g, b, a) (((DWORD32)((BYTE)(r))) | ((DWORD32)((BYTE)(g)) << 8) \
820  | ((DWORD32)((BYTE)(b)) << 16) | ((DWORD32)((BYTE)(a)) << 24))
821 
831 #define MakeRGB(r, g, b) (((DWORD32)((BYTE)(r))) | ((DWORD32)((BYTE)(g)) << 8) \
832  | ((DWORD32)((BYTE)(b)) << 16))
833 
843 typedef struct _RECT
844 {
848  int left;
852  int top;
856  int right;
860  int bottom;
861 } RECT;
868 typedef RECT* PRECT;
869 
874 typedef struct _POINT
875 {
879  int x;
883  int y;
884 } POINT;
891 typedef POINT* PPOINT;
892 
897 typedef struct _SIZE
898 {
902  int cx;
906  int cy;
907 } SIZE;
914 typedef SIZE* PSIZE;
915 
920 typedef struct _RGB
921 {
938 } RGB;
939 
946 typedef RGB* PRGB;
947 
960 typedef Sint8 gal_sint8;
967 typedef Uint8 gal_uint8;
968 
983 
998 
1003 typedef signed int gal_sint;
1008 typedef unsigned int gal_uint;
1009 
1020 
1025 typedef long fixed;
1026 
1031 typedef struct _GAL_Color
1032 {
1049 } GAL_Color;
1050 
1055 typedef struct _GAL_Palette
1056 {
1060  int ncolors;
1065 } GAL_Palette;
1066 
1071 typedef struct _GAL_Rect {
1075  Sint32 x, y;
1079  Sint32 w, h;
1080 } GAL_Rect;
1081 
1104 #define MGUI_NR_KEYS 255
1105 
1118 #ifndef NR_KEYS
1119 #define NR_KEYS 128
1120 #endif
1121 
1138 #define SCANCODE_USER (NR_KEYS + 1)
1139 
1140 #define SCANCODE_ESCAPE 1
1141 
1142 #define SCANCODE_1 2
1143 #define SCANCODE_2 3
1144 #define SCANCODE_3 4
1145 #define SCANCODE_4 5
1146 #define SCANCODE_5 6
1147 #define SCANCODE_6 7
1148 #define SCANCODE_7 8
1149 #define SCANCODE_8 9
1150 #define SCANCODE_9 10
1151 #define SCANCODE_0 11
1152 
1153 #define SCANCODE_MINUS 12
1154 #define SCANCODE_EQUAL 13
1155 
1156 #define SCANCODE_BACKSPACE 14
1157 #define SCANCODE_TAB 15
1158 
1159 #define SCANCODE_Q 16
1160 #define SCANCODE_W 17
1161 #define SCANCODE_E 18
1162 #define SCANCODE_R 19
1163 #define SCANCODE_T 20
1164 #define SCANCODE_Y 21
1165 #define SCANCODE_U 22
1166 #define SCANCODE_I 23
1167 #define SCANCODE_O 24
1168 #define SCANCODE_P 25
1169 #define SCANCODE_BRACKET_LEFT 26
1170 #define SCANCODE_BRACKET_RIGHT 27
1171 
1172 #define SCANCODE_ENTER 28
1173 
1174 #define SCANCODE_LEFTCONTROL 29
1175 
1176 #define SCANCODE_A 30
1177 #define SCANCODE_S 31
1178 #define SCANCODE_D 32
1179 #define SCANCODE_F 33
1180 #define SCANCODE_G 34
1181 #define SCANCODE_H 35
1182 #define SCANCODE_J 36
1183 #define SCANCODE_K 37
1184 #define SCANCODE_L 38
1185 #define SCANCODE_SEMICOLON 39
1186 #define SCANCODE_APOSTROPHE 40
1187 #define SCANCODE_GRAVE 41
1188 
1189 #define SCANCODE_LEFTSHIFT 42
1190 #define SCANCODE_BACKSLASH 43
1191 
1192 #define SCANCODE_Z 44
1193 #define SCANCODE_X 45
1194 #define SCANCODE_C 46
1195 #define SCANCODE_V 47
1196 #define SCANCODE_B 48
1197 #define SCANCODE_N 49
1198 #define SCANCODE_M 50
1199 #define SCANCODE_COMMA 51
1200 #define SCANCODE_PERIOD 52
1201 #define SCANCODE_SLASH 53
1202 
1203 #define SCANCODE_RIGHTSHIFT 54
1204 #define SCANCODE_KEYPADMULTIPLY 55
1205 
1206 #define SCANCODE_LEFTALT 56
1207 #define SCANCODE_SPACE 57
1208 #define SCANCODE_CAPSLOCK 58
1209 
1210 #define SCANCODE_F1 59
1211 #define SCANCODE_F2 60
1212 #define SCANCODE_F3 61
1213 #define SCANCODE_F4 62
1214 #define SCANCODE_F5 63
1215 #define SCANCODE_F6 64
1216 #define SCANCODE_F7 65
1217 #define SCANCODE_F8 66
1218 #define SCANCODE_F9 67
1219 #define SCANCODE_F10 68
1220 
1221 #define SCANCODE_NUMLOCK 69
1222 #define SCANCODE_SCROLLLOCK 70
1223 
1224 #define SCANCODE_KEYPAD7 71
1225 #define SCANCODE_CURSORUPLEFT 71
1226 #define SCANCODE_KEYPAD8 72
1227 #define SCANCODE_CURSORUP 72
1228 #define SCANCODE_KEYPAD9 73
1229 #define SCANCODE_CURSORUPRIGHT 73
1230 #define SCANCODE_KEYPADMINUS 74
1231 #define SCANCODE_KEYPAD4 75
1232 #define SCANCODE_CURSORLEFT 75
1233 #define SCANCODE_KEYPAD5 76
1234 #define SCANCODE_KEYPAD6 77
1235 #define SCANCODE_CURSORRIGHT 77
1236 #define SCANCODE_KEYPADPLUS 78
1237 #define SCANCODE_KEYPAD1 79
1238 #define SCANCODE_CURSORDOWNLEFT 79
1239 #define SCANCODE_KEYPAD2 80
1240 #define SCANCODE_CURSORDOWN 80
1241 #define SCANCODE_KEYPAD3 81
1242 #define SCANCODE_CURSORDOWNRIGHT 81
1243 #define SCANCODE_KEYPAD0 82
1244 #define SCANCODE_KEYPADPERIOD 83
1245 
1246 #define SCANCODE_LESS 86
1247 
1248 #define SCANCODE_F11 87
1249 #define SCANCODE_F12 88
1250 
1251 #define SCANCODE_KEYPADENTER 96
1252 #define SCANCODE_RIGHTCONTROL 97
1253 #define SCANCODE_CONTROL 97
1254 #define SCANCODE_KEYPADDIVIDE 98
1255 #define SCANCODE_PRINTSCREEN 99
1256 #define SCANCODE_RIGHTALT 100
1257 #define SCANCODE_BREAK 101 /* Beware: is 119 */
1258 #define SCANCODE_BREAK_ALTERNATIVE 119 /* on some keyboards! */
1259 
1260 #define SCANCODE_HOME 102
1261 #define SCANCODE_CURSORBLOCKUP 103 /* Cursor key block */
1262 #define SCANCODE_PAGEUP 104
1263 #define SCANCODE_CURSORBLOCKLEFT 105 /* Cursor key block */
1264 #define SCANCODE_CURSORBLOCKRIGHT 106 /* Cursor key block */
1265 #define SCANCODE_END 107
1266 #define SCANCODE_CURSORBLOCKDOWN 108 /* Cursor key block */
1267 #define SCANCODE_PAGEDOWN 109
1268 #define SCANCODE_INSERT 110
1269 #define SCANCODE_REMOVE 111
1270 
1271 #define SCANCODE_PAUSE 119
1272 
1273 #define SCANCODE_POWER 120
1274 #define SCANCODE_SLEEP 121
1275 #define SCANCODE_WAKEUP 122
1276 
1277 #define SCANCODE_LEFTWIN 125
1278 #define SCANCODE_RIGHTWIN 126
1279 #define SCANCODE_MENU 127
1280 
1281 #define SCANCODE_LEFTBUTTON 0x1000
1282 #define SCANCODE_RIGHTBUTTON 0x2000
1283 #define SCANCODE_MIDDLBUTTON 0x4000
1284 
1305 #define KS_REPEATED 0x00000800
1306 
1327 #define KS_CAPTURED 0x00000400
1328 
1335 #define KS_IMEPOST 0x00000200
1336 
1357 #define KS_CAPSLOCK 0x00000100
1358 
1366 #define KS_NUMLOCK 0x00000080
1367 
1375 #define KS_SCROLLLOCK 0x00000040
1376 
1384 #define KS_LEFTCTRL 0x00000020
1385 
1393 #define KS_RIGHTCTRL 0x00000010
1394 
1402 #define KS_CTRL 0x00000030
1403 
1411 #define KS_LEFTALT 0x00000008
1412 
1420 #define KS_RIGHTALT 0x00000004
1421 
1429 #define KS_ALT 0x0000000C
1430 
1438 #define KS_LEFTSHIFT 0x00000002
1439 
1447 #define KS_RIGHTSHIFT 0x00000001
1448 
1456 #define KS_SHIFT 0x00000003
1457 
1462 #define MASK_KS_SHIFTKEYS 0x00000FFF
1463 
1471 #define KS_LEFTBUTTON 0x00001000
1472 
1480 #define KS_RIGHTBUTTON 0x00002000
1481 
1489 #define KS_MIDDLBUTTON 0x00004000
1490 
1495 #define MASK_KS_BUTTONS 0x0000F000
1496 
1507 #define ERR_OK 0
1508 
1513 #define ERR_INV_HWND -1
1514 
1519 #define ERR_QUEUE_FULL -2
1520 
1525 #define ERR_INVALID_HANDLE -3
1526 
1531 #define ERR_INVALID_HMENU -4
1532 
1537 #define ERR_INVALID_POS -5
1538 
1543 #define ERR_INVALID_ID -6
1544 
1549 #define ERR_RES_ALLOCATION -7
1550 
1555 #define ERR_CTRLCLASS_INVNAME -8
1556 
1561 #define ERR_CTRLCLASS_INVLEN -9
1562 
1567 #define ERR_CTRLCLASS_MEM -10
1568 
1573 #define ERR_CTRLCLASS_INUSE -11
1574 
1579 #define ERR_ALREADY_EXIST -12
1580 
1585 #define ERR_NO_MATCH -13
1586 
1591 #define ERR_BAD_OWNER -14
1592 
1597 #define ERR_IME_TOOMUCHIMEWND -15
1598 
1603 #define ERR_IME_NOSUCHIMEWND -16
1604 
1609 #define ERR_IME_NOIMEWND -17
1610 
1615 #define ERR_CONFIG_FILE -18
1616 
1621 #define ERR_FILE_IO -19
1622 
1627 #define ERR_GFX_ENGINE -20
1628 
1633 #define ERR_INPUT_ENGINE -21
1634 
1639 #define ERR_NO_ENGINE -22
1640 
1645 #define ERR_INVALID_ARGS -23
1646 
1657 #define TABLESIZE(table) (sizeof(table)/sizeof(table[0]))
1658 
1659 /* MAX/MIN/ABS macors */
1664 #ifndef MAX
1665 #define MAX(x, y) (((x) > (y))?(x):(y))
1666 #endif
1667 
1671 #ifndef MIN
1672 #define MIN(x, y) (((x) < (y))?(x):(y))
1673 #endif
1674 
1678 #ifndef ABS
1679 #define ABS(x) (((x)<0) ? -(x) : (x))
1680 #endif
1681 
1682 /* Commonly used definitions */
1683 #if !defined(__NOUNIX__) || defined (__ECOS__)
1684 #include <limits.h>
1685 #endif
1686 
1687 #ifndef PATH_MAX
1688 # define PATH_MAX 256
1689 #endif
1690 
1691 #ifndef NAME_MAX
1692 # define NAME_MAX 64
1693 #endif
1694 
1695 
1701 #ifndef MAX_PATH
1702 # define MAX_PATH PATH_MAX
1703 #endif
1704 
1710 #ifndef MAX_NAME
1711 # define MAX_NAME NAME_MAX
1712 #endif
1713 
1718 #ifdef __cplusplus
1719 extern "C" {
1720 #endif
1721 
1722 #ifndef HAVE_TIME
1723 typedef unsigned int time_t;
1724 
1725 struct tm {
1726  int tm_sec; /* seconds [0,61] */
1727  int tm_min; /* minutes [0,59] */
1728  int tm_hour; /* hour [0,23] */
1729  int tm_mday; /* day of month [1,31] */
1730  int tm_mon; /* month of year [0,11] */
1731  int tm_year; /* years since 1900 */
1732  int tm_wday; /* day of week [0,6] (Sunday = 0) */
1733  int tm_yday; /* day of year [0,365] */
1734  int tm_isdst; /* daylight savings flag */
1735 };
1736 #endif
1737 
1738 #if defined (__THREADX__) && defined (__TARGET_VFANVIL__)
1739 #include "fx_api.h"
1740 #include "tx_api.h"
1741 #include "os_type.h"
1742 #include "os_file_api.h"
1743 
1744 #define fopen tp_fopen
1745 #define fclose tp_fclose
1746 #define fwrite tp_fwrite
1747 #define fread tp_fread
1748 #define fseek tp_fseek
1749 #define feof tp_feof
1750 
1751 #undef assert
1752 #define _HAVE_ASSERT 1
1753 
1754 #define assert(e) do { \
1755  e; \
1756  } while (0)
1757 
1758 #undef stdin
1759 #undef stdout
1760 #undef stderr
1761 
1762 #define stdin ((FILE*)0)
1763 #define stdout ((FILE*)1)
1764 #define stderr ((FILE*)2)
1765 void Comm_Lock_Screen (void);
1766 void Comm_Unlock_Screen (void);
1767 
1768 #endif
1769 
1770 #ifdef __UCOSII__
1771 
1772 /* use our own implementation of strdup */
1773 #undef HAVE_STRDUP
1774 #undef strdup
1775 #define strdup own_strdup
1776 
1777 #endif /* __UCOSII__ */
1778 
1779 #ifndef HAVE_STRDUP
1780 MG_EXPORT char *strdup(const char *s);
1781 #endif
1782 
1783 #ifndef HAVE_STRCASECMP
1784 MG_EXPORT int strcasecmp(const char *s1, const char *s2);
1785 #endif
1786 
1787 #ifndef HAVE_STRNCASECMP
1788 MG_EXPORT int strncasecmp(const char *s1, const char *s2, unsigned int n);
1789 #endif
1790 
1791 #ifdef _MGUSE_OWN_MALLOC
1792 
1812 int init_minigui_malloc (unsigned char* heap, unsigned int heap_size,
1813  int (*lock_heap) (void), int (*unlock_heap) (void));
1814 
1815 #define USE_DL_PREFIX
1816 
1817 #include "own_malloc.h"
1818 
1819 /* wrappers for malloc functions */
1820 #define calloc dlcalloc
1821 #define free dlfree
1822 #define malloc dlmalloc
1823 #define memalign dlmemalign
1824 #define realloc dlrealloc
1825 #define valloc dlvalloc
1826 
1827 #endif
1828 
1829 /* Do not use the alloca of ARMCC */
1830 #if defined(__CC_ARM)
1831 # undef HAVE_ALLOCA
1832 # undef HAVE_ALLOCA_H
1833 #endif
1834 
1835 #ifdef HAVE_ALLOCA_H
1836 # include <alloca.h>
1837 # define ALLOCATE_LOCAL(size) alloca((int)(size))
1838 # define DEALLOCATE_LOCAL(ptr) /* as nothing */
1839 #else
1840 # define ALLOCATE_LOCAL(size) malloc((int)(size))
1841 # define DEALLOCATE_LOCAL(ptr) free(ptr)
1842 #endif
1843 
1844 #ifdef _MGUSE_OWN_STDIO
1845 
1858 int init_minigui_printf (int (*output_char) (int ch),
1859  int (*input_char) (void));
1860 
1861 #if defined (__UCOSII__) || defined (__VXWORKS__) || defined (__NUCLEUS__) || defined (__PSOS__)
1862 # undef _PRINTF_FLOATING_POINT
1863 # undef _SCANF_FLOATING_POINT
1864 #else
1865 # ifdef HAVE_MATH_H
1866 # define _PRINTF_FLOATING_POINT 1
1867 # define _SCANF_FLOATING_POINT 1
1868 # endif
1869 #endif
1870 
1871 #ifdef WIN32
1872 # include <float.h>
1873 # define isnan _isnan
1874 # define finite _finite
1875 #endif
1876 
1877 #undef _I18N_MB_REQUIRED
1878 
1879 #if defined(__VXWORKS__) || defined(WIN32) || defined (__NUCLEUS_MNT__) || defined (__PSOS__)
1880  #define _MGUSE_OWN_SNPRINTF
1881  #define _MGUSE_OWN_VSNPRINTF
1882  #define _MGUSE_OWN_VFNPRINTF
1883 #else
1884  #define _MGUSE_OWN_PRINTF
1885  #define _MGUSE_OWN_FPRINTF
1886  #define _MGUSE_OWN_SPRINTF
1887  #define _MGUSE_OWN_FNPRINTF
1888  #define _MGUSE_OWN_SNPRINTF
1889  #define _MGUSE_OWN_VPRINTF
1890  #define _MGUSE_OWN_VFPRINTF
1891  #define _MGUSE_OWN_VSPRINTF
1892  #define _MGUSE_OWN_VFNPRINTF
1893  #define _MGUSE_OWN_VSNPRINTF
1894  #define _MGUSE_OWN_SCANF
1895  #define _MGUSE_OWN_FSCANF
1896  #define _MGUSE_OWN_SSCANF
1897  #define _MGUSE_OWN_VSCANF
1898  #define _MGUSE_OWN_VFSCANF
1899  #define _MGUSE_OWN_VSSCANF
1900 #endif
1901 
1902 #include "own_stdio.h"
1903 
1904 /* wrappers for stdio functions */
1905 #ifdef _MGUSE_OWN_PRINTF
1906  #define printf own_printf
1907 #endif
1908 
1909 #ifdef _MGUSE_OWN_FPRINTF
1910  #define fprintf own_fprintf
1911 #endif
1912 
1913 #ifdef _MGUSE_OWN_SPRINTF
1914  #define sprintf own_sprintf
1915 #endif
1916 
1917 #ifdef _MGUSE_OWN_FNPRINTF
1918  #define fnprintf own_fnprintf
1919 #endif
1920 
1921 #ifdef _MGUSE_OWN_SNPRINTF
1922  #define snprintf own_snprintf
1923 #endif
1924 
1925 #ifdef _MGUSE_OWN_VPRINTF
1926  #define vprintf own_vprintf
1927 #endif
1928 
1929 #ifdef _MGUSE_OWN_VFPRINTF
1930  #define vfprintf own_vfprintf
1931 #endif
1932 
1933 #ifdef _MGUSE_OWN_VSPRINTF
1934  #define vsprintf own_vsprintf
1935 #endif
1936 
1937 #ifdef _MGUSE_OWN_VFNPRINTF
1938  #define vfnprintf own_vfnprintf
1939 #endif
1940 
1941 #ifdef _MGUSE_OWN_VSNPRINTF
1942  #define vsnprintf own_vsnprintf
1943 #endif
1944 
1945 #ifdef _MGUSE_OWN_SCANF
1946  #define scanf own_scanf
1947 #endif
1948 
1949 #ifdef _MGUSE_OWN_FSCANF
1950  #define fscanf own_fscanf
1951 #endif
1952 
1953 #ifdef _MGUSE_OWN_SSCANF
1954  #define sscanf own_sscanf
1955 #endif
1956 
1957 #ifdef _MGUSE_OWN_VSCANF
1958  #define vscanf own_vscanf
1959 #endif
1960 
1961 #ifdef _MGUSE_OWN_VFSCANF
1962  #define vfscanf own_vfscanf
1963 #endif
1964 
1965 #ifdef _MGUSE_OWN_VSSCANF
1966  #define vsscanf own_vsscanf
1967 #endif
1968 
1969 #endif /* _MGUSE_OWN_STDIO */
1970 
1971 #ifdef __LINUX__
1972  #define TCS_NONE(fp) fprintf (fp, "\e[0m")
1973  #define TCS_BLACK(fp) fprintf (fp, "\e[0;30m")
1974  #define TCS_BOLD_BLACK(fp) fprintf (fp, "\e[1;30m")
1975  #define TCS_RED(fp) fprintf (fp, "\e[0;31m")
1976  #define TCS_BOLD_RED(fp) fprintf (fp, "\e[1;31m")
1977  #define TCS_GREEN(fp) fprintf (fp, "\e[0;32m")
1978  #define TCS_BOLD_GREEN(fp) fprintf (fp, "\e[1;32m")
1979  #define TCS_BROWN(fp) fprintf (fp, "\e[0;33m")
1980  #define TCS_YELLOW(fp) fprintf (fp, "\e[1;33m")
1981  #define TCS_BLUE(fp) fprintf (fp, "\e[0;34m")
1982  #define TCS_BOLD_BLUE(fp) fprintf (fp, "\e[1;34m")
1983  #define TCS_PURPLE(fp) fprintf (fp, "\e[0;35m")
1984  #define TCS_BOLD_PURPLE(fp) fprintf (fp, "\e[1;35m")
1985  #define TCS_CYAN(fp) fprintf (fp, "\e[0;36m")
1986  #define TCS_BOLD_CYAN(fp) fprintf (fp, "\e[1;36m")
1987  #define TCS_GRAY(fp) fprintf (fp, "\e[0;37m")
1988  #define TCS_WHITE(fp) fprintf (fp, "\e[1;37m")
1989  #define TCS_BOLD(fp) fprintf (fp, "\e[1m")
1990  #define TCS_UNDERLINE(fp) fprintf (fp, "\e[4m")
1991  #define TCS_BLINK(fp) fprintf (fp, "\e[5m")
1992  #define TCS_REVERSE(fp) fprintf (fp, "\e[7m")
1993  #define TCS_HIDE(fp) fprintf (fp, "\e[8m")
1994  #define TCS_CLEAR(fp) fprintf (fp, "\e[2J")
1995  #define TCS_CLRLINE(fp) fprintf (fp, "\e[1K\r")
1996 #else
1997  #define TCS_NONE(fp)
1998  #define TCS_BLACK(fp)
1999  #define TCS_BOLD_BLACK(fp)
2000  #define TCS_RED(fp)
2001  #define TCS_BOLD_RED(fp)
2002  #define TCS_GREEN(fp)
2003  #define TCS_BOLD_GREEN(fp)
2004  #define TCS_BROWN(fp)
2005  #define TCS_YELLOW(fp)
2006  #define TCS_BLUE(fp)
2007  #define TCS_BOLD_BLUE(fp)
2008  #define TCS_PURPLE(fp)
2009  #define TCS_BOLD_PURPLE(fp)
2010  #define TCS_CYAN(fp)
2011  #define TCS_BOLD_CYAN(fp)
2012  #define TCS_GRAY(fp)
2013  #define TCS_WHITE(fp)
2014  #define TCS_BOLD(fp)
2015  #define TCS_UNDERLINE(fp)
2016  #define TCS_BLINK(fp)
2017  #define TCS_REVERSE(fp)
2018  #define TCS_HIDE(fp)
2019  #define TCS_CLEAR(fp)
2020  #define TCS_CLRLINE(fp)
2021 #endif
2022 
2023 #if defined(__GNUC__)
2024 # define _ERR_PRINTF(fmt...) \
2025  do { \
2026  TCS_BOLD_RED (stderr); \
2027  fprintf (stderr, fmt); \
2028  TCS_NONE (stderr); \
2029  } while (0)
2030 # ifdef _DEBUG
2031 # define _MG_PRINTF(fmt...) \
2032  do { \
2033  TCS_GREEN (stderr); \
2034  fprintf (stderr, fmt); \
2035  TCS_NONE (stderr); \
2036  } while (0)
2037 
2038 # ifdef DEBUG
2039 # define _DBG_PRINTF(fmt...) \
2040  do { \
2041  TCS_YELLOW (stderr); \
2042  fprintf (stderr, fmt); \
2043  TCS_NONE (stderr); \
2044  } while (0)
2045 # else
2046 # define _DBG_PRINTF(fmt...)
2047 # endif
2048 # else
2049 # define _MG_PRINTF(fmt...)
2050 # define _DBG_PRINTF(fmt...)
2051 # endif
2052 #else /* __GNUC__ */
2053 
2054 static inline void _ERR_PRINTF(const char* fmt, ...)
2055 {
2056  va_list ap;
2057  va_start (ap, fmt);
2058  TCS_BOLD_RED (stderr);
2059  vfprintf (stderr, fmt, ap);
2060  TCS_NONE (stderr);
2061  va_end (ap);
2062 }
2063 static inline void _MG_PRINTF(const char* fmt, ...)
2064 {
2065 #ifdef DEBUG
2066  va_list ap;
2067  va_start (ap, fmt);
2068  TCS_GREEN (stderr);
2069  vfprintf (stderr, fmt, ap);
2070  TCS_NONE (stderr);
2071  va_end (ap);
2072 #endif
2073 }
2074 
2075 static inline void _DBG_PRINTF(const char* fmt, ...)
2076 {
2077 #if defined(DEBUG) && defined(_DEBUG)
2078  va_list ap;
2079  va_start (ap, fmt);
2080  TCS_YELLOW (stderr);
2081  vfprintf (stderr, fmt, ap);
2082  TCS_NONE (stderr);
2083  va_end (ap);
2084 #endif
2085 }
2086 #endif /* !__GNUC__ */
2087 
2088 #ifdef _MGRM_THREADS
2089 
2090 #ifdef _MGUSE_OWN_PTHREAD
2091 
2092 #define MAIN_PTH_MIN_STACK_SIZE (1024)
2093 #define MAIN_PTH_DEF_STACK_SIZE (1024*4)
2094 
2118 int start_minigui_pthread (int (* pth_entry) (int argc, const char* argv []),
2119  int argc, const char* argv[],
2120  char* stack_base, unsigned int stack_size);
2121 
2122 #ifndef ESRCH
2123 # define ESRCH 3
2124 #endif
2125 
2126 #ifndef EAGAIN
2127 # define EAGAIN 11
2128 #endif
2129 
2130 #ifndef ENOMEM
2131 # define ENOMEM 12
2132 #endif
2133 
2134 #ifndef EBUSY
2135 # define EBUSY 16
2136 #endif
2137 
2138 #ifndef EINVAL
2139 # define EINVAL 22
2140 #endif
2141 
2142 #ifndef EDEADLK
2143 # define EDEADLK 35
2144 #endif
2145 
2146 #ifndef ENOSYS
2147 # define ENOSYS 38
2148 #endif
2149 
2150 #ifndef ENOTSUP
2151 # define ENOTSUP 95
2152 #endif
2153 
2154 #ifdef __VXWORKS__
2155 
2156 #define pthread_create vxworks_pthread_create
2157 #define pthread_self vxworks_pthread_self
2158 #define pthread_equal vxworks_pthread_equal
2159 #define pthread_exit vxworks_pthread_exit
2160 #define pthread_join vxworks_pthread_join
2161 #define pthread_detach vxworks_pthread_detach
2162 #define pthread_cancel vxworks_pthread_cancel
2163 #define pthread_once vxworks_pthread_once
2164 #define pthread_key_create vxworks_pthread_key_create
2165 #define pthread_key_delete vxworks_pthread_key_delete
2166 #define pthread_setspecific vxworks_pthread_setspecific
2167 #define pthread_getspecific vxworks_pthread_getspecific
2168 #define pthread_setcancelstate vxworks_pthread_setcancelstate
2169 #define pthread_setcanceltype vxworks_pthread_setcanceltype
2170 #define pthread_testcancel vxworks_pthread_testcancel
2171 
2172 #define pthread_attr_init vxworks_pthread_attr_init
2173 #define pthread_attr_destroy vxworks_pthread_attr_destroy
2174 #define pthread_attr_setdetachstate vxworks_pthread_attr_setdetachstate
2175 #define pthread_attr_getdetachstate vxworks_pthread_attr_getdetachstate
2176 #define pthread_attr_setscope vxworks_pthread_attr_setscope
2177 #define pthread_attr_getscope vxworks_pthread_attr_getscope
2178 #define pthread_attr_setinheritsched vxworks_pthread_attr_setinheritsched
2179 #define pthread_attr_getinheritsched vxworks_pthread_attr_getinheritsched
2180 #define pthread_attr_setschedpolicy vxworks_pthread_attr_setschedpolicy
2181 #define pthread_attr_getschedpolicy vxworks_pthread_attr_getschedpolicy
2182 #define pthread_attr_setschedparam vxworks_pthread_attr_setschedparam
2183 #define pthread_attr_getschedparam vxworks_pthread_attr_getschedparam
2184 #define pthread_attr_setstackaddr vxworks_pthread_attr_setstackaddr
2185 #define pthread_attr_getstackaddr vxworks_pthread_attr_getstackaddr
2186 #define pthread_attr_setstacksize vxworks_pthread_attr_setstacksize
2187 #define pthread_attr_getstacksize vxworks_pthread_attr_getstacksize
2188 #define pthread_setschedparam vxworks_pthread_setschedparam
2189 #define pthread_getschedparam vxworks_pthread_getschedparam
2190 
2191 #define pthread_mutex_init vxworks_pthread_mutex_init
2192 #define pthread_mutex_destroy vxworks_pthread_mutex_destroy
2193 #define pthread_mutex_lock vxworks_pthread_mutex_lock
2194 #define pthread_mutex_unlock vxworks_pthread_mutex_unlock
2195 #define pthread_mutex_trylock vxworks_pthread_mutex_trylock
2196 #define pthread_mutexattr_init vxworks_pthread_mutexattr_init
2197 #define pthread_mutexattr_destroy vxworks_pthread_mutexattr_destroy
2198 #define pthread_mutexattr_setpriorityinherit vxworks_pthread_mutexattr_setpriorityinherit
2199 #define pthread_mutexattr_getpriorityinherit vxworks_pthread_mutexattr_getpriorityinherit
2200 
2201 #ifdef _MGUSE_OWN_SEMAPHORE
2202 
2203 #define sem_t vxworks_sem_t
2204 
2205 #define sem_init vxworks_sem_init
2206 #define sem_destroy vxworks_sem_destroy
2207 #define sem_wait vxworks_sem_wait
2208 #define sem_trywait vxworks_sem_trywait
2209 #define sem_post vxworks_sem_post
2210 #define sem_getvalue vxworks_sem_getvalue
2211 
2212 #endif /* _MGUSE_OWN_SEMAPHORE */
2213 
2214 #endif /* __VXWORKS__ */
2215 
2216 #ifdef __MINIGUI_LIB__
2217 
2218 #ifdef __UCOSII__
2219 # include "ucos2_pthread.h"
2220 # include "ucos2_semaphore.h"
2221 #elif defined (__THREADX__)
2222 # include "threadx_pthread.h"
2223 # include "threadx_semaphore.h"
2224 #elif defined (__NUCLEUS__)
2225 # include "nucleus_pthread.h"
2226 # include "nucleus_semaphore.h"
2227 #elif defined (__VXWORKS__)
2228 # include "vxworks_pthread.h"
2229 # ifdef _MGUSE_OWN_SEMAPHORE
2230 # include "vxworks_semaphore.h"
2231 # else
2232 # include "semaphore.h"
2233 # endif
2234 #elif defined (__OSE__)
2235 # include "pthread.h"
2236 # include "ose_semaphore.h"
2237 #elif defined (__PSOS__)
2238 # include "psos_pthread.h"
2239 # include "psos_semaphore.h"
2240 #elif defined (WIN32)
2241 # include "win32_pthread.h"
2242 # include "win32_semaphore.h"
2243 #else
2244 # error No own pthread implementation for this OS!
2245 #endif
2246 
2247 #else
2248 
2249 # include <pthread.h>
2250 # include <semaphore.h>
2251 
2252 #endif /* __MINIGUI_LIB__ */
2253 
2254 #else /* _MGUSE_OWN_PTHREAD */
2255 
2256 #include <pthread.h>
2257 #include <semaphore.h>
2258 
2259 #endif /* !_MGUSE_OWN_PTHREAD */
2260 
2261 #ifdef __DARWIN__
2262 
2263 #define _USE_SEM_ON_SYSVIPC 1
2264 
2265 #endif
2266 
2267 #if defined (_USE_MUTEX_ON_SYSVIPC) || defined (_USE_SEM_ON_SYSVIPC)
2268 
2269 int _sysvipc_mutex_sem_init (void);
2270 int _sysvipc_mutex_sem_term (void);
2271 
2272 #endif
2273 
2274 #ifdef _USE_MUTEX_ON_SYSVIPC
2275 
2276 #define pthread_mutex_t _sysvipc_pthread_mutex_t
2277 #define pthread_mutexattr_t _sysvipc_pthread_mutexattr_t
2278 
2279 #define pthread_mutexattr_init _sysvipc_pthread_mutexattr_init
2280 #define pthread_mutexattr_destroy _sysvipc_pthread_mutexattr_destroy
2281 #define pthread_mutexattr_settype _sysvipc_pthread_mutexattr_settype
2282 #define pthread_mutexattr_gettype _sysvipc_pthread_mutexattr_gettype
2283 
2284 #define pthread_init _sysvipc_pthread_init
2285 #define pthread_mutex_init _sysvipc_pthread_mutex_init
2286 #define pthread_mutex_destroy _sysvipc_pthread_mutex_destroy
2287 #define pthread_mutex_lock _sysvipc_pthread_mutex_lock
2288 #define pthread_mutex_trylock _sysvipc_pthread_mutex_trylock
2289 #define pthread_mutex_unlock _sysvipc_pthread_mutex_unlock
2290 
2291 typedef struct
2292 {
2293  int kind;
2294  int semid;
2295  int sem_num;
2296  int locked_times;
2297 } pthread_mutex_t;
2298 
2299 #define SYSVIPC_PTHREAD_MUTEX_FAST_NP 0
2300 #define SYSVIPC_PTHREAD_MUTEX_RECURSIVE_NP 1
2301 #define SYSVIPC_PTHREAD_MUTEX_ERRORCHECK_NP 2
2302 
2303 typedef struct
2304 {
2305  int kind;
2306 } pthread_mutexattr_t;
2307 
2308 int pthread_mutexattr_init (pthread_mutexattr_t *attr);
2309 int pthread_mutexattr_destroy (pthread_mutexattr_t *attr);
2310 int pthread_mutexattr_settype (pthread_mutexattr_t *attr, int type);
2311 int pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int* type);
2312 
2313 int pthread_mutex_init (pthread_mutex_t *mutex,
2314  const pthread_mutexattr_t *mutex_attr);
2315 
2316 int pthread_mutex_destroy (pthread_mutex_t *mutex);
2317 
2318 int pthread_mutex_lock (pthread_mutex_t *mutex);
2319 int pthread_mutex_trylock (pthread_mutex_t *mutex);
2320 int pthread_mutex_unlock (pthread_mutex_t *mutex);
2321 
2322 #endif /* _USE_MUTEX_ON_SYSVIPC */
2323 
2324 #ifdef _USE_SEM_ON_SYSVIPC
2325 
2326 #define sem_t _sysvipc_sem_t
2327 
2328 #define sem_init _sysvipc_sem_init
2329 #define sem_destroy _sysvipc_sem_destroy
2330 #define sem_wait _sysvipc_sem_wait
2331 #define sem_trywait _sysvipc_sem_trywait
2332 #define sem_post _sysvipc_sem_post
2333 #define sem_getvalue _sysvipc_sem_getvalue
2334 
2335 #define SYSVIPC_SEM_VALUE_MAX USHRT_MAX
2336 
2337 /*-----------------------------------------------------------------------------
2338 ** Semaphore object definition
2339 */
2340 
2341 typedef struct
2342 {
2343  int semid;
2344  int sem_num;
2345 } sem_t;
2346 
2347 int sem_init (sem_t *sem, int pshared, unsigned int value);
2348 int sem_destroy (sem_t *sem);
2349 int sem_wait (sem_t *sem);
2350 int sem_trywait (sem_t *sem);
2351 int sem_post (sem_t *sem);
2352 int sem_getvalue (sem_t *sem, int *sval);
2353 
2354 #endif /* _USE_SEM_ON_SYSVIPC */
2355 
2356 #endif /* _MGRM_THREADS */
2357 
2358 #ifdef __cplusplus
2359 } /* end of extern "C" */
2360 #endif
2361 
2362 #endif /* _MGUI_COMMON_H */
2363 
struct _GAL_Rect GAL_Rect
GHANDLE HACCEL
Handle to accelarator.
Definition: common.h:388
struct _RECT RECT
Definition: common.h:874
int BOOL
A type definition for boolean value.
Definition: common.h:294
GAL_Color * colors
Definition: common.h:1064
long LONG
A type definition for long integer.
Definition: common.h:624
unsigned char BYTE
A type definition for an 8-bit unsigned character (byte).
Definition: common.h:411
SIZE * PSIZE
Data type of the pointer to a SIZE.
Definition: common.h:914
signed short SWORD16
A type definition for a 16-bit signed integer.
Definition: common.h:510
POINT * PPOINT
Data type of the pointer to a POINT.
Definition: common.h:891
BYTE g
Definition: common.h:929
Uint32 gal_uint32
Data type of 32-bit unsigned integer.
Definition: common.h:997
int cy
Definition: common.h:906
unsigned long DWORD_PTR
An unsigned long type for pointer precision.
Definition: common.h:548
Uint32 gal_attr
Data type of attribute value.
Definition: common.h:1019
Definition: common.h:843
Uint32 gal_pixel
Data type of pixel value.
Definition: common.h:1014
unsigned long long Uint64
A type definition for a 64-bit unsigned integer.
Definition: common.h:191
signed short Sint16
A type definition for a 16-bit signed integer.
Definition: common.h:157
int x
Definition: common.h:879
unsigned short Uint16
A type definition for a 16-bit unsigned integer.
Definition: common.h:152
DWORD32 RGBCOLOR
A type definition for a RGB color.
Definition: common.h:770
struct _GAL_Palette GAL_Palette
signed char Sint8
A type definition for an 8-bit signed character.
Definition: common.h:147
Sint32 x
Definition: common.h:1075
GHANDLE HDC
Handle to device context.
Definition: common.h:363
long LONG_PTR
A signed long type for pointer precision.
Definition: common.h:521
int ncolors
Definition: common.h:1060
int bottom
Definition: common.h:860
GHANDLE HHOOK
Handle to keyboard or mouse event hook.
Definition: common.h:398
unsigned int gal_uint
Data type of unsigned integer.
Definition: common.h:1008
unsigned short WORD16
A type definition for a 16-bit unsigned integer (word).
Definition: common.h:504
signed long long Sint64
A type definition for a 64-bit signed integer.
Definition: common.h:198
Uint8 gal_uint8
Data type of 8-bit unsigned integer.
Definition: common.h:967
signed int Sint32
A type definition for a 32-bit signed integer.
Definition: common.h:167
GHANDLE HWND
Handle to main window or control.
Definition: common.h:358
GHANDLE HDLG
Handle to dialog box, same as HWND.
Definition: common.h:393
gal_uint8 a
Definition: common.h:1048
unsigned short WORD_HPTR
An unsigned int (word) type in half pointer precision.
Definition: common.h:473
int INT_PTR
A signed integer type for pointer precision.
Definition: common.h:605
Definition: common.h:897
RGB * PRGB
Data type of the pointer to a RGB.
Definition: common.h:946
LONG_PTR LINT
Signed integer which has pointer precision.
Definition: common.h:528
struct _SIZE SIZE
GHANDLE HCURSOR
Handle to cursor.
Definition: common.h:373
PVOID GHANDLE
General handle.
Definition: common.h:353
RECT * PRECT
Data type of the pointer to a RECT.
Definition: common.h:868
int y
Definition: common.h:883
unsigned char Uint8
A type definition for an 8-bit unsigned character.
Definition: common.h:142
UINT_PTR LPARAM
A type definition for the second message paramter.
Definition: common.h:642
int right
Definition: common.h:856
GHANDLE HPALETTE
Handle to a logical palette.
Definition: common.h:368
Sint16 gal_sint16
Data type of 16-bit signed integer.
Definition: common.h:975
Definition: common.h:920
struct _RGB RGB
Sint8 gal_sint8
Data type of 8-bit signed integer.
Definition: common.h:960
signed short SWORD_HPTR
An signed int type in half pointer precision.
Definition: common.h:485
unsigned long ULONG
A type definition for unsigned long integer.
Definition: common.h:630
struct _GAL_Color GAL_Color
long fixed
Data type of fixed point.
Definition: common.h:1025
WORD_HPTR WORD
A type definition for an unsigned integer (word).
Definition: common.h:492
unsigned int Uint32
A type definition for a 32-bit unsigned integer.
Definition: common.h:162
UINT_PTR WPARAM
A type definition for the first message paramter.
Definition: common.h:636
gal_uint8 r
Definition: common.h:1036
DWORD_PTR DWORD
A unsigned long type definition for pointer precision.
Definition: common.h:555
gal_uint8 g
Definition: common.h:1040
SWORD_HPTR SWORD
A type definition for a signed integer.
Definition: common.h:498
LONG_PTR LRESULT
Signed result of message processing.
Definition: common.h:534
int left
Definition: common.h:848
void * PVOID
A type definition for a pointer to any type.
Definition: common.h:287
signed long SDWORD_PTR
A signed long type for pointer precision.
Definition: common.h:575
unsigned long UINT_PTR
A unsigned integer type for pointer precision.
Definition: common.h:617
signed int gal_sint
Data type of signed integer.
Definition: common.h:1003
SDWORD_PTR SDWORD
A signed long type definition for pointer precision.
Definition: common.h:582
Sint32 w
Definition: common.h:1079
unsigned int UINT
A type definition for unsigned integer.
Definition: common.h:594
unsigned int DWORD32
A type definition for a 32-bit unsigned integer.
Definition: common.h:561
Sint32 gal_sint32
Data type of 32-bit signed integer.
Definition: common.h:990
int cx
Definition: common.h:902
int top
Definition: common.h:852
BYTE b
Definition: common.h:933
GHANDLE HMENU
Handle to menu.
Definition: common.h:383
struct _POINT POINT
Uint16 gal_uint16
Data type of 16-bit unsigned integer.
Definition: common.h:982
gal_uint8 b
Definition: common.h:1044
signed char SBYTE
A type definition for an 8-bit signed character.
Definition: common.h:417
BYTE r
Definition: common.h:925
BYTE a
Definition: common.h:937
GHANDLE HICON
Handle to icon.
Definition: common.h:378
signed int SDWORD32
A type definition for a 32-bit signed integer.
Definition: common.h:588