00001
00007 #ifndef __LGI_OS_DEFS_H
00008 #define __LGI_OS_DEFS_H
00009
00010 #include "assert.h"
00011
00012 #include <stdarg.h>
00013 #include <stdlib.h>
00014 #include <stdio.h>
00015 #define _MULTI_THREADED
00016 #include <pthread.h>
00017
00018 #undef stricmp
00019
00020 #include "LgiInc.h"
00021
00022
00023 #define LINUX 1
00024 #define XP_CTRLS 1
00025 #define POSIX 1
00026
00027 typedef enum {
00028
00029 VK_UNKNOWN = 0,
00030 VK_FIRST = 0,
00031 VK_BACKSPACE = 8,
00032 VK_TAB = 9,
00033 VK_CLEAR = 12,
00034 VK_RETURN = 13,
00035 VK_PAUSE = 19,
00036 VK_ESCAPE = 27,
00037 VK_SPACE = 32,
00038 VK_EXCLAIM = 33,
00039 VK_QUOTEDBL = 34,
00040 VK_HASH = 35,
00041 VK_DOLLAR = 36,
00042 VK_AMPERSAND = 38,
00043 VK_QUOTE = 39,
00044 VK_LEFTPAREN = 40,
00045 VK_RIGHTPAREN = 41,
00046 VK_ASTERISK = 42,
00047 VK_PLUS = 43,
00048 VK_COMMA = 44,
00049 VK_MINUS = 45,
00050 VK_PERIOD = 46,
00051 VK_SLASH = 47,
00052 VK_0 = 48,
00053 VK_1 = 49,
00054 VK_2 = 50,
00055 VK_3 = 51,
00056 VK_4 = 52,
00057 VK_5 = 53,
00058 VK_6 = 54,
00059 VK_7 = 55,
00060 VK_8 = 56,
00061 VK_9 = 57,
00062 VK_COLON = 58,
00063 VK_SEMICOLON = 59,
00064 VK_LESS = 60,
00065 VK_EQUALS = 61,
00066 VK_GREATER = 62,
00067 VK_QUESTION = 63,
00068 VK_AT = 64,
00069
00070
00071
00072 VK_LEFTBRACKET = 91,
00073 VK_BACKSLASH = 92,
00074 VK_RIGHTBRACKET = 93,
00075 VK_CARET = 94,
00076 VK_UNDERSCORE = 95,
00077 VK_BACKQUOTE = 96,
00078 VK_a = 97,
00079 VK_b = 98,
00080 VK_c = 99,
00081 VK_d = 100,
00082 VK_e = 101,
00083 VK_f = 102,
00084 VK_g = 103,
00085 VK_h = 104,
00086 VK_i = 105,
00087 VK_j = 106,
00088 VK_k = 107,
00089 VK_l = 108,
00090 VK_m = 109,
00091 VK_n = 110,
00092 VK_o = 111,
00093 VK_p = 112,
00094 VK_q = 113,
00095 VK_r = 114,
00096 VK_s = 115,
00097 VK_t = 116,
00098 VK_u = 117,
00099 VK_v = 118,
00100 VK_w = 119,
00101 VK_x = 120,
00102 VK_y = 121,
00103 VK_z = 122,
00104 VK_DELETE = 127,
00105
00106
00107
00108 VK_WORLD_0 = 160,
00109 VK_WORLD_1 = 161,
00110 VK_WORLD_2 = 162,
00111 VK_WORLD_3 = 163,
00112 VK_WORLD_4 = 164,
00113 VK_WORLD_5 = 165,
00114 VK_WORLD_6 = 166,
00115 VK_WORLD_7 = 167,
00116 VK_WORLD_8 = 168,
00117 VK_WORLD_9 = 169,
00118 VK_WORLD_10 = 170,
00119 VK_WORLD_11 = 171,
00120 VK_WORLD_12 = 172,
00121 VK_WORLD_13 = 173,
00122 VK_WORLD_14 = 174,
00123 VK_WORLD_15 = 175,
00124 VK_WORLD_16 = 176,
00125 VK_WORLD_17 = 177,
00126 VK_WORLD_18 = 178,
00127 VK_WORLD_19 = 179,
00128 VK_WORLD_20 = 180,
00129 VK_WORLD_21 = 181,
00130 VK_WORLD_22 = 182,
00131 VK_WORLD_23 = 183,
00132 VK_WORLD_24 = 184,
00133 VK_WORLD_25 = 185,
00134 VK_WORLD_26 = 186,
00135 VK_WORLD_27 = 187,
00136 VK_WORLD_28 = 188,
00137 VK_WORLD_29 = 189,
00138 VK_WORLD_30 = 190,
00139 VK_WORLD_31 = 191,
00140 VK_WORLD_32 = 192,
00141 VK_WORLD_33 = 193,
00142 VK_WORLD_34 = 194,
00143 VK_WORLD_35 = 195,
00144 VK_WORLD_36 = 196,
00145 VK_WORLD_37 = 197,
00146 VK_WORLD_38 = 198,
00147 VK_WORLD_39 = 199,
00148 VK_WORLD_40 = 200,
00149 VK_WORLD_41 = 201,
00150 VK_WORLD_42 = 202,
00151 VK_WORLD_43 = 203,
00152 VK_WORLD_44 = 204,
00153 VK_WORLD_45 = 205,
00154 VK_WORLD_46 = 206,
00155 VK_WORLD_47 = 207,
00156 VK_WORLD_48 = 208,
00157 VK_WORLD_49 = 209,
00158 VK_WORLD_50 = 210,
00159 VK_WORLD_51 = 211,
00160 VK_WORLD_52 = 212,
00161 VK_WORLD_53 = 213,
00162 VK_WORLD_54 = 214,
00163 VK_WORLD_55 = 215,
00164 VK_WORLD_56 = 216,
00165 VK_WORLD_57 = 217,
00166 VK_WORLD_58 = 218,
00167 VK_WORLD_59 = 219,
00168 VK_WORLD_60 = 220,
00169 VK_WORLD_61 = 221,
00170 VK_WORLD_62 = 222,
00171 VK_WORLD_63 = 223,
00172 VK_WORLD_64 = 224,
00173 VK_WORLD_65 = 225,
00174 VK_WORLD_66 = 226,
00175 VK_WORLD_67 = 227,
00176 VK_WORLD_68 = 228,
00177 VK_WORLD_69 = 229,
00178 VK_WORLD_70 = 230,
00179 VK_WORLD_71 = 231,
00180 VK_WORLD_72 = 232,
00181 VK_WORLD_73 = 233,
00182 VK_WORLD_74 = 234,
00183 VK_WORLD_75 = 235,
00184 VK_WORLD_76 = 236,
00185 VK_WORLD_77 = 237,
00186 VK_WORLD_78 = 238,
00187 VK_WORLD_79 = 239,
00188 VK_WORLD_80 = 240,
00189 VK_WORLD_81 = 241,
00190 VK_WORLD_82 = 242,
00191 VK_WORLD_83 = 243,
00192 VK_WORLD_84 = 244,
00193 VK_WORLD_85 = 245,
00194 VK_WORLD_86 = 246,
00195 VK_WORLD_87 = 247,
00196 VK_WORLD_88 = 248,
00197 VK_WORLD_89 = 249,
00198 VK_WORLD_90 = 250,
00199 VK_WORLD_91 = 251,
00200 VK_WORLD_92 = 252,
00201 VK_WORLD_93 = 253,
00202 VK_WORLD_94 = 254,
00203 VK_WORLD_95 = 255,
00204
00205
00206 VK_KP0 = 0x10000,
00207 VK_KP1,
00208 VK_KP2,
00209 VK_KP3,
00210 VK_KP4,
00211 VK_KP5,
00212 VK_KP6,
00213 VK_KP7,
00214 VK_KP8,
00215 VK_KP9,
00216 VK_KP_PERIOD,
00217 VK_KP_DIVIDE,
00218 VK_KP_MULTIPLY,
00219 VK_KP_MINUS,
00220 VK_KP_PLUS,
00221 VK_KP_ENTER,
00222 VK_KP_EQUALS,
00223
00224
00225 VK_UP,
00226 VK_DOWN,
00227 VK_RIGHT,
00228 VK_LEFT,
00229 VK_INSERT,
00230 VK_HOME,
00231 VK_END,
00232 VK_PAGEUP,
00233 VK_PAGEDOWN,
00234
00235
00236 VK_F1,
00237 VK_F2,
00238 VK_F3,
00239 VK_F4,
00240 VK_F5,
00241 VK_F6,
00242 VK_F7,
00243 VK_F8,
00244 VK_F9,
00245 VK_F10,
00246 VK_F11,
00247 VK_F12,
00248 VK_F13,
00249 VK_F14,
00250 VK_F15,
00251
00252
00253 VK_NUMLOCK,
00254 VK_CAPSLOCK,
00255 VK_SCROLLOCK,
00256 VK_RSHIFT,
00257 VK_LSHIFT,
00258 VK_RCTRL,
00259 VK_LCTRL,
00260 VK_RALT,
00261 VK_LALT,
00262 VK_RMETA,
00263 VK_LMETA,
00264 VK_LSUPER,
00265 VK_RSUPER,
00266 VK_MODE,
00267 VK_COMPOSE,
00268
00269
00270 VK_HELP,
00271 VK_PRINT,
00272 VK_SYSREQ,
00273 VK_BREAK,
00274 VK_MENU,
00275 VK_POWER,
00276 VK_EURO,
00277 VK_UNDO,
00278
00279
00280
00281 VK_LAST
00282 } LgiKey;
00283
00284 class OsAppArguments
00285 {
00286 public:
00287 int Args;
00288 char **Arg;
00289 };
00290
00291
00292 typedef int OsProcess;
00293 typedef int OsProcessId;
00294
00295
00296 #include "xmainwindow.h"
00297 typedef XMainWindow *OsWindow;
00298 typedef XWidget *OsView;
00299
00300
00301 typedef pthread_t OsThreadId;
00302 typedef pthread_mutex_t OsSemaphore;
00303 #define LgiGetCurrentThread() pthread_self()
00304
00305
00306 #define ValidSocket(s) ((s)>=0)
00307 #define INVALID_SOCKET -1
00308 typedef int OsSocket;
00309
00311 #define LgiSleep(i) _lgi_sleep(i)
00312 LgiFunc void _lgi_sleep(int i);
00313
00314 #define atoi64 atoll
00315 #define _snprintf snprintf
00316 #define _vsnprintf vsnprintf
00317
00319 #define LgiYield() LgiApp->Run(false)
00320
00321 #define K_CHAR 0x0
00322
00324 #define LGI_FileDropFormat "text/uri-list"
00325
00326 #define LGI_WideCharset "utf-32"
00327 #define LGI_PrintfInt64 "%Li"
00328
00329 #define SND_ASYNC 1
00330
00331 #define DOUBLE_CLICK_THRESHOLD 5
00332
00333
00334 #define GWF_VISIBLE 0x00000001
00335 #define GWF_ENABLED 0x00000002
00336 #define GWF_FOCUS 0x00000004
00337 #define GWF_OVER 0x00000008
00338 #define GWF_DROP_TARGET 0x00000010
00339 #define GWF_SUNKEN 0x00000020
00340 #define GWF_FLAT 0x00000040
00341 #define GWF_RAISED 0x00000080
00342 #define GWF_BORDER 0x00000100
00343 #define GWF_DIALOG 0x00000200
00344 #define GWF_DESTRUCTOR 0x00000400
00345 #define GWF_QUIT_WND 0x00000800
00346
00347
00348 #define ODS_SELECTED 0x1
00349 #define ODS_DISABLED 0x2
00350 #define ODS_CHECKED 0x4
00351
00353 #define SUNKEN 1
00355 #define RAISED 2
00357 #define CHISEL 3
00359 #define FLAT 4
00360
00362 #define DIR_CHAR '/'
00364 #define DIR_STR "/"
00366 #define EOL_SEQUENCE "\n"
00368 #define IsSlash(c) (((c)=='/')OR((c)=='\\'))
00370 #define IsQuote(c) (((c)=='\"')OR((c)=='\''))
00372 #define LGI_PATH_SEPARATOR ":"
00374 #define LGI_ALL_FILES "*"
00376 #define LGI_LIBRARY_EXT "so"
00377
00379 #define M_SYSTEM (1000)
00381 #define M_CLOSE (M_SYSTEM+1)
00383 #define M_X11_INVALIDATE (M_SYSTEM+2)
00385 #define M_X11_PULSE (M_SYSTEM+3)
00387 #define M_X11_REPARENT (M_SYSTEM+4)
00388
00390 #define M_USER (M_SYSTEM+1000)
00391
00396 #define M_MOUSEENTER (M_USER+100)
00397
00402 #define M_MOUSEEXIT (M_USER+101)
00403
00408 #define M_CHANGE (M_USER+102)
00409
00414 #define M_DESCRIBE (M_USER+103)
00415
00416
00417 #define M_WANT_DIALOG_PROC (M_USER+104)
00418
00419 #define M_MENU (M_USER+105)
00420 #define M_COMMAND (M_USER+106)
00421 #define M_DRAG_DROP (M_USER+107)
00422
00423 #define M_TRAY_NOTIFY (M_USER+108)
00424 #define M_CUT (M_USER+109)
00425 #define M_COPY (M_USER+110)
00426 #define M_PASTE (M_USER+111)
00427 #define M_DELETE (M_USER+112)
00428 #define M_GTHREADWORK_COMPELTE (M_USER+113)
00429
00432 #define IDOK 1
00435 #define IDCANCEL 2
00438 #define IDYES 6
00441 #define IDNO 7
00442
00445 #define MB_OK 0
00448 #define MB_OKCANCEL 1
00451 #define MB_YESNOCANCEL 3
00454 #define MB_YESNO 4
00455
00456 #define MB_SYSTEMMODAL 0x1000
00457
00460 #define LGI_VKEY_CTRL 0x001
00463 #define LGI_VKEY_ALT 0x002
00466 #define LGI_VKEY_SHIFT 0x004
00467
00470 #define LGI_VMOUSE_LEFT 0x008
00473 #define LGI_VMOUSE_MIDDLE 0x010
00476 #define LGI_VMOUSE_RIGHT 0x020
00479 #define LGI_VMOUSE_CTRL 0x040
00482 #define LGI_VMOUSE_ALT 0x080
00485 #define LGI_VMOUSE_SHIFT 0x100
00488 #define LGI_VMOUSE_DOWN 0x200
00491 #define LGI_VMOUSE_DOUBLE 0x400
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527 #define abs(a) ( (a) < 0 ? -(a) : (a) )
00528
00530
00531 #ifndef __CYGWIN__
00532 LgiFunc char *strnistr(char *a, char *b, int n);
00533 LgiFunc int strnicmp(char *a, char *b, int i);
00534 LgiFunc char *strupr(char *a);
00535 LgiFunc char *strlwr(char *a);
00536 LgiFunc int stricmp(char *a, char *b);
00537 #endif
00538
00539 LgiFunc int stricmp(char *a, char *b);
00540
00542 LgiFunc int FormatToInt(char *s);
00544 LgiFunc char *FormatToStr(int f);
00545
00546 #endif
00547