/* SD2_DEFS.H - ScreenDoor II Definitions, Global Variables, Etc. Last Modified: 08-11-88 Copyright (C) 1988, T.A. Daneliuk */ /*========================== DEBUGGING OPTIONS ===============================*/ #define DEBUG 0 /* Set To 1 To Enable Debugging */ /*=========================== PROGRAM DEFINITIONS ============================*/ #define PROGNAME "ScreenDoor II" #define VERSION "1.1" /*============================= COMPILER =====================================*/ #define MSC 1 /* Microsoft C */ #define TURBO 0 /* Borland TurboC */ #define PCCV 0 /* UNIX System V Compiler */ #define PCCB 0 /* UNIX BSD 4.x Compiler */ #define ANSI 1 /* Compiler is ANSI Compliant */ /*========================= PRESENTATION SERVICE =============================*/ #define PC_BIOS 1 /* IBM-PC Via Standard Bios */ #define PC_WIND 0 /* IBM-PC Via MS-Windows */ #define PC_OSPM 0 /* OS/2 Presentation Manager */ #define CURSES 0 /* UNIX Curses */ #define XWINDOWS 0 /* Generic X-Windows */ /*========================== OPERATING SYSTEM ================================*/ #define PCDOS 1 /* Standard PC-DOS */ #define OS_2 0 /* OS/2 */ #define UNIXV 0 /* UNIX System V.x */ #define UNIXB 0 /* UNIX BSD 4.x */ /*============== DIRECTLY MANAGE PHYSICAL SCREEN FOR NOW =====================*/ #if PC_BIOS & PCDOS #define sd2_sound pcbios_sound #define sd2_cursor pcbios_cursor #define sd2_rdcursor pcbios_rdcursor #define sd2_rowcol pcbios_rowcol #define sd2_cls pcbios_cls #define sd2_getc pcbios_getc #define sd2_aputs pcbios_aputs #define CUROFF 32,7 /* Cursor Settings */ #define CURSML 6,7 #define CURBLK 0,7 #endif /*===================== MISC. DEFINITIONS & TYPEDEFS =========================*/ #define FALSE 0 #define TRUE !FALSE #ifndef BOOL typedef int BOOL; /* Boolean Datatype */ #endif #if PCDOS & PC_BIOS typedef unsigned int VCOORD; /* Screen Coordinates */ typedef unsigned char VATRB; /* Video Attribute */ typedef unsigned char VMODE; /* Video Mode */ typedef unsigned char VPAGE; /* Video Page */ typedef unsigned char KEYSTR; /* Keystroke */ typedef unsigned int VALCODE; /* Character Validation Code */ typedef unsigned char ERRCODE; /* Internal Error Code */ typedef unsigned char F_TYPE; /* Field Type Codes */ typedef int FLEN; /* Field Length */ #endif /*=================== SCREEN AND FIELD CONTROL STRUCTURES ====================*/ struct SD2_FIELD /* FIELD Control Structure */ { /* Members Common Top Both Prompt And Response Field Types */ F_TYPE ftype; /* Field Type */ VCOORD frow; /* Field Vertical Position */ VCOORD fcol; /* Field Horizontal Position */ VATRB fattrib; /* Field Display Colors/Attributes */ KEYSTR * field; /* Array Containing Field Contents */ /* Members Response Field Screen Control */ FLEN rlen; /* Maximum Allowed User Response Len. */ VATRB rattrib; /* Input Colors/Attributes */ VATRB cattrib; /* Attribute To Use When Clearing */ KEYSTR rfill; /* Keyin Time Fill Character */ KEYSTR rclear; /* Character To Use When Clearing */ /* Members For Single Character Validation */ BOOL rspace; /* TRUE Allows Blanks In Response */ KEYSTR * mask; /* Character Validation Mask */ KEYSTR ** v_lists; /* Array Of Char. Val. Strings */ /* Members For Full Field Validation, Error Handling, Help, And Autoskip */ BOOL rmustfill; /* TRUE Means Field Must Be Filled */ BOOL rreqd; /* TRUE Means A Response Is Required */ #if ANSI char *(*rvalid) (struct SD2_FIELD *x); /* See Below */ void (*flderr) (struct SD2_FIELD *x, ERRCODE y, char *z); #else char *(*rvalid) (); /* Whole Field Validation Function */ void (*flderr) (); /* Pointer To Error Handler */ #endif struct SD2_SCRN *rhelp; /* Pointer To Help Screen Structure */ BOOL rskp; /* TRUE Means Autoskip On */ }; struct SD2_SCRN /* SCREEN Control Structure */ { void (* before) (); /* Do This Before Using Screen */ void (* after) (); /* Do This Before Exiting Screen */ struct SD2_FIELD *fields; /* Fields Present On This Screen */ VATRB clr; /* Attribute To Use During Screen Clr.*/ char autoborder; /* Automatically Border The Screen? */ }; /*============================= FIELD TYPES ==================================*/ #define FLD_PROMPT 0 #define FLD_RESP 1 /*======================= CHARACTER VALIDATION CODES =========================*/ #define SD2_LITERAL_L 'x' /* No Character Validation */ #define SD2_LITERAL_U 'X' #define SD2_LITERAL_N 'j' #define SD2_ALPHA_L 'a' /* Alphabetic Only */ #define SD2_ALPHA_U 'A' #define SD2_ALPHA_N 'k' #define SD2_ALPHANUM_L 'n' /* Alphanumeric Only */ #define SD2_ALPHANUM_U 'N' #define SD2_ALPHANUM_N 'l' #define SD2_BINARY 'b' /* Binary Digits Only */ #define SD2_OCTAL 'o' /* Octal Digits Only */ #define SD2_DECIMAL 'd' /* Decimal Digits Only */ #define SD2_HEX_L 'h' /* Hex Digits Only */ #define SD2_HEX_U 'H' #define SD2_HEX_N 'u' #define SD2_FLOATING 'f' /* Floating Point Digits Only */ #define SD2_SCIENT_L 's' /* Scientific Digits Only */ #define SD2_SCIENT_U 'S' #define SD2_SCIENT_N 'v' #define SD2_FINANCIAL '$' /* Financial Digits Only */ #define SD2_YN_L 'y' /* Yes/No */ #define SD2_YN_U 'Y' #define SD2_YN_N 'w' #define SD2_LIST0 '0' /* Literal Lists */ #define SD2_LIST1 '1' #define SD2_LIST2 '2' #define SD2_LIST3 '3' #define SD2_LIST4 '4' #define SD2_LIST5 '5' #define SD2_LIST6 '6' #define SD2_LIST7 '7' #define SD2_LIST8 '8' #define SD2_LIST9 '9' /*============ KEY MAP, CONTROL KEY, AND INTERNAL ERROR DEFINITIONS ==========*/ /* Offsets Into sd2_ctrl_codes Array Where These Internal Codes Can Be Found */ #define IENO_ERR 0 /* No Error Status Return Code */ #define NXT_FLD 1 /* Inter-Field Control */ #define PRV_FLD 2 #define FST_FLD 3 #define LST_FLD 4 #define CUR_LFT 5 /* Intra-Field Control */ #define CUR_RGT 6 #define BEG_FLD 7 #define END_FLD 8 #define CLR_FLD 9 #define CLR_END 10 #define EXT_FLD 11 #define INS 12 #define DEL 13 #define BS 14 #define HELP 15 #define EXT_SCR 16 /* Window/Screen Control */ #define IEBAD_CTRL 17 /* Internal Error Code Positions */ #define IENOTRES 18 #define IEFNULL 19 #define IENUL_FPTR 20 #define IEMUST_FIL 21 #define IERES_REQD 22 #define IE_UVALID 23 #define C_XLATE 24 /* # Of Internal Control Codes */ #define CTRL_SIZE 2 /* Max Length Of Control String */ #define CTRL_ENTRY C_XLATE*3 /* # Of Control Key Translations */ #define K_XLATE ((unsigned) ((KEYSTR) -1))+1 /* # Of Unique Key Vals. */ struct CXLATE { /* Control Key Translation Entry */ unsigned int length; /* Length Of Input String */ KEYSTR ctrlin[CTRL_SIZE]; /* Input String */ unsigned int sd_ctrl; /* Index To sd2_ctrl_codes*/ }; extern KEYSTR sd2_ctrl_codes[]; /* Declare Global Tables */ extern struct CXLATE ctrl_xlate[]; extern KEYSTR key_xlate[]; /*==================== INTERNAL KEY & ERROR CONTROL CODES ====================*/ #define NXTFLD sd2_ctrl_codes[NXT_FLD] /* Control Codes */ #define PRVFLD sd2_ctrl_codes[PRV_FLD] #define FSTFLD sd2_ctrl_codes[FST_FLD] #define LSTFLD sd2_ctrl_codes[LST_FLD] #define CURLFT sd2_ctrl_codes[CUR_LFT] #define CURRGT sd2_ctrl_codes[CUR_RGT] #define BEGFLD sd2_ctrl_codes[BEG_FLD] #define ENDFLD sd2_ctrl_codes[END_FLD] #define CLRFLD sd2_ctrl_codes[CLR_FLD] #define CLREND sd2_ctrl_codes[CLR_END] #define EXTFLD sd2_ctrl_codes[EXT_FLD] #define INSERT sd2_ctrl_codes[INS] #define DELETE sd2_ctrl_codes[DEL] #define BKSPC sd2_ctrl_codes[BS] #define HELPKEY sd2_ctrl_codes[HELP] #define EXTSCR sd2_ctrl_codes[EXT_SCR] /* INTERNAL ERROR AND STATUS CODES */ #define SD2_NOERR (ERRCODE) sd2_ctrl_codes[IENO_ERR] /* No Error */ #define SD2_ENOTRES (ERRCODE) sd2_ctrl_codes[IENOTRES] /* No Response Allow */ #define SD2_EFNULL (ERRCODE) sd2_ctrl_codes[IEFNULL] /* Null Array In Fld.*/ #define SD2_EBAD_CTRL (ERRCODE) sd2_ctrl_codes[IEBAD_CTRL] /* Bad Keybd. Ctrl.*/ #define SD2_NULFPTR (ERRCODE) sd2_ctrl_codes[IENUL_FPTR] /* Null Fld. Ptr. */ #define SD2_MUSTFIL (ERRCODE) sd2_ctrl_codes[IEMUST_FIL] /* Must Fill Error */ #define SD2_RESREQD (ERRCODE) sd2_ctrl_codes[IERES_REQD] /* RReqd. Error */ #define SD2_IEUVALID (ERRCODE) sd2_ctrl_codes[IE_UVALID] /* User Valid. Error*/ /*======================== FUNCTION DECLARATIONS =============================*/ #if ANSI /*** GENERIC ScreenDoor FUNCTIONS ***/ void sd2_sound(int x, int y); void sd2_cursor(unsigned char x, unsigned char y); unsigned long sd2_rdcursor(void); unsigned long sd2_rowcol(VCOORD y, VCOORD x); void sd2_cls(VATRB x); KEYSTR sd2_getc(void); unsigned int sd2_aputs(char *x, VATRB y); #if PC_BIOS & PCDOS void pcbios_getvmode(void); void pcbios_setvmode(VMODE x); void pcbios_setvpage(VPAGE x); #endif KEYSTR sd2_keyin(void); ERRCODE sd2_init(char *x); ERRCODE sd2_fedit(struct SD2_FIELD *x, KEYSTR *y); void sd2_fdsply(struct SD2_FIELD *x, BOOL y, FLEN z); void sd2_help(struct SD2_SCRN *x); #else /*** GENERIC ScreenDoor FUNCTIONS ***/ void sd2_sound(); void sd2_cursor(); unsigned long sd2_rdcursor(); unsigned long sd2_rowcol(); void sd2_cls(); KEYSTR sd2_getc(); unsigned int sd2_aputs(); #if PCDOS & PC_BIOS void pcbios_getvmode(); void pcbios_setvmode(); void pcbios_setvpage(); #endif KEYSTR sd2_keyin(); ERRCODE sd2_init(); ERRCODE sd2_fedit(); void sd2_fdsply(); void sd2_help(); #endif /*=====================END OF <SD2_DEFS.H> INSERT DECK =======================*/