This file is a utility module containing useful macros and functions. It's generally used to replace Windows headers, though it doesn't include windows.h, but rather a very slim subset containing only basic simple and compound data types. It also contains a structure for implementing abstract data streams.
|
Data Structures |
| struct | XFORMDBL |
| struct | RTL_BITMAP |
| | 32-bit bit vector structure. More...
|
| struct | IOSTRUCT |
| | Structure for an abstract data stream, which can be a file, a memory block, a network resource, etc. More...
|
Defines |
| #define | floor floor |
| #define | sqrt sqrt |
| #define | XFORM XFORMDBL |
| #define | LPXFORM XFORMDBL * |
| #define | ANSI_VAR_FONT DEFAULT_GUI_FONT |
| #define | GetAValue(c) ((BYTE)((c)>>24)) |
| | Returns the alpha component of a 32-bit color.
|
| #define | AddPtr(t, p, b) ((t)( ((LONG_PTR)(p))+((LONG_PTR)(b)) )) |
| | Adds to the pointer _p_ by _b_ bytes and casts it to _t_.
|
| #define | DiffPtr(t, p, b) ((t)( ((LONG_PTR)(p))-((LONG_PTR)(b)) )) |
| | Subtracts the pointer _p_ by _b_ bytes and casts it to _t_.
|
| #define | RectWidth(rc) ((rc)->right-(rc)->left) |
| | Returns the width of a rectangle.
|
| #define | RectHeight(rc) ((rc)->bottom-(rc)->top) |
| | Returns the height of a rectangle.
|
| #define | SetRect(rc, x, y, x1, y1) |
| #define | IsRectEmpty(rc) ((rc)->left>=(rc)->right||(rc)->top>=(rc)->bottom) |
| #define | SetRectEmpty(rc) (rc)->left=(rc)->right=(rc)->top=(rc)->bottom=0 |
| #define | OffsetRect(rc, x, y) |
| #define | InflateRect(rc, x, y) |
| #define | SetFrame(rc, x, y, cx, cy) |
| #define | PointInRect(rc, x, y) |
| #define | TransformSetIdentity(m) |
| #define | TOBOOL(x) ((BOOL)((!!(x))?1:0)) |
| | Returns 1 if _x_ is nonzero, or 0 otherwise.
|
| #define | DIMOF(x) (sizeof(x)/sizeof(x[0])) |
| | Returns the size of an array.
|
| #define | MOD(i, n) ( (i) % (n) >= 0 ? (i) % (n) : (i) % (n) + (n) ) |
| | Returns the modulus of two numbers.
|
| #define | MS_NINT(x) ((x) >= 0.0 ? ((long) ((x)+.5)) : ((long) ((x)-.5))) |
| | Rounds a floating point number to the nearest integer.
|
| #define | MS_PI 3.14159265358979323846 |
| | Pi.
|
| #define | MS_3PI2 4.71238898038468985769 |
| | Pi times 1.5.
|
| #define | DEGTORAD 0.017453292519943295769236907684886 |
| | Multiply by this value to convert degrees to radians.
|
| #define | RADTODEG 57.295779513082320876798154814105 |
| | Multiply by this value to convert radians to degrees.
|
| #define | M_PITIMESTWO 6.283185307179586476925286766559 |
| | Pi times 2.
|
| #define | M_HALFPI 1.5707963267948966192313216916398 |
| | Pi divided by 2.
|
| #define | SQRT_2 1.4142135623730950488016887242097 |
| | Square root of 2.
|
| #define | RADTOGRAD 63.661977236758134307553505349006 |
| | Multiply by this value to convert radians to grad.
|
| #define | GRADTORAD 0.015707963267948966192313216916398 |
| | Multiply by this value to convert grad to radians.
|
| #define | ITEXTCONST(x) x |
| #define | ITEXT(x) x |
| #define | DebugOut |
| #define | DebugOutF |
| #define | ASSERT(x) |
| #define | __xmalloc(s) calloc(1,s) |
| #define | __malloc(s) malloc(s) |
| #define | __calloc(e, s) calloc(e,s) |
| #define | __realloc(p, s) realloc(p,s) |
| #define | __free(p) free(s) |
| #define | DebugMallocStatus() |
| #define | xmalloc(s) __xmalloc(s) |
| | Like malloc, but the allocated memory is initialized to zero.
|
| #define | RectMove(rc, xx, yy) |
| | Changes the top left corner of a rectangle to _xx_ and _yy_.
|
| #define | SWAPWORD(a) |
| | Swaps the byte order of a 16-bit integer.
|
| #define | SWAPDWORD(a) |
| | Swaps the byte order of a 32-bit integer.
|
| #define | FOURCC DWORD |
| #define | MAKEFOURCC(a, b, c, d) |
| #define | RGBA(a, b, c, d) |
| #define | max(a, b) ( ((a)>(b))?(a):(b) ) |
| #define | min(a, b) ( ((a)<(b))?(a):(b) ) |
| #define | abs(a) ( ((a)<0)?-(a):(a) ) |
| #define | BOUND(a, l, h) |
| #define | HISHORT(x) ((INT)(SHORT)HIWORD(x)) |
| #define | LOSHORT(x) ((INT)(SHORT)LOWORD(x)) |
| #define | MASK(Count, Shift) ((Count) == 32 ? 0xFFFFFFFF : ~(0xFFFFFFFF << (Count)) << (Shift)) |
| | Returns a bit mask with _Count_ bits and shifted left _Shift_ times.
|
| #define | SETBIT(DwordBuf, BitNumber) ((DwordBuf)[(BitNumber)>>5]|=(1<<((BitNumber)&0x1F))) |
| | Sets the bit numbered _BitNumber_ in a 32-bit bit vector (DwordBuf).
|
| #define | CLEARBIT(DwordBuf, BitNumber) ((DwordBuf)[(BitNumber)>>5]&=~(1<<((BitNumber)&0x1F))) |
| | Clears the bit numbered _BitNumber_ in a 32-bit bit vector (DwordBuf).
|
| #define | TESTBIT(DwordBuf, BitNumber) (((DwordBuf)[(BitNumber)>>5]&(1<<((BitNumber)&0x1F)))!=0) |
| | Returns TRUE if the bit numbered _BitNumber_ in a 32-bit bit vector (DwordBuf) is set.
|
| #define | INITBITS(bm, size) do{(bm)->SizeOfBitmap=size;(bm)->Buffer=xmalloc( ((bm)->SizeOfBitmap+7)>>3 );}while(0) |
| | Initializes the 32-bit bit vector (RTL_BITMAP) with the specified _size_ in bits.
|
| #define | CLEARBITS(bm) ZeroMemory((bm)->Buffer,((bm)->SizeOfBitmap+7)>>3) |
| | Clears all bits in the 32-bit bit vector (RTL_BITMAP).
|
| #define | SETBITS(bm) memset((bm)->Buffer,0xFF,((bm)->SizeOfBitmap+7)>>3) |
| | Sets all bits in the 32-bit bit vector (RTL_BITMAP).
|
| #define | FILE_READ 1 |
| | The file is opened for reading; the file must exist.
|
| #define | FILE_WRITE 0 |
| | The file is opened for writing; if the file exists, its contents are erased; if not, it is created.
|
| #define | FILE_APPEND 2 |
| | The file is opened for writing; if the file exists, its contents are preserved and the file pointer is moved at the end, but the file can be written anywhere by setting the file pointer; if the file doesn't exist, it is created.
|
| #define | FILE_READWRITE 3 |
| | The file is opened for reading and writing; the file must exist.
|
Typedefs |
| typedef struct RTL_BITMAP * | PRTL_BITMAP |
| typedef DWORD(* | IOPROC )(LPVOID h, LPVOID buffer, DWORD size) |
| | Procedure for reading or writing from a data stream.
|
| typedef IOPROC | WRITEPROC |
| typedef IOPROC | READPROC |
| typedef LPVOID(* | IOOPENPROC )(LPVOID file, int mode) |
| | Procedure for opening a data stream.
|
| typedef LONG(* | IOSEEKPROC )(LPVOID h, LONG seek, int whence) |
| | Procedure for seeking within a data stream.
|
| typedef BOOL(* | IOCLOSEPROC )(LPVOID h) |
| | Procedure for closing a data stream.
|
| typedef BOOL(* | IOFLUSHPROC )(LPVOID h) |
| | Procedure for flushing a data stream.
|
| typedef DWORD(* | IOGETSIZEPROC )(LPVOID h) |
| | Procedure for getting the size of a data stream.
|
| typedef BOOL(* | IOVALIDPROC )(LPVOID h) |
| | Procedure for determining whether a data stream handle is valid.
|