Annotation of os2sdk/demos/apps/terminal/term.h, revision 1.1.1.2

1.1       root        1: /*  term.h 
                      2:  */
                      3: 
                      4: /* index definitions for error messages array */
1.1.1.2 ! root        5: #define ERR_VIOGETCONFIG       0
        !             6: #define ERR_KBDSETSTATUS       1
1.1       root        7: #define ERR_OUTOFMEMORY                2
1.1.1.2 ! root        8: #define ERR_DOSCREATETHREAD    3
        !             9: #define ERR_DOSCLOSECOMPORT    4
1.1       root       10: #define        ERR_IOCTLSETDCB         5
                     11: #define ERR_DOSREAD            6
                     12: #define ERR_VIOWRTTTY          7
1.1.1.2 ! root       13: #define ERR_DOSOPEN            8
1.1       root       14: #define ERR_IOCTLSETBAUD       9
                     15: #define        ERR_IOCTLSETLINECHAR   10
                     16: #define ERR_IOCTLGETDCB               11
                     17: #define ERR_KBDCHARIN         12
1.1.1.2 ! root       18: #define ERR_DOSWRITE          13
1.1       root       19: #define ERR_VIOWRTCHARSTRATT   14
                     20: #define ERR_VIOWRTNCELL        15
                     21: #define ERR_DOSEXITLIST        16
                     22: #define ERR_VIOSETCURPOS       17
1.1.1.2 ! root       23: #define ERR_VIOGETMODE        18
1.1       root       24: #define ERR_IOCTLFLUSHQUE      19      
                     25: #define ERR_IOCTLGETCOMERROR   20 
                     26: #define ERR_DOSSETSIGHANDLER   21
                     27: #define ERR_IOCTLSETBREAKON    22
                     28: #define ERR_IOCTLSETBREAKOFF   23
                     29: #define ERR_INVALIDSIGNAL      24
                     30: #define ERR_DO_OPT_INVOPT      25
                     31: #define ERR_MOD_OPT_INVOPT     26
                     32: #define ERR_SHOW_OPT_INVOPT    27
                     33: 
                     34: #define NUM_MSG                       28       /* total number of error messages */
                     35: 
                     36: #define NO_RETCODE            -1       /* indicate no returncode */
                     37: /* keyboard definitions */
                     38: #define        ENTER_KEY       0x0D00
                     39: #define        UP_KEY          0x0048
                     40: #define        DOWN_KEY        0x0050
                     41: #define        LEFT_KEY        0x004B
                     42: #define        RIGHT_KEY       0x004D
                     43: #define        DEL_KEY         0x0053
                     44: #define        BKSP_KEY        0x0800
                     45: #define        HOME_KEY        0x0047
                     46: #define DEL_SCAN       83      /* scan code DELETE key */
                     47: #define DEL_ASCII      127     /* ascii code for DELETE */
                     48: #define ALT_F1         104     /* scan code for ALT F1 */
                     49: 
                     50: /* attribute definitions */
                     51: #define BLACK          0
                     52: #define BLUE           1
                     53: #define GREEN          2
                     54: #define CYAN           3
                     55: #define RED            4
                     56: #define MAGENTA                5
                     57: #define YELLOW         6
                     58: #define WHITE          7
                     59: #define BRIGHT         8
                     60: 
                     61: /* attr - compute a character attribute
                     62:  * ENTRY:      f = foreground attribute
                     63:  *             b = backround attribute
                     64:  * EXIT:       returns combined  attribute
                     65:  */
                     66: 
                     67: #define ATTR(f,b)  ((b)<<4) + (f)
                     68: 
                     69: #define COLOR_PANEL  ATTR(BLUE,WHITE)
                     70: #define COLOR_OPTION ATTR(RED,WHITE)
                     71: #define COLOR_CURSOR ATTR(WHITE,RED)
                     72: 
                     73: #define MONO_PANEL   0x70
                     74: #define MONO_OPTION  0x70
                     75: #define MONO_CURSOR  0x07
                     76: 
                     77: /* index values for the option array */
                     78: #define        PORT_NAME       0
                     79: #define BAUD_RATE      1
                     80: #define        DATA_BITS       2
                     81: #define        STOP_BITS       3
                     82: #define        PARITY          4
                     83: #define        CONNECT         5
                     84: #define        DIAL_TYPE       6
                     85: #define        WAIT_TONE       7
                     86: #define        WAIT_CARRIER    8
                     87: #define        PHONE_NUMBER    9
                     88: #define        SETUP_FILE      10
                     89: 
                     90: /* IOCTL category and functions */
                     91: #define SERIAL         1       /* category: serial device control */
                     92: #define SETBAUD                0x41    /* function: set baud rate */
                     93: #define SETLINECHAR     0x42    /* function: set line characteristics */
                     94: #define GETDCB         0x73    /* function: get device control block */
                     95: #define SETDCB         0x53    /* function: set device control block */
                     96: #define ENBL_XON_XOFF   0x03   /* enable auto transmit & receive flow cntl */
                     97: #define        GENERIC         11      /* category: generic device control commands */
                     98: #define GETCOMERROR     0x6d    /* function: retrieve & clear COM error info */
                     99: #define FLUSHINPUT     1       /* function: flush input buffer */
                    100: #define FLUSHOUTPUT    2       /* function: flush output buffer */
                    101: #define GETNUMCHARS     0x68   /* function: get number of chars in recv que */
                    102: #define FLUSH_CMDINFO   0      /* command information for FLUSH INPUT/OUTPUT*/
                    103: #define SETBREAKON      0x4b    /* function: set break on */
                    104: #define SETBREAKOFF     0x45    /* function: set break off */
                    105: 
1.1.1.2 ! root      106: /* miscellaneous definitions */
1.1       root      107: #define RESERVED       0       /* reserved word */
                    108: #define MONOCHROME     0       /* monochrome adapter, monochrome display */
                    109: #define STACKSIZE      4096    /* size of stack to allocate for threads */
                    110: #define        IOWAIT          0       /* wait */
                    111: #define KBD_BITMASK    0x0006  /* bit mask for the KbdSetStatus call */
                    112: #define INBUFLENGTH    2048    /* length of input buffer */
                    113: #define BREAK          4       /* signal number for BREAK signal */
                    114: #define RECV_CTRL       2      /* signal handler should receive control */
                    115: #define READTIMEOUT     4000    /* time out for com port in .01 sec units */
                    116: #define DISABLE_SIGNALS 1      /* disable signals */
                    117: #define ENABLE_SIGNALS  0       /* enable signals */
                    118: #define ADD_ADDR        1       /* DOSEXITLIST function request code */
                    119: #define XFER           3       /* DOSEXITLIST function request code */
                    120: 
                    121: /* modem related definitions */
                    122: 
                    123: #define        NUM_RETRY       1       /* no. times to retry modem connection */
                    124: 
                    125: /* modem commands */
                    126: #define MC_INIT         0
                    127: #define MC_ATTN         1
                    128: #define MC_ESC          2
                    129: #define MC_ONHOOK       3
                    130: #define MC_OFFHOOK      4
                    131: #define MC_RESET        5
                    132: #define MC_DIAL       128       /* special command for dialing */
                    133: 
                    134: #define B_PAUSE       0x20      /* a pause in a modem command */
                    135: 
                    136: /* modem status values */
                    137: #define MS_OK           0       /* modem operation was successful */
                    138: #define MS_CONNECT      1       /* a connection was made */
                    139: #define MS_RING         2       /* a ring was detected */
                    140: #define MS_NOCARRIER    3       /* no carrier was detected */
                    141: #define MS_ERROR        4       /* a command error was detected */
                    142: #define MS_CONNECT1200  5      /* a connection was established at 1200bps*/
                    143: #define MS_NODIALTONE   6      /*dialtone not detected within time in reg S7*/
                    144: #define MS_BUSY                7       /* a busy signal was detected */
                    145: 
                    146: #define MS_NOREPLY      8       /* no reply was recieved from the modem */
                    147: #define OT_FAILURE      9      /* other modem connection failure */
                    148: 
                    149: /* connection: modem/computer */
                    150: #define MODEM          1
                    151: #define COMPUTER       2
                    152: 
                    153: /* dial type: tone/pulse */
                    154: #define TONE           1
                    155: #define PULSE          2
                    156: 
                    157: /* parity: even/odd/none */
                    158: #define EVEN           2
                    159: #define ODD            1
                    160: #define NONE           0
                    161: 
                    162: 
                    163: /*** type definitions ***/
                    164: 
                    165: typedef struct {
                    166:   unsigned char   ch;  /* character */
                    167:   unsigned char   at;  /* attribute */
                    168: } Cell;
                    169: 
                    170: typedef struct LineChar {                      /* line characteristics */
                    171:   unsigned char        DataBits;
                    172:   unsigned char        Parity;
                    173:   unsigned char        StopBits;
                    174: } structLineChar;
                    175: 
                    176: typedef        struct DCB {            /* device control block information */
                    177:   unsigned     WriteTimeOut;
                    178:   unsigned     ReadTimeOut;
                    179:   unsigned char Flags1;
                    180:   unsigned char        Flags2;
                    181:   unsigned char        Flags3;
                    182:   char         ErrRepChar;
                    183:   char         BrkRepChar;
                    184:   char         XONchar;
                    185:   char         XOFFchar;
                    186: } structDCB;
                    187: 
                    188: typedef        struct ComOptions {             /* structure to hold com port options */
                    189:   char         *pPortName;     /* port name char-string */
                    190:   int          iBaudRate;      /* baud rte */
                    191:   char         chDataBits,     /* number of databits */
                    192:                chStopBits,     /* number of stopbits */
                    193:                chParity;       /* parity */
                    194: } structComOptions;
                    195: 
                    196: typedef struct ModemOptions {          /* structure to hold modem options */
                    197:   unsigned char chDialType;    /* dial type */
                    198:   int          iWaitTone,      /* seconds modem should wait for dial tone */
                    199:                iWaitCarrier;   /* seconds modem should wait for carrier */
                    200:   char         *pPhoneNumber;  /* phone number char-string */
                    201: } structModemOptions;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.