/* WINDOWS.H * * This file is being used as a replacement of type definitions to be found * in "windows.h" on Windows C-compilers like Borland C++ or Microsoft C++ * to make allow compilation of those C-Files with Gnu C++. */ #ifndef __WINDOWS_H # define __WINDOWS_H #ifdef HAVE_CONFIG_H #include // "configure" created system configuration file #endif #define __FLAT__ /* Help to distinguish between 16-Bit and 32-Bit Software */ #define near #define NEAR #define FAR #define lstrcpy strcpy #define lstrlen strlen #define lstrcat strcat #define lstrcpyn strncpy #define lstrcmpi strcasecmp #define wsprintf sprintf #define wvsprintf vsprintf #define _fmemicmp memcmp #define stricmp strcasecmp #define MulDiv(z1,z2,n) ((z1)*(z2)/(n)) #define DECLARE_HANDLE(newtype)\ typedef struct { int dummy; } * newtype #define MAX_PATH 512 #include /* return types of calloc/malloc... and NULL */ #ifdef HAVE_STDINT_H // __linux__ #include /* definitions of uint32_t ... */ #endif #ifdef HAVE_SYS_INTTYPES_H // _AIX #include /* definitions of uint32_t ... */ #endif /* we have to match the sizes of Intel Windows, here! */ typedef void *LPVOID; typedef uint8_t BYTE , *LPBYTE; typedef uint32_t UINT , *LPUINT; typedef int32_t INT , *LPINT; typedef int32_t LONG , *LPLONG; typedef uint32_t DWORD, *LPDWORD, COLORREF; typedef unsigned long LPARAM; /* this must be valid for pointers, too */ typedef uint16_t WORD, *LPWORD; typedef char FAR *LPSTR, NEAR *NPSTR; typedef const char *LPCSTR; typedef int HFILE; #define HFILE_ERROR ((HFILE)-1) typedef unsigned int BOOL , *LPBOOL; #define TRUE 1 #define FALSE 0 #define WINAPI #define CALLBACK #define PASCAL #define pascal typedef void * HLOCAL; #define LocalAlloc(flags, size) (calloc(1,size)) #define LocalFree(block) (free(block)) typedef struct { int left, top, right, bottom; } RECT, FAR *LPRECT; typedef struct { int x, y; } POINT, FAR *LPPOINT; typedef struct { int cx, cy; } SIZE , FAR *LPSIZE; typedef UINT HDC, HBRUSH; #define TA_LEFT 0 #define TA_RIGHT 2 #define TA_CENTER 6 #define TA_TOP 0 #define TA_BOTTOM 8 #define TA_BASELINE 24 #define TA_NOUPDATECP 0 #define TA_UPDATECP 1 #include #include #include #define OpenFile(lpcszFileName, lpOfStruct, iFlags) (open(lpcszFileName, iFlags)) #define _lclose(handle) close(handle) #define _lread(handle, ptr, len) read(handle, ptr, len) #define _lwrite(handle, ptr, len) write(handle, ptr, len) #define _llseek(handle, pos, whence) lseek(handle, pos, whence) #define _hread(handle, ptr, len) read(handle, ptr, len) #define _fstrcmp strcmp #define OF_READ O_RDONLY #define OF_WRITE O_WRONLY #define OF_READWRITE O_RDWR #define OF_SHARE_DENY_WRITE 0 /* ? */ #define FF_DONTCARE 0x00 #define FF_ROMAN 0x10 #define FF_SWISS 0x20 #define FF_MODERN 0x30 #define FF_SCRIPT 0x40 #define FF_DECORATIVE 0x50 /* Logical Font */ #define LF_FACESIZE 32 typedef struct { LONG lfHeight; LONG lfWidth; LONG lfEscapement; LONG lfOrientation; LONG lfWeight; BYTE lfItalic; BYTE lfUnderline; BYTE lfStrikeOut; BYTE lfCharSet; BYTE lfOutPrecision; BYTE lfClipPrecision; BYTE lfQuality; BYTE lfPitchAndFamily; char lfFaceName[LF_FACESIZE]; } LOGFONT, *LPLOGFONT; #define FW_DONTCARE 0 #define FW_THIN 100 #define FW_EXTRALIGHT 200 #define FW_LIGHT 300 #define FW_NORMAL 400 #define FW_MEDIUM 500 #define FW_SEMIBOLD 600 #define FW_BOLD 700 #define FW_EXTRABOLD 800 #define FW_HEAVY 900 #define FW_ULTRALIGHT FW_EXTRALIGHT #define FW_REGULAR FW_NORMAL #define FW_DEMIBOLD FW_SEMIBOLD #define FW_ULTRABOLD FW_EXTRABOLD #define FW_BLACK FW_HEAVY //---------------- Memory Handles ---------------------- DECLARE_HANDLE(HGLOBAL); #define GHND 0 #define GlobalAlloc(flags, size) ((HGLOBAL)calloc((size),1)) #define GlobalLock(handle) ((LPSTR)(handle)) #define GlobalUnlock(handle) #define GlobalFree(handle) free((LPVOID)handle) #define GlobalReAlloc(handle, newsize, flags) ((HGLOBAL)realloc((handle), (newsize))) DECLARE_HANDLE(HMETAFILE); //---------------- Device Independend Bitmaps --------- typedef struct { BYTE rgbBlue; BYTE rgbGreen; BYTE rgbRed; BYTE rgbReserved; } RGBQUAD, *LPRGBQUAD; typedef struct { DWORD biSize; LONG biWidth; LONG biHeight; WORD biPlanes; WORD biBitCount; DWORD biCompression; DWORD biSizeImage; LONG biXPelsPerMeter; LONG biYPelsPerMeter; DWORD biClrUsed; DWORD biClrImportant; } BITMAPINFOHEADER, *LPBITMAPINFOHEADER; /* constants for the biCompression field */ #define BI_RGB 0L #define BI_RLE8 1L #define BI_RLE4 2L typedef struct { WORD bfType; DWORD bfSize; WORD bfReserved1; WORD bfReserved2; DWORD bfOffBits; } BITMAPFILEHEADER, *LPBITMAPFILEHEADER; #define GetRValue(cl) (((cl)>>0)&0xff) #define GetGValue(cl) (((cl)>>8)&0xff) #define GetBValue(cl) (((cl)>>16)&0xff) #ifndef min # define min(a, b) ((a)<(b)?(a):(b)) #endif #ifndef max # define max(a, b) ((a)>(b)?(a):(b)) #endif #endif // __WINDOWS_H