/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * E U R O G A M H I G H V O L T A G E C O N T R O L * * * * File: gdefs.h * * * * Purpose: General constants and types * * * * Author(s): Jomar Honsi Date: 18/03/91 * * * * Revision record: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef INCdefs #define INCdefs /* Memory alloctation trick (ref. dutch guru Andrew Tanenbaum). ** "EXTERN" declared variables will be allocated ** when ALLOC is defined. This should be done in ONE ** AND ONLY ONE file. Similarly for SHARED variables ** using SALLOC and SEXTERN. */ /* scope control definitions */ #define SHARED /* Shared between tasks JH: 01/12/90 */ #define PUBLIC /* Global within one task */ #define PRIVATE static /* Local to a file */ #define FORWARD #ifdef ALLOC #define EXTERN #define SET(m) =m #define D , #else #define EXTERN extern #define SET(m) #define D #endif #ifdef SALLOC #define SEXTERN #else #define SEXTERN extern #endif #ifndef UNIX #define CPU MC68030 #define SCREEN VT100 #include #include #endif #include #include #include #include #include #define NAMELEN 48 /* Slight adaptation !! */ #define toLower(c) ( isupper((c)) ? ((c)|0x20):(c) ) #define toUpper(c) ( islower((c)) ? ((c)&0xDF):(c) ) /* ASCII character values */ #define BEL 7 #define BS 8 #define TAB 9 #define LF 10 #define FF 12 #define ESC 27 #define DEL 127 #define CTRL(x) (x&0x1F) /* utility constants */ #ifndef TRUE #define TRUE (Bool)1 #define FALSE (Bool)0 #endif #ifndef ERROR #define ERROR (-1) #define OK 0 #endif #define DUMMY 0 /* bit manipulation macros */ #define bitset(w,n) ((w)|=1<<(n)) #define bitclr(w,n) ((w)&=~(1<<(n))) #define bittst(w,n) ( ( (w)&(1<<(n))) != 0 ) #define diff(a,b) ( (a)>(b) ? (a-b) : (b-a) ) #define until(expr) while(!(expr)) /* Convenience data types */ typedef void (*Fnptr)(); typedef short Count; /* GP counter */ typedef short Status; /* General status type */ typedef unsigned long Ulong; typedef unsigned short Ushort, Bool; typedef unsigned char Byte, Uchar, Tbool; #ifndef UNIX typedef volatile Byte IoReg; typedef Byte *LVMEadr; /* Long VME address (32 bit) */ #endif typedef unsigned short SVMEadr; /* Short VME address (16 bit) */ enum {BYTE_ADR=0, SHORT_ADR, LONG_ADR}; /* For use with address test */ enum {READ_TEST=0, WRITE_TEST}; #define nElem(arr) ( sizeof((arr))/sizeof(*(arr)) ) #include "gtime.h" #endif