// common.h
//
// common definitions
#ifndef common_h
#define common_h
// basic type definitions.
typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned long dword;
typedef char * string;
// basic class for lptr's - pointers comprised of a segment and offset.
// the intention is that addresses are well defined within Borg. So comparison
// operators exist in a well defined way. Addresses are not converted to 32 bit
// equivalents or whatever for this.
class lptr //Pointer Struct 32-bit.
{ public:
word segm; //segment
dword offs; //offset
public:
lptr(){};
lptr(word seg,dword off);
~lptr(){};
void assign(word seg,dword off);
bool between(const lptr& lwb,const lptr& upb);
bool operator==(const lptr& loc2);
bool operator<=(const lptr& loc2);
bool operator>=(const lptr& loc2);
bool operator<(const lptr& loc2);
bool operator>(const lptr& loc2);
bool operator!=(const lptr& loc2);
lptr operator+(dword offs2);
lptr& operator++(int x);
lptr& operator+=(dword offs2);
lptr operator-(dword offs2);
dword operator-(lptr& loc2);
};
// predefined null pointer.
extern const lptr nlptr;
extern HWND KBHand; // für nichtmodale Dialoge
extern HWND HelpShortcuts; // Tasten-Hilfe (later a dialog for modifying them)
// basic support functions
void cleanstring(char *str);
void demangle(char **nme);
BOOL getfiletoload(char *fname, UINT FNSize, UINT FilterID, UINT &Select); // FNSize in Chars
BOOL getfiletosave(char *fname, UINT FNSize, UINT FilterID, UINT &Select); // FNSize in Chars
#define nobreak // for continuing "case" branches
#define elemof(x) (sizeof(x)/sizeof(x[0])) // elements of array
#define charof(x) (sizeof(x)/sizeof(TCHAR)) // (Unicode) chars of a string
#define T TEXT // preambel for static text strings
//#define _CRTDBG_MAP_ALLOC
#ifdef _MFC_VER // only for Visual C++
#define strnicmp _strnicmp
#include <crtdbg.h>
// for finding (many!) heap leakage at end of program with VisualC
#ifdef _DEBUG
# define DEBUG_CLIENTBLOCK new(_CLIENT_BLOCK,__FILE__,__LINE__)
# define new DEBUG_CLIENTBLOCK
#endif
#endif //_MFC_VER
#endif
Vorgefundene Kodierung: UTF-8 | 0
|