home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 198_01 / dg10.c < prev    next >
C/C++ Source or Header  |  1990-01-23  |  4KB  |  206 lines

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