home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / editc80 / ed6.c < prev    next >
C/C++ Source or Header  |  1984-06-15  |  2KB  |  168 lines

  1. /*
  2. Screen editor:  terminal output module
  3. Source:  ed6.c
  4. This file was created by the configuration program:
  5. Version 2:  September 6, 1981.
  6. */
  7.  
  8. #include ed1.h
  9.  
  10. /*
  11. This I/O section is designed for multiple terminals.
  12. Include the following #define for VT100/ANSI escape
  13. sequences, and comment it out for VT52 escape sequences.
  14. */
  15.  
  16. #define VT100 
  17.  
  18. /*
  19. Define the current coordinates of the cursor.
  20. */
  21.  
  22. /*
  23. Return the current coordinates of the cursor.
  24. */
  25.  
  26. outgetx()
  27. {
  28.     return(outx);
  29. }
  30.  
  31. outgety()
  32. {
  33.     return(outy);
  34. }
  35.  
  36. /*
  37. Output one printable character to the screen.
  38. */
  39.  
  40. outchar(c) char c;
  41. {
  42.     syscout(c);
  43.     outx++;
  44.     return(c);
  45. }
  46.  
  47. /*
  48. Position cursor to position x,y on screen.
  49. 0,0 is the top left corner.
  50. */
  51.  
  52. outxy(x,y) int x,y;
  53. {
  54.     outx=x;
  55.     outy=y;
  56. #ifdef VT100
  57.     syscout(27);
  58.     syscout('[');
  59.     syscout(++y/10+'0');
  60.     syscout(y%10+'0');
  61.     syscout(';');
  62.     syscout(++x/10+'0');
  63.     syscout(x%10+'0');
  64.     syscout('H');
  65. #else
  66.     syscout(27);
  67.     syscout('Y');
  68.     syscout(y+32);
  69.     syscout(x+32);
  70. #endif
  71. }
  72.  
  73. /*
  74. Erase the entire screen.
  75. Make sure the rightmost column is erased.
  76. */
  77.  
  78. outclr()
  79. {
  80. #ifdef VT100
  81.     syscout(27);
  82.     syscout('[');
  83.     syscout('H');
  84.     syscout(27);
  85.     syscout('[');
  86.     syscout('J');
  87. #else
  88.     syscout(27);
  89.     syscout('H');
  90.     syscout(27);
  91.     syscout('J');
  92. #endif
  93. }
  94.  
  95. /*
  96. Delete the line on which the cursor rests.
  97. Leave the cursor at the left margin.
  98. */
  99.  
  100. outdelln()
  101. {
  102.     outxy(0,outy);
  103.     outdeol();
  104. }
  105.  
  106. /*
  107. Delete to end of line.
  108. Assume the last column is blank.
  109. */
  110.  
  111. outdeol()
  112. {
  113. #ifdef VT100
  114.     syscout(27);
  115.     syscout('[');
  116.     syscout('K');
  117. #else
  118.     syscout(27);
  119.     syscout('K');
  120. #endif
  121. }
  122.  
  123. /*
  124. Return yes if terminal has indicated hardware scroll.
  125. */
  126.  
  127. outhasup()
  128. {
  129.     return(YES);
  130. }
  131.  
  132. outhasdn()
  133. {
  134.     return(YES);
  135. }
  136.  
  137. /*
  138. Scroll the screen up.
  139. Assume the cursor is on the bottom line.
  140. */
  141.  
  142. outsup()
  143. {
  144.     syscout(10);
  145. }
  146.  
  147. /*
  148. Scroll screen down.
  149. Assume the cursor is on the top line.
  150. */
  151.  
  152. outsdn()
  153. {
  154. #ifdef VT100
  155.     syscout(27);
  156.     syscout('[');
  157.     syscout('H');
  158.     syscout(27);
  159.     syscout('M');
  160. #else
  161.     syscout(27);
  162.     syscout('H');
  163.     syscout(27);
  164.     syscout('I');
  165. #endif
  166.     outxy(outx,outy);
  167. }
  168.