home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / VILE327.ZIP / VILE327.TAR / vile3.27 / dg10.c < prev    next >
C/C++ Source or Header  |  1992-12-14  |  3KB  |  220 lines

  1. /*
  2.  * The routines in this file provide support for the Data General Model 10
  3.  * Microcomputer.
  4.  *
  5.  * $Log: dg10.c,v $
  6.  * Revision 1.4  1992/05/16  12:00:31  pgf
  7.  * prototypes/ansi/void-int stuff/microsoftC
  8.  *
  9.  * Revision 1.3  1991/09/10  01:19:35  pgf
  10.  * re-tabbed, and moved ESC and BEL to estruct.h
  11.  *
  12.  * Revision 1.2  1991/08/07  12:35:07  pgf
  13.  * added RCS log messages
  14.  *
  15.  * revision 1.1
  16.  * date: 1990/09/21 10:24:57;
  17.  * initial vile RCS revision
  18.  */
  19.  
  20. #define termdef 1            /* don't define "term" external */
  21.  
  22. #include    <stdio.h>
  23. #include    "estruct.h"
  24. #include    "edef.h"
  25.  
  26. #if    DG10
  27.  
  28. #define NROW    24            /* Screen size.         */
  29. #define NCOL    80            /* Edit if you want to.     */
  30. #define NPAUSE    100            /* # times thru update to pause */
  31. #define MARGIN    8            /* size of minimim margin and    */
  32. #define SCRSIZ    64            /* scroll size for extended lines */
  33. #define DG_ESC       30            /* DG10 ESC character.        */
  34.  
  35. extern    int    ttopen();        /* Forward references.        */
  36. extern    int    ttgetc();
  37. extern    int    ttputc();
  38. extern    int    ttflush();
  39. extern    int    ttclose();
  40. extern    int    dg10kopen();
  41. extern    int    dg10kclose();
  42. extern    int    dg10move();
  43. extern    int    dg10eeol();
  44. extern    int    dg10eeop();
  45. extern    int    dg10beep();
  46. extern    int    dg10open();
  47. extern    int    dg10rev();
  48. extern    int    dg10close();
  49. extern    int    dg10cres();
  50.  
  51. #if    COLOR
  52. extern    int    dg10fcol();
  53. extern    int    dg10bcol();
  54.  
  55. int    cfcolor = -1;        /* current forground color */
  56. int    cbcolor = -1;        /* current background color */
  57. int    ctrans[] = {        /* emacs -> DG10 color translation table */
  58.     0, 4, 2, 6, 1, 5, 3, 7};
  59. #endif
  60.  
  61. /*
  62.  * Standard terminal interface dispatch table. Most of the fields point into
  63.  * "termio" code.
  64.  */
  65. TERM    term    = {
  66.     NROW-1,
  67.     NROW-1,
  68.     NCOL,
  69.     NCOL,
  70.     MARGIN,
  71.     SCRSIZ,
  72.     NPAUSE,
  73.     dg10open,
  74.     dg10close,
  75.     dg10kopen,
  76.     dg10kclose,
  77.     ttgetc,
  78.     ttputc,
  79.     ttflush,
  80.     dg10move,
  81.     dg10eeol,
  82.     dg10eeop,
  83.     dg10beep,
  84.     dg10rev,
  85.     dg10cres
  86. #if    COLOR
  87.     , dg10fcol,
  88.     dg10bcol
  89. #endif
  90. };
  91.  
  92. #if    COLOR
  93. dg10fcol(color)     /* set the current output color */
  94.  
  95. int color;    /* color to set */
  96.  
  97. {
  98.     if (color == cfcolor)
  99.         return;
  100.     ttputc(DG_ESC);
  101.     ttputc(0101);
  102.     ttputc(ctrans[color]);
  103.     cfcolor = color;
  104. }
  105.  
  106. dg10bcol(color)     /* set the current background color */
  107.  
  108. int color;    /* color to set */
  109.  
  110. {
  111.     if (color == cbcolor)
  112.         return;
  113.     ttputc(DG_ESC);
  114.     ttputc(0102);
  115.     ttputc(ctrans[color]);
  116.     cbcolor = color;
  117. }
  118. #endif
  119.  
  120. dg10move(row, col)
  121. {
  122.     ttputc(16);
  123.     ttputc(col);
  124.     ttputc(row);
  125. }
  126.  
  127. dg10eeol()
  128. {
  129.     ttputc(11);
  130. }
  131.  
  132. dg10eeop()
  133. {
  134. #if    COLOR
  135.     dg10fcol(gfcolor);
  136.     dg10bcol(gbcolor);
  137. #endif
  138.     ttputc(DG_ESC);
  139.     ttputc(0106);
  140.     ttputc(0106);
  141. }
  142.  
  143. dg10rev(state)        /* change reverse video state */
  144.  
  145. int state;    /* TRUE = reverse, FALSE = normal */
  146.  
  147. {
  148. #if    COLOR
  149.     if (state == TRUE) {
  150.         dg10fcol(0);
  151.         dg10bcol(7);
  152.     }
  153. #else
  154.     ttputc(DG_ESC);
  155.     ttputc(state ? 0104: 0105);
  156. #endif
  157. }
  158.  
  159. dg10cres()    /* change screen resolution */
  160.  
  161. {
  162.     return(TRUE);
  163. }
  164.  
  165. spal()        /* change palette string */
  166.  
  167. {
  168.     /*    Does nothing here    */
  169. }
  170.  
  171. dg10beep()
  172. {
  173.     ttputc(BEL);
  174.     ttflush();
  175. }
  176.  
  177. dg10open()
  178. {
  179.     strcpy(sres, "NORMAL");
  180.     revexist = TRUE;
  181.     ttopen();
  182. }
  183.  
  184. dg10close()
  185.  
  186. {
  187. #if    COLOR
  188.     dg10fcol(7);
  189.     dg10bcol(0);
  190. #endif
  191.     ttclose();
  192. }
  193.  
  194. dg10kopen()
  195.  
  196. {
  197. }
  198.  
  199. dg10kclose()
  200.  
  201. {
  202. }
  203.  
  204. #if    FLABEL
  205. int
  206. fnclabel(f, n)        /* label a function key */
  207.  
  208. int f,n;    /* default flag, numeric argument [unused] */
  209.  
  210. {
  211.     /* on machines with no function keys...don't bother */
  212.     return(TRUE);
  213. }
  214. #endif
  215. #else
  216. dg10hello()
  217. {
  218. }
  219. #endif
  220.