home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / gnu / djgpp / diffs / texinfo-.1 / info / pc_term.c < prev    next >
Encoding:
Text File  |  1993-11-28  |  3.9 KB  |  180 lines

  1. *** orig/texinfo-.1/info/pc_term.c    Sun Aug 29 18:41:06 1993
  2. --- src/texinfo-.1/info/pc_term.c    Mon Sep  6 18:36:58 1993
  3. ***************
  4. *** 0 ****
  5. --- 1,174 ----
  6. + /* pc_term.c */
  7. + /* This file is part of the MSDOS-DJGPP-port of the GNU standalone
  8. +    Info-reader
  9. +    Copyright (C) Hans-Bernhard Broeker
  10. +    This program is free software; you can redistribute it and/or modify
  11. +    it under the terms of the GNU General Public License as published by
  12. +    the Free Software Foundation; either version 2, or (at your option)
  13. +    any later version.
  14. +    This program is distributed in the hope that it will be useful,
  15. +    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. +    GNU General Public License for more details.
  18. +    You should have received a copy of the GNU General Public License
  19. +    along with this program; if not, write to the Free Software
  20. +    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. +    Written by Hans-Bernhard Broeker (softbrek@POOL.Informatik.RWTH-Aachen.DE)
  22. + */
  23. + #include <stdio.h>
  24. + #include <pc.h>
  25. + #include <gppconio.h>
  26. + #include "pc_term.h"
  27. + #include "terminal.h"
  28. + #include "termdep.h"
  29. + #define max(x,y) ((x)>(y) ? (x) : (y))
  30. + #define min(x,y) ((x)<(y) ? (x) : (y))
  31. + #define keywait  do {char dummy=0;\
  32. +                      fflush(stdout);\
  33. +                      while (!kbhit()) ;\
  34. +                      dummy=getkey();\
  35. +                  } while (0);
  36. + static struct text_info pc_info; /* struct to hold the conio-status */
  37. + void pc_begin_inverse()
  38. + {
  39. +     textbackground(7);
  40. +     textcolor(0);
  41. + }
  42. + void pc_end_inverse()
  43. + {
  44. +     textbackground(0);
  45. +     textcolor(7);
  46. + }
  47. + void pc_prep_terminal()
  48. + {
  49. +   textattr(0x07);
  50. + }
  51. + void pc_unprep_terminal()
  52. + {
  53. +     ScreenClear(); /* to leave behind a clean screen */
  54. + }
  55. + void pc_up_line()
  56. + {
  57. +     int x, y;
  58. +     ScreenGetCursor(&y, &x);
  59. +     ScreenSetCursor(max(y-1, 0), x);
  60. + }
  61. + void pc_down_line()
  62. + {
  63. +     int x, y;
  64. +     ScreenGetCursor(&y, &x);
  65. +     ScreenSetCursor(min(screenheight-1, y+1), x);
  66. + }
  67. + void pc_clear_screen()
  68. + {
  69. +     ScreenClear();
  70. + }
  71. + void pc_clear_to_eol()
  72. + {
  73. +     clreol(); /* perhaps to be replaced by a loop */
  74. + }
  75. + void pc_get_screen_size()
  76. + {
  77. +     screenwidth  = ScreenCols();
  78. +     screenheight = ScreenRows();
  79. + }
  80. + void pc_goto_xy(x, y)
  81. + int x, y;
  82. + {
  83. +     ScreenSetCursor(y, x); /* yes, pc.h says ...(row, column) !! */
  84. + }
  85. + void pc_initialize_terminal(term_name)
  86. +     char *term_name;
  87. + {
  88. +     gppconio_init();
  89. +     gettextinfo(&pc_info);
  90. +     screenwidth  = ScreenCols();
  91. +     screenheight = ScreenRows();
  92. + }
  93. + void pc_new_terminal(term_name)
  94. +     char *term_name;
  95. + {
  96. +     pc_initialize_terminal(term_name);
  97. + }
  98. + void pc_put_text(string)
  99. + char *string;
  100. + {
  101. +     cputs(string);
  102. + }
  103. + void pc_ring_bell()
  104. + {
  105. +     printf("%c",'\a');
  106. + }
  107. + void pc_write_chars(string, nchars)
  108. +     char *string;
  109. +     int nchars;
  110. + {
  111. +     cprintf("%.*s",nchars, string);
  112. + }
  113. + void pc_scroll_terminal(start, end, amount)
  114. +     int start, end, amount;
  115. + {
  116. +     movetext(pc_info.winleft, start, pc_info.winright, end,
  117. +         pc_info.winleft, start+amount);
  118. + }
  119. + int       tputs(char *a, int b, int (*c)())
  120. + {
  121. +   perror("tputs");
  122. + }
  123. + char*     tgoto(char*a, int b, int c)
  124. + {
  125. +   perror("tgoto");
  126. + }
  127. + int       tgetnum(char*a)
  128. + {
  129. +   perror("tgetnum");
  130. + }
  131. + int       tgetflag(char*a)
  132. + {
  133. +   perror("tgetflag");
  134. + }
  135. + char*     tgetstr(char *a, char **b)
  136. + {
  137. +   perror("tgetstr");
  138. + }
  139. + int       tgetent(char*a, char*b)
  140. + {
  141. +   perror("tgetent");
  142. + }
  143. + int       sigblock(int a)
  144. + {
  145. +   return 0;
  146. + }
  147.