home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / UE311C.ZIP / DG10.C < prev    next >
C/C++ Source or Header  |  1991-10-11  |  4KB  |  209 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.         dg10eeop,
  73.         dg10beep,
  74.     dg10rev,
  75.     dg10cres
  76. #if    COLOR
  77.     , dg10fcol,
  78.     dg10bcol
  79. #endif
  80. };
  81.  
  82. #if    COLOR
  83. PASCAL NEAR dg10fcol(color)        /* set the current output color */
  84.  
  85. int color;    /* color to set */
  86.  
  87. {
  88.     if (color == cfcolor)
  89.         return;
  90.     ttputc(ESC);
  91.     ttputc(0101);
  92.     ttputc(ctrans[color]);
  93.     cfcolor = color;
  94. }
  95.  
  96. PASCAL NEAR dg10bcol(color)        /* set the current background color */
  97.  
  98. int color;    /* color to set */
  99.  
  100. {
  101.     if (color == cbcolor)
  102.         return;
  103.     ttputc(ESC);
  104.     ttputc(0102);
  105.     ttputc(ctrans[color]);
  106.         cbcolor = color;
  107. }
  108. #endif
  109.  
  110. PASCAL NEAR dg10move(row, col)
  111. {
  112.     ttputc(16);
  113.         ttputc(col);
  114.     ttputc(row);
  115. }
  116.  
  117. PASCAL NEAR dg10eeol()
  118. {
  119.         ttputc(11);
  120. }
  121.  
  122. PASCAL NEAR dg10eeop()
  123. {
  124. #if    COLOR
  125.     dg10fcol(gfcolor);
  126.     dg10bcol(gbcolor);
  127. #endif
  128.         ttputc(ESC);
  129.         ttputc(0106);
  130.         ttputc(0106);
  131. }
  132.  
  133. PASCAL NEAR dg10rev(state)        /* change reverse video state */
  134.  
  135. int state;    /* TRUE = reverse, FALSE = normal */
  136.  
  137. {
  138. #if    COLOR
  139.     if (state == TRUE) {
  140.         dg10fcol(0);
  141.         dg10bcol(7);
  142.     }
  143. #else
  144.     ttputc(ESC);
  145.     ttputc(state ? 0104: 0105);
  146. #endif
  147. }
  148.  
  149. PASCAL NEAR dg10cres()    /* change screen resolution */
  150.  
  151. {
  152.     return(TRUE);
  153. }
  154.  
  155. PASCAL NEAR spal()        /* change palette string */
  156.  
  157. {
  158.     /*    Does nothing here    */
  159. }
  160.  
  161. PASCAL NEAR dg10beep()
  162. {
  163.         ttputc(BEL);
  164.         ttflush();
  165. }
  166.  
  167. PASCAL NEAR dg10open()
  168. {
  169.     strcpy(sres, "NORMAL");
  170.     revexist = TRUE;
  171.         ttopen();
  172. }
  173.  
  174. PASCAL NEAR dg10close()
  175.  
  176. {
  177. #if    COLOR
  178.     dg10fcol(7);
  179.     dg10bcol(0);
  180. #endif
  181.     ttclose();
  182. }
  183.  
  184. PASCAL NEAR dg10kopen()
  185.  
  186. {
  187. }
  188.  
  189. PASCAL NEAR dg10kclose()
  190.  
  191. {
  192. }
  193.  
  194. #if    FLABEL
  195. PASCAL NEAR fnclabel(f, n)        /* label a function key */
  196.  
  197. int f,n;    /* default flag, numeric argument [unused] */
  198.  
  199. {
  200.     /* on machines with no function keys...don't bother */
  201.     return(TRUE);
  202. }
  203. #endif
  204. #else
  205. dg10hello()
  206. {
  207. }
  208. #endif
  209.