home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / cbw / part02 / terminal.h < prev    next >
Encoding:
C/C++ Source or Header  |  1987-06-16  |  4.8 KB  |  150 lines

  1. /*
  2.  * Definitions for terminals (symbols, graphics, keystroke, commands).
  3.  *
  4.  * Author: Bob Baldwin, October 1986.
  5.  */
  6.  
  7.  
  8. /* Names of shell variables for keystroke map and symbol map.
  9.  */
  10. #define    GRAPHICSVAR    "GRAPHICSMAP"
  11. #define    KEYMAPVAR    "KEYMAP"
  12.  
  13.  
  14. /* Screen control strings from termcap entry.
  15.  */
  16. extern    char    *term_is;        /* Terminal initializaion string. */
  17. extern    char    *erase_eol;        /* Erase to end of line. */
  18. extern    char    *erase_eos;        /* Erase to end of screen. */
  19. extern    char    *erase_scr;        /* Erase whole screen. */
  20. extern    char    *cm;            /* Cursor motion. */
  21. extern    char    *start_alt;        /* Start graphics mode. */
  22. extern    char    *end_alt;        /* End graphics mode. */
  23. extern    char    *start_so;        /* Start standout mode. */
  24. extern    char    *end_so;        /* End standout mode. */
  25. extern    char    *start_kp;        /* Start send keypad escapes. */
  26. extern    char    *end_kp;        /* End send keypad escapes. */
  27.  
  28. /* Keymap strings from termcap file.
  29.  */
  30. extern    char    *term_f1;        /* The f1 key. */
  31. extern    char    *term_f2;        /* The f2 key. */
  32. extern    char    *term_f3;        /* The f3 key. */
  33. extern    char    *term_f4;        /* The f4 key. */
  34. extern    char    *term_up;        /* Up arrow. */
  35. extern    char    *term_down;        /* Down arrow. */
  36. extern    char    *term_left;        /* Left arrow. */
  37. extern    char    *term_right;        /* Right arrow. */
  38.  
  39.  
  40. /* Flag values
  41.  */
  42. #define    CHARM        0377        /* Mask for 8 bit chars. */
  43. #define SYMBOL        128        /* OR'ed with symbol codes. */
  44. #define    SYMBOLM        (SYMBOL - 1)    /* Mask for symbol codes. */
  45.  
  46.  
  47. /* Symbol codes.
  48.  * These can be used as array indices if the SYMBOL bit is stripped.
  49.  */
  50. #define    STAB        (0 | SYMBOL)    /* Tab character. */
  51. #define    SNOTASCII    (1 | SYMBOL)    /* Byte with high bit set. */
  52. #define    SLINEFEED    (2 | SYMBOL)    /* Linefeed character. */
  53. #define    SCARETURN    (3 | SYMBOL)    /* Return character. */
  54. #define    SFORMFEED    (4 | SYMBOL)    /* Formfeed character. */
  55. #define    SCONTCODE    (5 | SYMBOL)    /* Other control characters. */
  56. #define    SUNKNOWN    (6 | SYMBOL)    /* Character decryption unknown. */
  57. #define    SUNDERLINE    (7 | SYMBOL)    /* Pseudo underline symbol, it */
  58.                         /* highlights char on prev line. */
  59. #define    SVERTBAR    (8 | SYMBOL)    /* Vertical bar. */
  60. #define    SHORZBAR    (9 | SYMBOL)    /* Horizontal bar. */
  61. #define    SLLCORNER    (10 | SYMBOL)    /* Lower-left corner. */
  62. #define    NSYMC         11        /* Number of symbol codes. */
  63.  
  64.  
  65. /* Default graphics settings, in the format of the shell variable.
  66.  * Extra spaces, tabs and colons are for testing.
  67.  * Entries are separated by spaces, tabs, or colons, and
  68.  * terminated by colon or NULL.
  69.  */
  70. #define    VARSEP        "\t \n:"
  71. #define    VARTERM        ":"
  72. #define    GVARMODES    "NGS"        /* From s_mode values */
  73. #define    DGRAPHICS    "tb=\\St:na=\\SX: lf=\\Sn:cr=\\Sr:    :\
  74.               ff=\\Sf:cc=\\SC:uk=\\S :::ul=\\N^:\
  75.               hb=\\N-:vb=\\N|:ll=\\N`"
  76.  
  77.  
  78. /* Structure of symbol to graphics table.
  79.  * The s_seq strings are allocated from the heap during init.
  80.  * The table graphtab is indexed by the symbol code.
  81.  */
  82. #define    SMNORMAL    'N'    /* Values for s_mode. */
  83. #define    SMGRAPHIC    'G'
  84. #define    SMSTANDOUT    'S'
  85. #define    symgraph    struct symgraphx
  86. symgraph    {
  87.     int    s_mode;            /* Symbol display mode. */
  88.     char    *s_seq;            /* Chars to send in that mode. */
  89. };
  90.  
  91.  
  92. /* Command codes.
  93.  * These are not intended to be used as array indices.
  94.  * Note problem with CNONE.
  95.  */
  96. #define    CMDSHIFT    8        /* Commands in high byte. */
  97. #define    CMDMASK        0377        /* Mask to get cmd code. */
  98. #define    CNONE        0        /* Not a command. */
  99. #define    CGO_UP        1        /* Sames as jogcursor() arg. */
  100. #define    CGO_DOWN    2
  101. #define    CGO_LEFT    3
  102. #define CGO_RIGHT    4
  103. #define    CREFRESH    5        /* Refresh screen. */
  104. #define    CUNDO        6        /* Undo guess. */
  105. #define    CCLRLINE    7        /* Clear whole line. */
  106. #define    CWRDSRCH    8        /* Search for word. */
  107. #define    CDELF        9        /* Delete forward. */
  108. #define    CDELB        10        /* Delete backward. */
  109. #define    CPREVBLOCK    11        /* Goto previous block. */
  110. #define CNEXTBLOCK    12        /* Goto next block. */
  111. #define    CNEXTGUESS    12        /* Next guess. */
  112. #define CNEXTARG    12        /* Goto next arg in template. */
  113. #define    CACCEPT        13        /* Accept guess. */
  114. #define    CEXECUTE    14        /* Execute a command. */
  115. #define    CRETURN        14        /* Insert a return char. */
  116. #define    CINSERT        15        /* Insert the arg char. */
  117. #define    CTRYALL        16        /* Try all chars here. */
  118. #define    CJUMPCMD    17        /* Jump to cmd line. */
  119.  
  120.  
  121. /* See cmdnames[] for a list of the field labels in the default keymap.
  122.  */
  123. #define    DKEYMAP        "ta=\024:up=\020:do=\016:le=\002:ri=\006:\
  124.               re=\014:un=\007:cl=\025:ws=\027:\
  125.               df=\\004:db=\177:jc=\030:ex=\\n:\
  126.               pr=\022:ne=\023:ac=\001"
  127.  
  128.  
  129. /* Structure of key command table.
  130.  * The c_seq strings are allocated from the heap during init.
  131.  */
  132. #define    keycmd    struct keycmdx
  133. keycmd    {
  134.     int    c_code;            /* Command code. */
  135.     char    *c_seq;            /* Chars in keystroke. */
  136. };
  137.  
  138.  
  139. /* Structure for parsing shell variables in a format like termcap.
  140.  * The last entry in a table of these has label == NULL.
  141.  */
  142. #define    labelv    struct    labelvx
  143. labelv    {
  144.     char    *label;        /* Label string. */
  145.     int    value;        /* Arbitrary value for label. */
  146. };
  147.  
  148.  
  149. #define    DIGITS    "0123456789"
  150.