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