00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 #ifndef INC_COMPATDEF
00100 #define INC_COMPATDEF
00101
00102
00103
00104
00105 #define USE_WXAUI
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 #define camIsalnum wxIsalnum
00117 #define camIsalpha wxIsalpha
00118 #define camIscntrl wxIscntrl
00119 #define camIsdigit wxIsdigit
00120 #define camIsgraph wxIsgraph
00121 #define camIslower wxIslower
00122 #define camIsprint wxIsprint
00123 #define camIspunct wxIspunct
00124 #define camIsspace wxIsspace
00125 #define camIsupper wxIsupper
00126 #define camIsxdigit wxIsxdigit
00127 #define camTolower wxTolower
00128 #define camToupper wxToupper
00129 #define camSetlocale wxSetlocale
00130 #define camStrcat wxStrcat
00131 #define camStrchr wxStrchr
00132 #define camStrcmp wxStrcmp
00133 #define camStrcoll wxStrcoll
00134 #define camStrcpy wxStrcpy
00135 #define camStrcspn wxStrcspn
00136 #define camStrdup wxStrdup
00137 #define camStrdupW wxStrdupW
00138 #define camStrftime wxStrftime
00139 #define camStricmp wxStricmp
00140 #define camStrnicmp wxStrnicmp
00141 #define camStrlen wxStrlen
00142 #define camStrclen wxStrlen
00143 #define camStrncat wxStrncat
00144 #define camStrncmp wxStrncmp
00145 #define camStrncpy wxStrncpy
00146 #define camStrpbrk wxStrpbrk
00147 #define camStrrchr wxStrrchr
00148 #define camStrspn wxStrspn
00149 #define camStrstr wxStrstr
00150 #define camStrtod wxStrtod
00151 #define camStrtol wxStrtol
00152 #define camStrtoul wxStrtoul
00153 #define camStrxfrm wxStrxfrm
00154 #define camFgetc wxFgetc
00155 #define camFgetchar wxFgetchar
00156 #define camFgets wxFgets
00157 #define camFopen wxFopen
00158 #define camFputc wxFputc
00159 #define camFputchar wxFputchar
00160 #define camFprintf wxFprintf
00161 #define camFputs wxFputs
00162 #define camFreopen wxFreopen
00163 #define camFscanf wxFscanf
00164 #define camGetc wxGetc
00165 #define camGetchar wxGetchar
00166 #define camGets wxGets
00167 #define camPerror wxPerror
00168 #define camPrintf wxPrintf
00169 #define camPutc wxPutc
00170 #define camPutchar wxPutchar
00171 #define camPuts wxPuts
00172 #define camScanf wxScanf
00173 #define camSprintf wxSprintf
00174 #define camSscanf wxSscanf
00175 #define camTmpnam wxTmpnam
00176 #define camUngetc wxUngetc
00177 #define camVfprintf wxVfprintf
00178 #define camVprintf wxVprintf
00179 #define camVsscanf wxVsscanf
00180 #define camVsprintf wxVsprintf
00181 #define camVsnprintf wxVsnprintf
00182 #define camSnprintf wxSnprintf
00183 #define camRemove wxRemove
00184 #define camRename wxRename
00185 #define camAtoi wxAtoi
00186 #define camAtol wxAtol
00187 #define camGetenv wxGetenv
00188 #define camSystem wxSystem
00189 #define camAsctime wxAsctime
00190 #define camCtime wxCtime
00191 #define camMbstowcs wxMbstowcs
00192 #define camWcstombs wxWcstombs
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202 #if !defined(__WXMSW__)
00203 typedef char CHAR;
00204 typedef wchar_t WCHAR;
00205
00206 #if !defined(__64BIT__)
00207 typedef unsigned long UINT_PTR;
00208 typedef unsigned long DWORD_PTR;
00209 #else
00210 typedef unsigned long long UINT_PTR;
00211 typedef unsigned long long DWORD_PTR;
00212 #endif
00213
00214 #define camStrinc(v) ( (v)+1 )
00215 #define camStrninc(s, n) ( (s)+(n) )
00216 #define camStrdec(s, v) ( (v)-1 )
00217
00218 #if 0 != wxUSE_UNICODE
00219 typedef wchar_t TCHAR;
00220
00221 #define camStrtok wcstok
00222 #define camStrtof( str, pszMark ) wcstof( str, pszMark )
00223
00224
00225 #define _strnicmp strncasecmp
00226 #define _snprintf snprintf
00227
00228 #else // !wxUSE_UNICODE
00229
00230 typedef char TCHAR;
00231
00232 #define camStrtok strtok_r
00233 #define camStrtof( str, pszMark ) strtof( str, pszMark )
00234
00235
00236 #define _strnicmp strncasecmp
00237 #define _snprintf snprintf
00238
00239 #endif
00240
00241 static void CharUpper( TCHAR *psz )
00242 {
00243 for( ; *psz != '\0'; ++psz )
00244 *psz = camToupper( *psz );
00245 }
00246 static void CharLower( TCHAR *psz )
00247 {
00248 for( ; *psz != '\0'; ++psz )
00249 *psz = camTolower( *psz );
00250 }
00251
00252 #if SIZEOF_CHAR == 1
00253 typedef unsigned char BYTE;
00254 typedef signed char INT8;
00255 typedef unsigned char UINT8;
00256 #else
00257 #error "Can't define BYTE, no built-in type with 1 byte length"
00258 #endif
00259
00260 #if SIZEOF_SHORT == 2
00261 typedef unsigned short WORD;
00262 typedef signed short INT16;
00263 typedef unsigned short UINT16;
00264 #else
00265 #error "Can't define WORD, no built-in type with 2 byte length"
00266 #endif
00267
00268 #if SIZEOF_INT == 4
00269 typedef unsigned int DWORD;
00270 typedef signed int INT32;
00271 typedef unsigned int UINT32;
00272 #define INT32_MAX INT_MAX
00273 #define INT32_MIN INT_MIN
00274 #define UINT32_MAX UINT_MAX
00275 #define UINT32_MIN UINT_MIN
00276 #elif SIZEOF_LONG == 4
00277 typedef unsigned long DWORD;
00278 typedef signed long INT32;
00279 typedef unsigned long UINT32;
00280 #define INT32_MAX LONG_MAX
00281 #define INT32_MIN LONG_MIN
00282 #define UINT32_MAX ULONG_MAX
00283 #define UINT32_MIN ULONG_MIN
00284 #else
00285 #error "Can't define DWORD, no built-in type with 4 byte length"
00286 #endif
00287
00288 #if SIZEOF_LONG_LONG == 8
00289 #if SIZEOF___INT64 == 0
00290 typedef signed long long __int64;
00291 #endif
00292 typedef unsigned long long __uint64;
00293 typedef unsigned long long QWORD;
00294 typedef signed long long INT64, LONGLONG;
00295 typedef unsigned long long UINT64, ULONGLONG;
00296 #else
00297 #error "Can't define QWORD, no built-in type with 8 byte length"
00298 #endif
00299
00300
00301
00302
00303
00304
00305 wxDEPRECATED(typedef UINT32 ULONG);
00306 wxDEPRECATED(typedef INT32 LONG);
00307
00308
00309 typedef INT8 *PINT8;
00310 typedef INT16 *PINT16;
00311 typedef INT32 *PINT32;
00312 typedef INT64 *PINT64;
00313 typedef UINT8 *PUINT8;
00314 typedef UINT16 *PUINT16;
00315 typedef UINT32 *PUINT32;
00316 typedef UINT64 *PUINT64;
00317
00318 typedef INT32 BOOL;
00319 typedef INT32 *INT_PTR;
00320
00321
00322 typedef BYTE *PBYTE, *LPBYTE;
00323 typedef WORD *PWORD, *LPWORD;
00324 typedef DWORD *PDWORD, *LPDWORD;
00325
00326 typedef float FLOAT;
00327
00328 typedef DWORD HRESULT;
00329 const HRESULT S_OK = 0;
00330 const HRESULT E_FAIL = 0x80004005;
00331
00332 typedef char *LPSTR;
00333 typedef const char *LPCSTR;
00334
00335 typedef char *PSTR;
00336 typedef const char *PCSTR;
00337
00338 typedef wchar_t *LPWSTR;
00339 typedef const wchar_t *LPCWSTR;
00340
00341 typedef TCHAR *LPTSTR;
00342 typedef const TCHAR *LPCTSTR;
00343
00344 typedef TCHAR *PTSTR;
00345 typedef const TCHAR *PCTSTR;
00346
00347 typedef void *PVOID, *LPVOID;
00348 typedef const void *PCVOID;
00349
00350 typedef INT32 WPARAM, LPARAM, LRESULT;
00351
00352 #define Int32x32To64( a, b ) (INT64)( (INT64)((INT32)(a)) * (INT32)(b) )
00353 #define UInt32x32To64( a, b ) (UINT64)( (UINT64)((INT32)(a)) * (INT32)(b) )
00354
00355
00356 inline UINT32 _lrotr( UINT32 lVal, UINT32 nShift )
00357 {
00358 return ( lVal >> nShift ) | ( lVal << ( 32 - nShift ) );
00359 }
00360
00361 inline UINT32 _lrotl( UINT32 lVal, UINT32 nShift )
00362 {
00363 return ( lVal << nShift ) | ( lVal >> ( 32 - nShift ) );
00364 }
00365
00366 inline INT32 MulDiv( INT32 X, INT32 N, INT32 D )
00367 {
00368
00369 #if defined(__WXMSW__)
00370 UINT32 temp ;
00371 __asm {
00372 mov eax,X
00373 imul N
00374 idiv D
00375 mov temp,eax
00376 }
00377 return temp ;
00378 #else
00379 return INT32( __int64(X) * N / D );
00380 #endif
00381 }
00382
00383 inline WORD HIWORD( DWORD dw )
00384 {
00385 return WORD( dw >> 16 );
00386 }
00387
00388 inline WORD LOWORD( DWORD dw )
00389 {
00390 return WORD(dw);
00391 }
00392
00393 struct RECT
00394 {
00395 INT32 left;
00396 INT32 top;
00397 INT32 right;
00398 INT32 bottom;
00399 };
00400 typedef RECT *PRECT, *LPRECT;
00401
00402 struct POINT
00403 {
00404 INT32 x;
00405 INT32 y;
00406 };
00407 typedef POINT *PPOINT, *LPPOINT;
00408
00409 typedef DWORD COLORREF;
00410 inline COLORREF RGB( BYTE r, BYTE g, BYTE b )
00411 {
00412 return COLORREF(r) | ( WORD(g) << 8 ) | ( DWORD(b) << 16 );
00413 }
00414
00415 inline BYTE GetBValue( COLORREF cr )
00416 {
00417 return( BYTE(cr >> 16) );
00418 }
00419
00420 inline BYTE GetGValue( COLORREF cr )
00421 {
00422 return( BYTE(cr >> 8) );
00423 }
00424
00425 inline BYTE GetRValue( COLORREF cr )
00426 {
00427 return( BYTE(cr) );
00428 }
00429
00430 struct RGBQUAD
00431 {
00432 BYTE rgbBlue;
00433 BYTE rgbGreen;
00434 BYTE rgbRed;
00435 BYTE rgbReserved;
00436 };
00437 typedef RGBQUAD *PRGBQUAD, *LPRGBQUAD;
00438
00439 struct RGBTRIPLE
00440 {
00441 BYTE rgbtBlue;
00442 BYTE rgbtGreen;
00443 BYTE rgbtRed;
00444 };
00445 typedef RGBTRIPLE *PRGBTRIPLE, *LPRGBTRIPLE;
00446
00447 struct PALETTEENTRY
00448 {
00449 BYTE peRed;
00450 BYTE peGreen;
00451 BYTE peBlue;
00452 BYTE peFlags;
00453 };
00454 typedef PALETTEENTRY *PPALETTEENTRY, *LPPALETTEENTRY;
00455
00456 struct LOGPALETTE
00457 {
00458 WORD palVersion;
00459 WORD palNumEntries;
00460 PALETTEENTRY palPalEntry[1];
00461 };
00462 typedef LOGPALETTE *PLOGPALETTE, *LPLOGPALETTE;
00463
00464 struct BITMAPINFOHEADER
00465 {
00466 WORD biSize;
00467 INT32 biWidth;
00468 INT32 biHeight;
00469 WORD biPlanes;
00470 WORD biBitCount;
00471 DWORD biCompression;
00472 DWORD biSizeImage;
00473 INT32 biXPelsPerMeter;
00474 INT32 biYPelsPerMeter;
00475 DWORD biClrUsed;
00476 DWORD biClrImportant;
00477 };
00478 typedef BITMAPINFOHEADER *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
00479
00480 const DWORD BI_RGB = 0;
00481 const DWORD BI_RLE8 = 1;
00482 const DWORD BI_RLE4 = 2;
00483 const DWORD BI_BITFIELDS = 3;
00484
00485
00486 const DWORD DIB_RGB_COLORS = 0;
00487 const DWORD DIB_PAL_COLORS = 1;
00488
00489 struct BITMAPCOREHEADER
00490 {
00491 DWORD bcSize;
00492 WORD bcWidth;
00493 WORD bcHeight;
00494 WORD bcPlanes;
00495 WORD bcBitCount;
00496 };
00497 typedef BITMAPCOREHEADER *PBITMAPCOREHEADER, *LPBITMAPCOREHEADER;
00498
00499 struct BITMAPINFO
00500 {
00501 BITMAPINFOHEADER bmiHeader;
00502 RGBQUAD bmiColors[1];
00503 };
00504 typedef BITMAPINFO *PBITMAPINFO, *LPBITMAPINFO;
00505
00506 #pragma pack(push, 2)
00507 struct BITMAPFILEHEADER
00508 {
00509 WORD bfType;
00510 DWORD bfSize;
00511 WORD bfReserved1;
00512 WORD bfReserved2;
00513 DWORD bfOffBits;
00514 };
00515 #pragma pack(pop)
00516 typedef BITMAPFILEHEADER *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER;
00517
00518 #define MAKEFOURCC( ch0, ch1, ch2, ch3 ) \
00519 ( DWORD(BYTE(ch0)) | ( DWORD(BYTE(ch1)) << 8 ) | \
00520 ( DWORD(BYTE(ch2)) << 16 ) | ( DWORD(BYTE(ch1)) << 24 ) )
00521
00522 #define mmioFOURCC( ch0, ch1, ch2, ch3 ) MAKEFOURCC( ch0, ch1, ch2, ch3 )
00523
00524 struct LOGBRUSH
00525 {
00526 UINT32 lbStyle;
00527 COLORREF lbColor;
00528 PUINT32 lbHatch;
00529 };
00530 typedef LOGBRUSH *PLOGBRUSH, *LPLOGBRUSH;
00531
00532 struct BITMAP
00533 {
00534 };
00535
00536 struct DLGTEMPLATE
00537 {
00538 };
00539
00540 struct DLGITEMTEMPLATE
00541 {
00542 };
00543
00544 struct CDC
00545 {
00546 };
00547
00548 struct ABC
00549 {
00550 };
00551
00552 struct RGNDATA
00553 {
00554 };
00555 typedef RGNDATA *LPRGNDATA;
00556
00557 struct NEWTEXTMETRIC
00558 {
00559 };
00560
00561 struct PAINTSTRUCT
00562 {
00563 };
00564
00565 #define TEXT wxT
00566
00567 #define FAR
00568 #define CDECL
00569 #define PASCAL
00570 #define __cdecl
00571
00572 typedef INT32 (*FARPROC)();
00573
00574
00575 typedef INT32 CRITICAL_SECTION;
00576 typedef void *HANDLE;
00577 typedef void *HGLOBAL;
00578 typedef void *HKEY;
00579 typedef void *HPALETTE;
00580 typedef INT32 CLSID;
00581 typedef void *HINSTANCE;
00582
00583 const HINSTANCE HINSTANCE_ERROR = HINSTANCE(-1);
00584
00585 class IUnknown
00586 {
00587 public:
00588 virtual UINT32 AddRef() = 0;
00589 virtual UINT32 Release() = 0;
00590 virtual ~IUnknown() { };
00591 };
00592
00593 #define STDMETHOD(fn) virtual HRESULT fn
00594
00595 const size_t MAX_PATH = 256;
00596
00597 #if !defined(__WXMAC__)
00598 inline size_t _msize( PVOID ptr )
00599 {
00600 return malloc_usable_size( ptr );
00601 }
00602 #endif
00603
00604 #elif defined(__WXMSW__)
00605
00606 #include <tchar.h>
00607
00608 typedef unsigned long long __uint64;
00609
00610 #define INT32_MAX INT_MAX
00611 #define INT32_MIN INT_MIN
00612 #define UINT32_MAX UINT_MAX
00613 #define UINT32_MIN UINT_MIN
00614
00615 #define SIZEOF_VOIDP sizeof(void *)
00616
00617 #define camStrinc _tcsinc
00618 #define camStrninc _tcsninc
00619 #define camStrdec _tcsdec
00620 #define camStrtok( t, d, x ) _tcstok( (t), (d) )
00621 #define camStrtof _tcstod
00622
00623 #endif
00624
00625
00626 typedef TCHAR TBYTE;
00627 typedef TCHAR *PTBYTE;
00628 typedef TCHAR *LPTBYTE;
00629 typedef TCHAR *PTCHAR;
00630 typedef TCHAR *LPTCHAR;
00631 typedef std::map<void *, WORD> CMapPtrToWord;
00632 typedef std::map<void *, void *> CMapPtrToPtr;
00633 typedef std::map<INT32, void *> CMapLongToPtr;
00634 typedef std::map<void *, INT32> CMapPtrToLong;
00635
00636 typedef wxPoint CNativePoint;
00637 typedef wxSize CNativeSize;
00638 typedef wxRect CNativeRect;
00639 typedef wxDC CNativeDC;
00640 typedef wxWindow CNativeWnd;
00641 typedef wxMenu CNativeMenu;
00642
00643 #if defined(CALLBACK)
00644 #undef CALLBACK
00645 #endif
00646 #if defined(APIENTRY)
00647 #undef APIENTRY
00648 #endif
00649
00650 #define CALLBACK
00651 #define EXPORT
00652 #define AFXAPI
00653 #define APIENTRY
00654 #define CONST const
00655
00656 #define AfxGetApp ::wxGetApp
00657
00658 #define AfxAbort abort
00659
00660
00661
00662
00663
00664 #define HELP_CONTEXT 0x0001L
00665 #define HELP_QUIT 0x0002L
00666 #define HELP_INDEX 0x0003L
00667 #define HELP_CONTENTS 0x0003L
00668 #define HELP_HELPONHELP 0x0004L
00669 #define HELP_SETINDEX 0x0005L
00670 #define HELP_SETCONTENTS 0x0005L
00671 #define HELP_CONTEXTPOPUP 0x0008L
00672 #define HELP_FORCEFILE 0x0009L
00673 #define HELP_KEY 0x0101L
00674 #define HELP_COMMAND 0x0102L
00675 #define HELP_PARTIALKEY 0x0105L
00676 #define HELP_MULTIKEY 0x0201L
00677 #define HELP_SETWINPOS 0x0203L
00678 #define HELP_CONTEXTMENU 0x000a
00679 #define HELP_FINDER 0x000b
00680 #define HELP_WM_HELP 0x000c
00681 #define HELP_SETPOPUP_POS 0x000d
00682
00683 #define HELP_TCARD 0x8000
00684 #define HELP_TCARD_DATA 0x0010
00685 #define HELP_TCARD_OTHER_CALLER 0x0011
00686
00687
00688 #define CAMUNUSED(x) WXUNUSED(x)
00689
00690
00691 #define CAMKEY(x) WXK_ ## x
00692
00693 inline void Beep() {wxBell();}
00694
00695 inline double camAtof(TCHAR * s) { double r=0.0; camSscanf(s, _T("%lf"), &r); return r;}
00696 inline INT32 camAtol(TCHAR * s) { INT32 r=0; camSscanf(s, _T("%d"), &r); return r;}
00697
00698
00699 inline void CamUse(void * p) {}
00700 #define CAM_USE(x) do {CamUse( & x );} while(0)
00701
00702 #ifndef _MAX_PATH
00703 #define _MAX_PATH _POSIX_PATH_MAX
00704 #endif
00705
00706
00707
00708
00709
00710 #endif // INC_COMPATDEF