home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gccdist / gcc / include / curses.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-29  |  5.9 KB  |  224 lines

  1. /* Old version of curses.h for c++, edited for C on VMS. ERY */
  2.  
  3. /* 
  4. Copyright (C) 1989, 1992 Free Software Foundation
  5.     written by Eric Newton (newton@rocky.oswego.edu)
  6.  
  7. This file is part of the GNU C++ Library.  This library is free
  8. software; you can redistribute it and/or modify it under the terms of
  9. the GNU Library General Public License as published by the Free
  10. Software Foundation; either version 2 of the License, or (at your
  11. option) any later version.  This library is distributed in the hope
  12. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  13. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  14. PURPOSE.  See the GNU Library General Public License for more details.
  15. You should have received a copy of the GNU Library General Public
  16. License along with this library; if not, write to the Free Software
  17. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. /*
  21.  * Edited for compatablity with C++, 2/28/89 <ecn>
  22.  * This file has all the /usr/include/curses.h info (with proper prototypes)
  23.  * used for the CursesWindow classes.  You may need to change this to be
  24.  * compatable with your curses implementation.
  25.  *
  26.  */
  27.  
  28. #ifndef _curses_h
  29. #define _curses_h
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. # include   <stdio.h> 
  36. # include   <stddef.h>
  37. /* # include   <std.h> */
  38.  
  39. /* protection against possibility that these are macros: */
  40.  
  41. #if 0
  42. #ifndef stty
  43. extern int stty(int, struct sgttyb*); 
  44. #endif
  45.  
  46. #ifndef gtty
  47. extern int gtty(int, struct sgttyb*); 
  48. #endif
  49. #endif
  50.  
  51. /* int       tputs(const char *, int, auto int (*)()); */
  52. int       tgetent(const char*, const char*);
  53. int       tgetnum(const char*);
  54. int       tgetflag(const char*);
  55. char*     tgetstr(const char *, char **);
  56. char*     tgoto(const char*, int, int);
  57.  
  58. /* typedef char cbool; *//* curses explicitly declares bools as chars */
  59. typedef int cbool;  /* cursesw.h expects type int for this */
  60.  
  61. #define ERR 0
  62. #define OK 1
  63.  
  64. /*
  65.  *  BSD'ish.  Warning!!
  66.  *
  67.  */
  68. # define    _ENDLINE    001
  69. # define    _FULLWIN    002
  70. # define    _SCROLLWIN  004
  71. # define    _FLUSH      010
  72. # define    _FULLLINE   020
  73. # define    _IDLINE     040
  74. # define    _STANDOUT   0200
  75. # define    _NOCHANGE   -1
  76.  
  77. /* # define    _puts(s)    tputs(s, 0, _putchar) */
  78.  
  79. /*
  80.  * Capabilities from termcap
  81.  */
  82.  
  83. extern cbool     AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL,
  84.         XB, XN, XT, XS, XX;
  85. extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
  86.         *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6,
  87.         *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL,
  88.         *KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF,
  89.         *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS,
  90.         *VE, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM,
  91.         *LEFT_PARM, *RIGHT_PARM;
  92.  
  93. extern char PC;
  94.  
  95. extern cbool    GT, NONL, UPPERCASE, normtty, _pfast;
  96.  
  97. struct _win_st {
  98.     int        _cury, _curx;
  99.     int        _maxy, _maxx;
  100.     int        _begy, _begx;
  101.     short       _flags;
  102.     cbool       _clear;
  103.     cbool       _leave;
  104.     cbool       _scroll;
  105.     cbool    _wrap;
  106.     char        **_y;
  107.     short       *_firstch;
  108.     short       *_lastch;
  109.     struct _win_st  *_nextp, *_orig;
  110.     struct _win_st  *_parent , *_child;
  111.     int        _id;
  112. };
  113.  
  114. #define WINDOW  struct _win_st
  115.  
  116. extern cbool My_term;
  117. extern cbool _echoit;
  118. extern cbool _rawmode;
  119. extern cbool _endwin;
  120.  
  121. extern char *Def_term;
  122. extern char  ttytype[];
  123.  
  124. extern int  LINES;
  125. extern int  COLS; 
  126. extern int  _tty_ch;
  127. extern int  _res_flg;
  128.  
  129.  
  130. #if 0
  131. typedef struct sgttyb SGTTY;
  132.  
  133. extern SGTTY _tty;
  134. #endif
  135.  
  136. /*
  137.  * standard curses functions.
  138.  *
  139.  */
  140.  
  141. extern WINDOW * stdscr;
  142. extern WINDOW * curscr;
  143. WINDOW * newwin(int lines, int cols, int sy, int sx);
  144. WINDOW * subwin(WINDOW *w, int lines, int cols, int sy, int sx);
  145. WINDOW * initscr();
  146. int      box (WINDOW*, char, char);
  147. int      delwin(WINDOW*);
  148. int      mvcur(int, int, int, int);
  149. int      overlay(WINDOW*, WINDOW*);
  150. int      overwrite(WINDOW*, WINDOW*);
  151. int      scroll(WINDOW*);
  152. int      touchwin(WINDOW*);
  153. int      waddch(WINDOW*, char);
  154. int      waddstr(WINDOW*, const char*);
  155. int      wclear(WINDOW*);
  156. int      wclrtobot(WINDOW*);
  157. int      wclrtoeol(WINDOW*);
  158. int      wdelch(WINDOW*);
  159. int      wdeleteln(WINDOW*);
  160. int      werase(WINDOW*);
  161. int      wgetch(WINDOW*);
  162. int      wgetstr(WINDOW*, char*);
  163. int      winsch(WINDOW*, char);
  164. int      winsertln(WINDOW*);
  165. int      wmove(WINDOW*, int, int);
  166. int      wrefresh(WINDOW*);
  167. int      wstandend(WINDOW*);
  168. int      wstandout(WINDOW*);
  169. int      wprintw(WINDOW*, const char * fmt, ...);
  170. int      mvwprintw(WINDOW*, int y, int x, const char * fmt, ...);
  171. int      wscanw(WINDOW*, const char *, ...);
  172. int      mvwscanw(WINDOW*, int, int, const char*, ...);
  173. int      endwin();
  174.  
  175. #define getch()        wgetch(stdscr)
  176. /* Pseudo functions */
  177. /* 
  178.  * these are inlines rather than defines here so as to allow overloaded
  179.  * versions in the CursesWindow class
  180.  */
  181.  
  182. inline int clearok(WINDOW* win, cbool bf)  { return(win->_clear = bf); }
  183. inline int leaveok(WINDOW* win, cbool bf)  { return(win->_leave = bf); }
  184. inline int scrollok(WINDOW* win, cbool bf) { return(win->_scroll = bf); }
  185. inline int flushok(WINDOW* win, cbool bf)  
  186. { return(bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH)); }
  187. inline void getyx(WINDOW* win, int y, int x)   
  188. { y = win->_cury; x = win->_curx; }
  189. inline int winch(WINDOW* win)   
  190. {return  win->_y[win->_cury][win->_curx] & 0177; }
  191.  
  192. int raw();
  193. int noraw();
  194. int cbreak();
  195. int nocbreak();
  196.  
  197. int _setecho(int);
  198. int _setnonl(int);
  199.  
  200. inline int echo()   { return _setecho(1); }
  201. inline int noecho() { return _setecho(0); }
  202. inline int nl()     { return _setnonl(0); }
  203. inline int nonl()   { return _setnonl(1); }
  204.  
  205. int savetty();
  206. int resetty();
  207. int erasechar();
  208. int killchar();
  209. int baudrate();
  210.  
  211. char *longname(char *, char *);
  212. char *getcap(char *);
  213. extern char *_unctrl[];
  214.  
  215. inline int crmode() { return  cbreak(); }
  216. inline int nocrmode() { return  nocbreak(); }
  217. inline char * unctrl(int c) {  return _unctrl[(c) & 0177]; }
  218.  
  219. #ifdef __cplusplus
  220. }
  221. #endif
  222.  
  223. #endif
  224.