Newer
Older
Microsoft / ice / ICE_DEFS.H
@tundra tundra on 24 May 2012 10 KB Initial revision
/*  ICE_DEFS.H -    IceScreen Definitions, Global Variables, Etc.

                    Last Modified: 06-06-90
                    Copyright (C) 1988, 1989, 1990 by T.A. Daneliuk
*/


/*========================== DEBUGGING OPTIONS ===============================*/

#define     DEBUG       0                   /* Set To 1 To Enable Debugging   */


/*=========================== PROGRAM DEFINITIONS ============================*/

#define	PROGNAME       "IceScreen"
#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                   */


/*=============== MISC. CONSTANTS DEFINITIONS & TYPEDEFS =====================*/

#define     FALSE       0
#define     TRUE        !FALSE

#ifndef     BOOL 
typedef     int         BOOL;               /* Boolean Datatype               */
#endif

#if     PCDOS & PC_BIOS

#define                 CUROFF              32,7        /* Cursor Settings    */
#define                 CURSML              6,7
#define                 CURBLK              0,7

typedef        short    VCOORD;             /* Screen Coordinates             */
typedef        short    VATRB;              /* Video Attribute                */
typedef        short    VMODE;              /* Video Mode                     */
typedef        short    VPAGE;              /* Video Page                     */
typedef unsigned char   KEYSTR;             /* Keystroke                      */
typedef unsigned int    VALCODE;            /* Character Validation Code      */
typedef unsigned char   ICE_ERROR;          /* Internal Error Code            */
typedef unsigned char   F_TYPE;             /* Field Type Codes               */
typedef int             FLEN;               /* Field Length                   */

#endif


/*=================== SCREEN AND FIELD CONTROL STRUCTURES ====================*/


struct ICE_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 ICE_FIELD *x);        /* See Below     */
        void        (*flderr) (struct ICE_FIELD *x, ICE_ERROR y, char *z);
#else
        char        *(*rvalid) ();      /* Whole Field Validation Function    */
        void        (*flderr) ();       /* Pointer To Error Handler           */
#endif

        struct      ICE_SCRN *rhelp;    /* Pointer To Help Screen Structure   */
        BOOL        rskp;               /* TRUE Means Autoskip On             */
};


struct ICE_SCRN                         /* SCREEN Control Structure */
{
        void        (* before) ();      /* Do This Before Using Screen        */
        void        (* after)  ();      /* Do This Before Exiting Screen      */
        struct ICE_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     ICE_LITERAL_L   'x'             /* No Character Validation        */
#define     ICE_LITERAL_U   'X'
#define     ICE_LITERAL_N   'j'

#define     ICE_ALPHA_L     'a'             /* Alphabetic Only                */
#define     ICE_ALPHA_U     'A'
#define     ICE_ALPHA_N     'k'

#define     ICE_ALPHANUM_L  'n'             /* Alphanumeric Only              */
#define     ICE_ALPHANUM_U  'N'
#define     ICE_ALPHANUM_N  'l'

#define     ICE_BINARY      'b'             /* Binary Digits Only             */
#define     ICE_OCTAL       'o'             /* Octal Digits Only              */
#define     ICE_DECIMAL     'd'             /* Decimal Digits Only            */
#define     ICE_HEX_L       'h'             /* Hex Digits Only                */
#define     ICE_HEX_U       'H'
#define     ICE_HEX_N       'u'
#define     ICE_FLOATING    'f'             /* Floating Point Digits Only     */
#define     ICE_SCIENT_L    's'             /* Scientific Digits Only         */
#define     ICE_SCIENT_U    'S'
#define     ICE_SCIENT_N    'v'
#define     ICE_FINANCIAL   '$'             /* Financial Digits Only          */
#define     ICE_YN_L        'y'             /* Yes/No                         */
#define     ICE_YN_U        'Y'
#define     ICE_YN_N        'w'

#define     ICE_LIST0       '0'             /* Literal Lists                  */
#define     ICE_LIST1       '1'
#define     ICE_LIST2       '2'
#define     ICE_LIST3       '3'
#define     ICE_LIST4       '4'
#define     ICE_LIST5       '5'
#define     ICE_LIST6       '6'
#define     ICE_LIST7       '7'
#define     ICE_LIST8       '8'
#define     ICE_LIST9       '9'


/*=================== INTERNAL CONTROL CODE MAPPINGS ========================*/

/* Screen Control Codes */

#define     HELP            0
#define     NXT_FLD         1
#define     PRV_FLD         2
#define     FST_FLD         3
#define     LST_FLD         4
#define     SCR_DONE        5

/* Field Control Codes */

#define     CUR_LEFT        6
#define     CUR_RIGHT       7
#define     CUR_UP          8
#define     CUR_DOWN        9
#define     CUR_PG_UP       10
#define     CUR_PG_DOWN     11
#define     CUR_BGN_LIN     12
#define     CUR_END_LIN     13
#define     CUR_BGN_FLD     14
#define     CUR_END_FLD     15
#define     CLR_FLD         16
#define     CLR_TO_END      17
#define     CANCEL_EDIT     18
#define     INSERT          19
#define     DELETE          20
#define     BS              21
#define     FLD_DONE        22

/*=================== INTERNAL ERROR AND STATUS CODES =======================*/


#define ICE_NOERR     (ICE_ERROR) 0                      /* No Error          */
#define ICE_ENOTRES   (ICE_ERROR) 1                      /* No Response Allow */
#define ICE_EFNULL    (ICE_ERROR) 3                      /* Null Array In Fld.*/
#define ICE_EBAD_CTRL (ICE_ERROR) 4                      /* Bad Keybd. Ctrl.  */
#define ICE_NULFPTR   (ICE_ERROR) 5                      /* Null Fld. Ptr.    */
#define ICE_MUSTFIL   (ICE_ERROR) 6                      /* Must Fill Error   */
#define ICE_RESREQD   (ICE_ERROR) 7                      /* RReqd. Error      */
#define ICE_IEUVALID  (ICE_ERROR) 8                      /* User Valid. Error */
#define ICE_NOMEM     (ICE_ERROR) 9                      /* Out Of Memory     */

/*======================== FUNCTION DECLARATIONS =============================*/


#if     ANSI

               /*** GENERIC IceScreen FUNCTIONS ***/

void            ice_sound(int x, int y);
void            ice_cursor(unsigned char x, unsigned char y);
unsigned long   ice_rdcursor(void);
void            ice_rowcol(VCOORD y, VCOORD x);
void            ice_cls(VATRB x);
KEYSTR          ice_getc(void);
void            ice_aputs(char *x, VATRB y);
KEYSTR          ice_keyin(void);
ICE_ERROR       ice_fedit(struct ICE_FIELD *x, KEYSTR *y);
void            ice_fdsply(struct ICE_FIELD *x, BOOL y, FLEN z);

#else
               /*** GENERIC IceScreen FUNCTIONS ***/

void            ice_sound();
void            ice_cursor();
unsigned long   ice_rdcursor();
void            ice_rowcol();
void            ice_cls();
KEYSTR          ice_getc();
void            ice_aputs();
KEYSTR          ice_keyin();
ICE_ERROR       ice_fedit();
void            ice_fdsply();

#endif

/*=====================END OF <ICE_DEFS.H> INSERT DECK =======================*/