home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / progut~1 / stdwin.zoo / h / vt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-17  |  3.4 KB  |  105 lines

  1. /* Definitions for VT package */
  2. /* $Header: vt.h,v 1.6 88/06/20 22:39:50 guido Exp $ */
  3.  
  4. /* WARNING: the cursor coordinate system is (row, col) here,
  5.    like in the ANSI escape sequences.
  6.    However, the origin is 0, and ranges are given in C style:
  7.    first, last+1. */
  8.  
  9. #ifndef tbool
  10. #define tbool char
  11. #endif
  12.  
  13. #define VTNARGS 10
  14.  
  15. /* Struct defining a VT window */
  16.  
  17. typedef struct _vt {
  18.     WINDOW *win;        /* Window used for display */
  19.     char **data;        /* Character data array [row][col] */
  20.     unsigned char **flags;    /* Corresponding flags per character */
  21.     short *llen;        /* Line length array */
  22.     short rows, cols;    /* Size of data matrix */
  23.     short cwidth, cheight;    /* Character cell size */
  24.     short cur_row, cur_col;    /* Cursor position */
  25.     short save_row, save_col;    /* Saved cursor position */
  26.     short scr_top, scr_bot;    /* Scrolling region */
  27.     short topterm;        /* Top line of emulated terminal */
  28.     short toscroll;        /* Delayed screen scrolling */
  29.     unsigned char gflags;    /* Global flags for inserted characters */
  30.     tbool insert:1;        /* Insert mode */
  31.     tbool keypadmode:1;    /* Send ESC O A for arrows, not ESC [ A */
  32.     tbool nlcr:1;        /* \n implies \r */
  33.     tbool lazy:1;        /* Delay output operations */
  34.     
  35.     /* State for the ANSI escape sequence interpreter */
  36.     
  37.     tbool modarg:1;        /* Parsing ESC '[' '?' ... */
  38.     char *(*action)();    /* Function to call for next input */
  39.     short *nextarg;        /* Points to current arg */
  40.     short args[VTNARGS];    /* Argument list */
  41.     
  42.     /* ANSI flags and modes */
  43.     
  44.     /* There ought to be an array of tab stops here... */
  45.     
  46. } VT;
  47.  
  48. /* Flags in gflags and flags array.
  49.    These correspond to the ANSI codes used in ESC [ ... m.
  50.    Not all are implemented! */
  51.  
  52. #define VT_BOLD        (1 << 1)
  53. #define VT_DIM        (1 << 2)
  54. #define VT_UNDERLINE    (1 << 4)
  55. #define VT_BLINK    (1 << 5)
  56. #define VT_INVERSE    (1 << 7)
  57.  
  58. /* Access macros */
  59.  
  60. #define vtcheight(vt)            ((vt)->cheight)
  61. #define vtcwidth(vt)            ((vt)->cwidth)
  62. #define vtwindow(vt)            ((vt)->win)
  63.  
  64. #define vtsetnlcr(vt, new_nlcr)        ((vt)->nlcr= (new_nlcr))
  65. #define vtsetlazy(vt, new_lazy)        ((vt)->lazy= (new_lazy))
  66. #define vtsetflags(vt, new_flags)    ((vt)->gflags= (new_flags))
  67. #define vtsetinsert(vt, new_insert)    ((vt)->insert= (new_insert))
  68.  
  69. /* Basic functions */
  70.  
  71. VT *vtopen ARGS((char *title, int rows, int cols, int save));
  72. void vtclose ARGS((VT *vt));
  73. void vtputstring ARGS((VT *vt, char *text, int len));
  74. void vtsetcursor ARGS((VT *vt, int row, int col));
  75. void vtreset ARGS((VT *vt));
  76. VT *vtfind ARGS((WINDOW *win));
  77.  
  78. /* Optional functions */
  79.  
  80. void vtansiputs ARGS((VT *vt, char *text, int len));
  81. void vtputs ARGS((VT *vt, char *text));
  82. bool vtresize ARGS((VT *vt, int rows, int cols, int save));
  83. bool vtautosize ARGS((VT *vt));
  84.  
  85. /* Functions used by the ANSI interface */
  86.  
  87. void vtresetattr ARGS((VT *vt));
  88. void vtsetattr ARGS((VT *vt, int bit));
  89. void vtsavecursor ARGS((VT *vt));
  90. void vtrestorecursor ARGS((VT *vt));
  91. void vtarrow ARGS((VT *vt, int code, int repeat));
  92. void vteolclear ARGS((VT *vt, int row, int col));
  93. void vteosclear ARGS((VT *vt, int row, int col));
  94. void vtlinefeed ARGS((VT *vt, int repeat));
  95. void vtrevlinefeed ARGS((VT *vt, int repeat));
  96. void vtinslines ARGS((VT *vt, int n));
  97. void vtdellines ARGS((VT *vt, int n));
  98. void vtscrollup ARGS((VT *vt, int r1, int r2, int n));
  99. void vtscrolldown ARGS((VT *vt, int r1, int r2, int n));
  100. void vtinschars ARGS((VT *vt, int n));
  101. void vtdelchars ARGS((VT *vt, int n));
  102. void vtsetscroll ARGS((VT *vt, int top, int bot));
  103. void vtsendid ARGS((VT *vt));
  104. void vtsendpos ARGS((VT *vt));
  105.