59 #ifndef _MGUI_COMMON_H 61 #define _MGUI_COMMON_H 63 #ifndef MINIGUI_MAJOR_VERSION 66 # undef PACKAGE_BUGREPORT 68 # undef PACKAGE_STRING 69 # undef PACKAGE_TARNAME 70 # undef PACKAGE_VERSION 71 # ifdef __MINIGUI_LIB__ 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" 81 # if defined(__CMAKE_PROJECT__) || defined(WIN32) 82 # include "mgconfig.h" 84 # include "../mgconfig.h" 88 # include "mgconfig.h" 120 #define _VERSION_CODE(major, minor, micro) (((major)<<16) | ((minor)<<8) | (micro)) 128 #define _MINIGUI_VERSION_CODE \ 129 ((MINIGUI_MAJOR_VERSION << 16) | (MINIGUI_MINOR_VERSION << 8) | MINIGUI_MICRO_VERSION) 170 #if !defined(__STRICT_ANSI__) 171 # if defined(__GNUC__) 172 # define MGUI_HAS_64BIT_TYPE long long 174 # if defined(__CC_ARM) 175 # define MGUI_HAS_64BIT_TYPE long long 177 # if defined(_MSC_VER) 178 # define MGUI_HAS_64BIT_TYPE __int64 183 #ifdef MGUI_HAS_64BIT_TYPE 191 typedef unsigned MGUI_HAS_64BIT_TYPE
Uint64;
198 typedef signed MGUI_HAS_64BIT_TYPE
Sint64;
208 #define MGUI_COMPILE_TIME_ASSERT(name, x) \ 209 typedef int MGUI_dummy_ ## name[(x) * 2 - 1] 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);
220 #undef MGUI_COMPILE_TIME_ASSERT 233 #define MGUI_LIL_ENDIAN 1234 238 #define MGUI_BIG_ENDIAN 4321 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__) || \ 270 # define MGUI_BYTEORDER MGUI_LIL_ENDIAN 272 # define MGUI_BYTEORDER MGUI_BIG_ENDIAN 320 # define NULL ((void *)0) 328 #define INV_PTR ((void *)-1) 332 #if !defined(__NODLL__) && (defined (WIN32) || defined (__NUCLEUS_MNT__)) 333 # if defined(__MINIGUI_LIB__) 334 # define MG_EXPORT __declspec(dllexport) 336 # define MG_EXPORT __declspec(dllimport) 428 # define SIZEOF_PTR 8 429 # define SIZEOF_HPTR 4 430 #elif defined(__LP64__) 431 # define SIZEOF_PTR 8 432 # define SIZEOF_HPTR 4 434 # define SIZEOF_PTR 4 435 # define SIZEOF_HPTR 2 439 # define NR_BITS_BYTE (8) 440 # define NR_BITS_WORD (32) 441 # define NR_BITS_DWORD (64) 443 # define BITMASK_BYTE (0xFF) 444 # define BITMASK_WORD (0xFFFFFFFF) 445 # define BITMASK_DWORD (0xFFFFFFFFFFFFFFFF) 447 # define INT_PTR_MIN (-9223372036854775807L-1) 448 # define INT_PTR_MAX (9223372036854775807L) 449 # define UINT_PTR_MAX (18446744073709551615UL) 451 # define NR_BITS_BYTE (8) 452 # define NR_BITS_WORD (16) 453 # define NR_BITS_DWORD (32) 455 # define BITMASK_BYTE (0xFF) 456 # define BITMASK_WORD (0xFFFF) 457 # define BITMASK_DWORD (0xFFFFFFFF) 459 # define INT_PTR_MIN (-2147483647-1) 460 # define INT_PTR_MAX (2147483647) 461 # define UINT_PTR_MAX (4294967295U) 470 #elif defined(__LP64__) 482 #elif defined(__LP64__) 518 #elif defined(__LP64__) 545 #elif defined(__LP64__) 572 #elif defined(__LP64__) 602 #elif defined(__LP64__) 614 #elif defined(__LP64__) 650 #define LOBYTE(w) ((BYTE)(w)) 658 #define HIBYTE(w) ((BYTE)(((WORD)(w) >> NR_BITS_BYTE) & BITMASK_BYTE)) 666 #define MAKEWORD(low, high) ((WORD)(((BYTE)(low)) | (((WORD)((BYTE)(high))) << NR_BITS_BYTE))) 674 #define MAKEWORD16(low, high) ((WORD16)(((BYTE)(low)) | (((WORD16)((BYTE)(high))) << 8))) 682 #define MAKEWPARAM(first, second, third, fourth) \ 685 (((WPARAM)((BYTE)(second))) << 8) | \ 686 (((WPARAM)((BYTE)(third))) << 16) | \ 687 (((WPARAM)((BYTE)(fourth))) << 24) \ 696 #define FIRSTBYTE(w) ((BYTE)(w)) 704 #define SECONDBYTE(w) ((BYTE)(((DWORD32)(w)) >> 8)) 712 #define THIRDBYTE(w) ((BYTE)(((DWORD32)(w)) >> 16)) 720 #define FOURTHBYTE(w) ((BYTE)(((DWORD32)(w)) >> 24)) 728 #define LOWORD(l) ((WORD)(DWORD)(l)) 735 #define HIWORD(l) ((WORD)((((DWORD)(l)) >> NR_BITS_WORD) & BITMASK_WORD)) 743 #define LOSWORD(l) ((SWORD)(DWORD)(l)) 750 #define HISWORD(l) ((SWORD)((((DWORD)(l)) >> NR_BITS_WORD) & BITMASK_WORD)) 757 #define MAKELONG32(low, high) ((DWORD32)(((WORD16)(low)) | (((DWORD32)((WORD16)(high))) << 16))) 764 #define MAKELONG(low, high) ((DWORD)(((WORD)(low)) | (((DWORD)((WORD)(high))) << NR_BITS_WORD))) 780 #define GetRValue(rgba) ((BYTE)(rgba)) 789 #define GetGValue(rgba) ((BYTE)(((DWORD32)(rgba)) >> 8)) 798 #define GetBValue(rgba) ((BYTE)((DWORD32)(rgba) >> 16)) 807 #define GetAValue(rgba) ((BYTE)((DWORD32)(rgba) >> 24)) 819 #define MakeRGBA(r, g, b, a) (((DWORD32)((BYTE)(r))) | ((DWORD32)((BYTE)(g)) << 8) \ 820 | ((DWORD32)((BYTE)(b)) << 16) | ((DWORD32)((BYTE)(a)) << 24)) 831 #define MakeRGB(r, g, b) (((DWORD32)((BYTE)(r))) | ((DWORD32)((BYTE)(g)) << 8) \ 832 | ((DWORD32)((BYTE)(b)) << 16)) 1104 #define MGUI_NR_KEYS 255 1138 #define SCANCODE_USER (NR_KEYS + 1) 1140 #define SCANCODE_ESCAPE 1 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 1153 #define SCANCODE_MINUS 12 1154 #define SCANCODE_EQUAL 13 1156 #define SCANCODE_BACKSPACE 14 1157 #define SCANCODE_TAB 15 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 1172 #define SCANCODE_ENTER 28 1174 #define SCANCODE_LEFTCONTROL 29 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 1189 #define SCANCODE_LEFTSHIFT 42 1190 #define SCANCODE_BACKSLASH 43 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 1203 #define SCANCODE_RIGHTSHIFT 54 1204 #define SCANCODE_KEYPADMULTIPLY 55 1206 #define SCANCODE_LEFTALT 56 1207 #define SCANCODE_SPACE 57 1208 #define SCANCODE_CAPSLOCK 58 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 1221 #define SCANCODE_NUMLOCK 69 1222 #define SCANCODE_SCROLLLOCK 70 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 1246 #define SCANCODE_LESS 86 1248 #define SCANCODE_F11 87 1249 #define SCANCODE_F12 88 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 1258 #define SCANCODE_BREAK_ALTERNATIVE 119 1260 #define SCANCODE_HOME 102 1261 #define SCANCODE_CURSORBLOCKUP 103 1262 #define SCANCODE_PAGEUP 104 1263 #define SCANCODE_CURSORBLOCKLEFT 105 1264 #define SCANCODE_CURSORBLOCKRIGHT 106 1265 #define SCANCODE_END 107 1266 #define SCANCODE_CURSORBLOCKDOWN 108 1267 #define SCANCODE_PAGEDOWN 109 1268 #define SCANCODE_INSERT 110 1269 #define SCANCODE_REMOVE 111 1271 #define SCANCODE_PAUSE 119 1273 #define SCANCODE_POWER 120 1274 #define SCANCODE_SLEEP 121 1275 #define SCANCODE_WAKEUP 122 1277 #define SCANCODE_LEFTWIN 125 1278 #define SCANCODE_RIGHTWIN 126 1279 #define SCANCODE_MENU 127 1281 #define SCANCODE_LEFTBUTTON 0x1000 1282 #define SCANCODE_RIGHTBUTTON 0x2000 1283 #define SCANCODE_MIDDLBUTTON 0x4000 1305 #define KS_REPEATED 0x00000800 1327 #define KS_CAPTURED 0x00000400 1335 #define KS_IMEPOST 0x00000200 1357 #define KS_CAPSLOCK 0x00000100 1366 #define KS_NUMLOCK 0x00000080 1375 #define KS_SCROLLLOCK 0x00000040 1384 #define KS_LEFTCTRL 0x00000020 1393 #define KS_RIGHTCTRL 0x00000010 1402 #define KS_CTRL 0x00000030 1411 #define KS_LEFTALT 0x00000008 1420 #define KS_RIGHTALT 0x00000004 1429 #define KS_ALT 0x0000000C 1438 #define KS_LEFTSHIFT 0x00000002 1447 #define KS_RIGHTSHIFT 0x00000001 1456 #define KS_SHIFT 0x00000003 1462 #define MASK_KS_SHIFTKEYS 0x00000FFF 1471 #define KS_LEFTBUTTON 0x00001000 1480 #define KS_RIGHTBUTTON 0x00002000 1489 #define KS_MIDDLBUTTON 0x00004000 1495 #define MASK_KS_BUTTONS 0x0000F000 1513 #define ERR_INV_HWND -1 1519 #define ERR_QUEUE_FULL -2 1525 #define ERR_INVALID_HANDLE -3 1531 #define ERR_INVALID_HMENU -4 1537 #define ERR_INVALID_POS -5 1543 #define ERR_INVALID_ID -6 1549 #define ERR_RES_ALLOCATION -7 1555 #define ERR_CTRLCLASS_INVNAME -8 1561 #define ERR_CTRLCLASS_INVLEN -9 1567 #define ERR_CTRLCLASS_MEM -10 1573 #define ERR_CTRLCLASS_INUSE -11 1579 #define ERR_ALREADY_EXIST -12 1585 #define ERR_NO_MATCH -13 1591 #define ERR_BAD_OWNER -14 1597 #define ERR_IME_TOOMUCHIMEWND -15 1603 #define ERR_IME_NOSUCHIMEWND -16 1609 #define ERR_IME_NOIMEWND -17 1615 #define ERR_CONFIG_FILE -18 1621 #define ERR_FILE_IO -19 1627 #define ERR_GFX_ENGINE -20 1633 #define ERR_INPUT_ENGINE -21 1639 #define ERR_NO_ENGINE -22 1645 #define ERR_INVALID_ARGS -23 1657 #define TABLESIZE(table) (sizeof(table)/sizeof(table[0])) 1665 #define MAX(x, y) (((x) > (y))?(x):(y)) 1672 #define MIN(x, y) (((x) < (y))?(x):(y)) 1679 #define ABS(x) (((x)<0) ? -(x) : (x)) 1683 #if !defined(__NOUNIX__) || defined (__ECOS__) 1688 # define PATH_MAX 256 1692 # define NAME_MAX 64 1702 # define MAX_PATH PATH_MAX 1711 # define MAX_NAME NAME_MAX 1723 typedef unsigned int time_t;
1738 #if defined (__THREADX__) && defined (__TARGET_VFANVIL__) 1741 #include "os_type.h" 1742 #include "os_file_api.h" 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 1752 #define _HAVE_ASSERT 1 1754 #define assert(e) do { \ 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);
1775 #define strdup own_strdup 1780 MG_EXPORT
char *strdup(
const char *s);
1783 #ifndef HAVE_STRCASECMP 1784 MG_EXPORT
int strcasecmp(
const char *s1,
const char *s2);
1787 #ifndef HAVE_STRNCASECMP 1788 MG_EXPORT
int strncasecmp(
const char *s1,
const char *s2,
unsigned int n);
1791 #ifdef _MGUSE_OWN_MALLOC 1812 int init_minigui_malloc (
unsigned char* heap,
unsigned int heap_size,
1813 int (*lock_heap) (
void),
int (*unlock_heap) (
void));
1815 #define USE_DL_PREFIX 1817 #include "own_malloc.h" 1820 #define calloc dlcalloc 1822 #define malloc dlmalloc 1823 #define memalign dlmemalign 1824 #define realloc dlrealloc 1825 #define valloc dlvalloc 1830 #if defined(__CC_ARM) 1832 # undef HAVE_ALLOCA_H 1835 #ifdef HAVE_ALLOCA_H 1836 # include <alloca.h> 1837 # define ALLOCATE_LOCAL(size) alloca((int)(size)) 1838 # define DEALLOCATE_LOCAL(ptr) 1840 # define ALLOCATE_LOCAL(size) malloc((int)(size)) 1841 # define DEALLOCATE_LOCAL(ptr) free(ptr) 1844 #ifdef _MGUSE_OWN_STDIO 1858 int init_minigui_printf (
int (*output_char) (
int ch),
1859 int (*input_char) (
void));
1861 #if defined (__UCOSII__) || defined (__VXWORKS__) || defined (__NUCLEUS__) || defined (__PSOS__) 1862 # undef _PRINTF_FLOATING_POINT 1863 # undef _SCANF_FLOATING_POINT 1866 # define _PRINTF_FLOATING_POINT 1 1867 # define _SCANF_FLOATING_POINT 1 1873 # define isnan _isnan 1874 # define finite _finite 1877 #undef _I18N_MB_REQUIRED 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 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 1902 #include "own_stdio.h" 1905 #ifdef _MGUSE_OWN_PRINTF 1906 #define printf own_printf 1909 #ifdef _MGUSE_OWN_FPRINTF 1910 #define fprintf own_fprintf 1913 #ifdef _MGUSE_OWN_SPRINTF 1914 #define sprintf own_sprintf 1917 #ifdef _MGUSE_OWN_FNPRINTF 1918 #define fnprintf own_fnprintf 1921 #ifdef _MGUSE_OWN_SNPRINTF 1922 #define snprintf own_snprintf 1925 #ifdef _MGUSE_OWN_VPRINTF 1926 #define vprintf own_vprintf 1929 #ifdef _MGUSE_OWN_VFPRINTF 1930 #define vfprintf own_vfprintf 1933 #ifdef _MGUSE_OWN_VSPRINTF 1934 #define vsprintf own_vsprintf 1937 #ifdef _MGUSE_OWN_VFNPRINTF 1938 #define vfnprintf own_vfnprintf 1941 #ifdef _MGUSE_OWN_VSNPRINTF 1942 #define vsnprintf own_vsnprintf 1945 #ifdef _MGUSE_OWN_SCANF 1946 #define scanf own_scanf 1949 #ifdef _MGUSE_OWN_FSCANF 1950 #define fscanf own_fscanf 1953 #ifdef _MGUSE_OWN_SSCANF 1954 #define sscanf own_sscanf 1957 #ifdef _MGUSE_OWN_VSCANF 1958 #define vscanf own_vscanf 1961 #ifdef _MGUSE_OWN_VFSCANF 1962 #define vfscanf own_vfscanf 1965 #ifdef _MGUSE_OWN_VSSCANF 1966 #define vsscanf own_vsscanf 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") 1997 #define TCS_NONE(fp) 1998 #define TCS_BLACK(fp) 1999 #define TCS_BOLD_BLACK(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) 2023 #if defined(__GNUC__) 2024 # define _ERR_PRINTF(fmt...) \ 2026 TCS_BOLD_RED (stderr); \ 2027 fprintf (stderr, fmt); \ 2028 TCS_NONE (stderr); \ 2031 # define _MG_PRINTF(fmt...) \ 2033 TCS_GREEN (stderr); \ 2034 fprintf (stderr, fmt); \ 2035 TCS_NONE (stderr); \ 2039 # define _DBG_PRINTF(fmt...) \ 2041 TCS_YELLOW (stderr); \ 2042 fprintf (stderr, fmt); \ 2043 TCS_NONE (stderr); \ 2046 # define _DBG_PRINTF(fmt...) 2049 # define _MG_PRINTF(fmt...) 2050 # define _DBG_PRINTF(fmt...) 2054 static inline void _ERR_PRINTF(
const char* fmt, ...)
2058 TCS_BOLD_RED (stderr);
2059 vfprintf (stderr, fmt, ap);
2063 static inline void _MG_PRINTF(
const char* fmt, ...)
2069 vfprintf (stderr, fmt, ap);
2075 static inline void _DBG_PRINTF(
const char* fmt, ...)
2077 #if defined(DEBUG) && defined(_DEBUG) 2080 TCS_YELLOW (stderr);
2081 vfprintf (stderr, fmt, ap);
2088 #ifdef _MGRM_THREADS 2090 #ifdef _MGUSE_OWN_PTHREAD 2092 #define MAIN_PTH_MIN_STACK_SIZE (1024) 2093 #define MAIN_PTH_DEF_STACK_SIZE (1024*4) 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);
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 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 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 2201 #ifdef _MGUSE_OWN_SEMAPHORE 2203 #define sem_t vxworks_sem_t 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 2216 #ifdef __MINIGUI_LIB__ 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" 2232 # include "semaphore.h" 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" 2244 # error No own pthread implementation for this OS! 2249 # include <pthread.h> 2250 # include <semaphore.h> 2256 #include <pthread.h> 2257 #include <semaphore.h> 2263 #define _USE_SEM_ON_SYSVIPC 1 2267 #if defined (_USE_MUTEX_ON_SYSVIPC) || defined (_USE_SEM_ON_SYSVIPC) 2269 int _sysvipc_mutex_sem_init (
void);
2270 int _sysvipc_mutex_sem_term (
void);
2274 #ifdef _USE_MUTEX_ON_SYSVIPC 2276 #define pthread_mutex_t _sysvipc_pthread_mutex_t 2277 #define pthread_mutexattr_t _sysvipc_pthread_mutexattr_t 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 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 2299 #define SYSVIPC_PTHREAD_MUTEX_FAST_NP 0 2300 #define SYSVIPC_PTHREAD_MUTEX_RECURSIVE_NP 1 2301 #define SYSVIPC_PTHREAD_MUTEX_ERRORCHECK_NP 2 2306 } pthread_mutexattr_t;
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);
2313 int pthread_mutex_init (pthread_mutex_t *mutex,
2314 const pthread_mutexattr_t *mutex_attr);
2316 int pthread_mutex_destroy (pthread_mutex_t *mutex);
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);
2324 #ifdef _USE_SEM_ON_SYSVIPC 2326 #define sem_t _sysvipc_sem_t 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 2335 #define SYSVIPC_SEM_VALUE_MAX USHRT_MAX 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);
struct _GAL_Rect GAL_Rect
GHANDLE HACCEL
Handle to accelarator.
int BOOL
A type definition for boolean value.
long LONG
A type definition for long integer.
unsigned char BYTE
A type definition for an 8-bit unsigned character (byte).
SIZE * PSIZE
Data type of the pointer to a SIZE.
signed short SWORD16
A type definition for a 16-bit signed integer.
POINT * PPOINT
Data type of the pointer to a POINT.
Uint32 gal_uint32
Data type of 32-bit unsigned integer.
unsigned long DWORD_PTR
An unsigned long type for pointer precision.
Uint32 gal_attr
Data type of attribute value.
Uint32 gal_pixel
Data type of pixel value.
unsigned long long Uint64
A type definition for a 64-bit unsigned integer.
signed short Sint16
A type definition for a 16-bit signed integer.
unsigned short Uint16
A type definition for a 16-bit unsigned integer.
DWORD32 RGBCOLOR
A type definition for a RGB color.
struct _GAL_Palette GAL_Palette
signed char Sint8
A type definition for an 8-bit signed character.
GHANDLE HDC
Handle to device context.
long LONG_PTR
A signed long type for pointer precision.
GHANDLE HHOOK
Handle to keyboard or mouse event hook.
unsigned int gal_uint
Data type of unsigned integer.
unsigned short WORD16
A type definition for a 16-bit unsigned integer (word).
signed long long Sint64
A type definition for a 64-bit signed integer.
Uint8 gal_uint8
Data type of 8-bit unsigned integer.
signed int Sint32
A type definition for a 32-bit signed integer.
GHANDLE HWND
Handle to main window or control.
GHANDLE HDLG
Handle to dialog box, same as HWND.
unsigned short WORD_HPTR
An unsigned int (word) type in half pointer precision.
int INT_PTR
A signed integer type for pointer precision.
RGB * PRGB
Data type of the pointer to a RGB.
LONG_PTR LINT
Signed integer which has pointer precision.
GHANDLE HCURSOR
Handle to cursor.
PVOID GHANDLE
General handle.
RECT * PRECT
Data type of the pointer to a RECT.
unsigned char Uint8
A type definition for an 8-bit unsigned character.
UINT_PTR LPARAM
A type definition for the second message paramter.
GHANDLE HPALETTE
Handle to a logical palette.
Sint16 gal_sint16
Data type of 16-bit signed integer.
Sint8 gal_sint8
Data type of 8-bit signed integer.
signed short SWORD_HPTR
An signed int type in half pointer precision.
unsigned long ULONG
A type definition for unsigned long integer.
struct _GAL_Color GAL_Color
long fixed
Data type of fixed point.
WORD_HPTR WORD
A type definition for an unsigned integer (word).
unsigned int Uint32
A type definition for a 32-bit unsigned integer.
UINT_PTR WPARAM
A type definition for the first message paramter.
DWORD_PTR DWORD
A unsigned long type definition for pointer precision.
SWORD_HPTR SWORD
A type definition for a signed integer.
LONG_PTR LRESULT
Signed result of message processing.
void * PVOID
A type definition for a pointer to any type.
signed long SDWORD_PTR
A signed long type for pointer precision.
unsigned long UINT_PTR
A unsigned integer type for pointer precision.
signed int gal_sint
Data type of signed integer.
SDWORD_PTR SDWORD
A signed long type definition for pointer precision.
unsigned int UINT
A type definition for unsigned integer.
unsigned int DWORD32
A type definition for a 32-bit unsigned integer.
Sint32 gal_sint32
Data type of 32-bit signed integer.
GHANDLE HMENU
Handle to menu.
Uint16 gal_uint16
Data type of 16-bit unsigned integer.
signed char SBYTE
A type definition for an 8-bit signed character.
GHANDLE HICON
Handle to icon.
signed int SDWORD32
A type definition for a 32-bit signed integer.