home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / dev / c / curses / src / acurses.h < prev    next >
C/C++ Source or Header  |  1994-02-21  |  6KB  |  217 lines

  1. /*
  2.  *
  3.  * Module      : acurses.h
  4.  *
  5.  * Description : Header file for AMIGA CURSES package.
  6.  *
  7.  * Author      : Simon Raybould  (sie@fulcrum.bt.co.uk)
  8.  *
  9.  * Date        : 16th February 1990
  10.  *
  11.  *
  12.  *
  13.  * THIS CODE IS COPYRIGHT S.J.R 1991, ALL RIGHTS ARE RESERVED.
  14.  *
  15.  * THIS SOURCE IS NOT PUBLIC DOMAIN, BUT IS FREELY DISTRIBUTABLE AS
  16.  *                LONG AS IT REMAINS UNALTERED.
  17.  *
  18.  * NO IMPLICATION IS MADE AS TO IT BEING FIT FOR ANY PURPOSE AT ALL
  19.  * I SHALL NOT BE HELD RESPONSIBLE FOR ANY LOSS OF PROPERTY OR DAMAGE
  20.  * THAT MAY RESULT FROM ITS USE.
  21.  *
  22.  *
  23.  * $Log: acurses.h,v $
  24.  * Revision 1.10  1993/05/17  23:33:10  sie
  25.  * Underscores added to names.
  26.  * Changes for version 2.10
  27.  *
  28.  * Revision 1.9  1992/12/25  22:16:55  sie
  29.  * GNU port.
  30.  *
  31.  * Revision 1.8  92/06/10  23:43:32  sie
  32.  * Added serial support.
  33.  * 
  34.  * Revision 1.7  92/01/25  23:51:51  sie
  35.  * Define for TABSIZE.
  36.  * 
  37.  * Revision 1.6  91/12/28  22:43:00  sie
  38.  * changed attrs to UBYTE from short + some tidying up.
  39.  * 
  40.  * Revision 1.5  91/12/28  14:02:45  sie
  41.  * Removed WinStat.
  42.  * Renamed LineElement as lnel.
  43.  * 
  44.  * Revision 1.4  91/12/26  14:52:31  sie
  45.  * Removed Next & Prev from WinStat as a list is no longer required.
  46.  * 
  47.  * Revision 1.3  91/09/07  11:54:19  sie
  48.  * V2.00 curses.
  49.  * 
  50.  * Revision 1.2  91/08/23  21:38:47  sie
  51.  * Port to GNU C.
  52.  * 
  53.  * Revision 1.1  91/02/05  21:19:43  sie
  54.  * Initial revision
  55.  * 
  56.  *
  57.  */
  58.  
  59. #include <intuition/intuition.h>
  60. #include <intuition/screens.h>
  61. #include <libraries/dos.h>
  62. #include <sys/types.h>
  63. #include <exec/types.h>
  64. #include <exec/io.h>
  65. #include <exec/memory.h>
  66. #include <devices/audio.h>
  67.  
  68. #ifdef LATTICE
  69. #include <proto/exec.h>
  70. #include <proto/intuition.h>
  71. #include <proto/graphics.h>
  72. #include <dos.h>
  73. #include <proto/console.h>
  74. #include <proto/dos.h>
  75. #endif /* LATTICE */
  76.  
  77. #include <stdlib.h>
  78. #include <string.h>
  79. #include "curses.h"
  80.  
  81. /* min() and max() are not part of c.lib */
  82. #ifndef min
  83. #define min(a,b) ((a)<(b)?(a):(b))
  84. #endif
  85. #ifndef max
  86. #define max(a,b) ((a)>(b)?(a):(b))
  87. #endif
  88.  
  89. /*
  90.  * Genral stuff.
  91.  */
  92. #define MAXTEXTLEN     80    /* Max text to an output call */
  93. #define SOUNDLENGTH     2    /* Number of bytes in the sound wave */
  94. #define CAPSMASK     0x07    /* leftshift | rightshift | capslock */
  95. #define SHIFTMASK    0x03    /* leftshift | rightshift */
  96. #define MAXLINES       64    /* Maximum number of lines (PAL LACE) */
  97. #define MAXCOLS        80    /* No overscan yet */
  98. #define TABSIZE         8    /* distance between tab stops */
  99. #define ANSIBUFSIZ     32    /* buffers for building ANSI sequences */
  100. #define CAP_LEN         2       /* length of capability name strings */
  101.  
  102. /*
  103.  * Type of curses
  104.  */
  105. #define CUST_CURSES    0    /* Use custom screen (default) */
  106. #define ANSI_CURSES    1    /* Use ANSI codes to work on serial lines */
  107.  
  108. /*
  109.  *    characters
  110.  */
  111. #define BS            0x08    /* Backspace */
  112. #define CR            0x0d    /* Carriage return */
  113. #define ESC           0x1b    /* Escape */
  114.   
  115. /*
  116.  *    My Flags. These are global to all windows, not window specific.
  117.  */
  118. #define CFLAG_CURSOR    0001    /* T=Cursor on, F=Cursor off. */
  119. #define CFLAG_CBREAK    0002    /* T=cbreak mode, F=nocbreak mode */
  120. #define CFLAG_NLCR      0004    /* T=nl to cr mapping, F=no mapping */
  121. #define CFLAG_ECHO      0010    /* T=Echo enabled, F=no echo */
  122. #define CFLAG_INITSCR   0020    /* T=initscr has been called */
  123. #define CFLAG_KEYPAD    0040    /* T=translate ANSI codes to special ints */
  124.  
  125. /*
  126.  *    WINDOW flags, these are specific to each window.
  127.  */
  128. #define CWF_MOVED    0001    /* move() has been done on this window */
  129.  
  130. /*
  131.  *    Buffer size for raw key events.
  132.  */
  133. #define RAWBUFSIZ    32
  134.  
  135. /*
  136.  *    Scroll directions
  137.  */
  138. #define SCROLL_UP    1
  139. #define SCROLL_DOWN  2
  140.  
  141. /*
  142.  * Termcap stuff
  143.  */
  144. #define DFLT_TERMCAP "s:termcap"
  145. #define LINE_LEN     1024       /* max line length in termcap file */
  146. #define MAX_CAPS      128       /* maximum number of capabilities */
  147.  
  148. #define BELL         0x07
  149. #define BS           0x08
  150. #define TAB          0x09
  151. #define NL           0x0a
  152. #define FF           0x0c
  153. #define CR           0x0d
  154. #define ESC          0x1b
  155.  
  156.  
  157. /*
  158.  *    Simple implementation of wnoutrefresh() and doupdate()
  159.  */
  160.  
  161. struct RefreshElement {
  162.   WINDOW *WinPtr;
  163.   struct RefreshElement *Next;
  164. };
  165.  
  166.  
  167. /*
  168.  * Externals in _data.c
  169.  */
  170. extern unsigned char _CursesFlags;
  171. extern int _CursesType;
  172. extern unsigned char _GetchNChars, _GetchBufPos;
  173. extern short _CursorCol, _CursorLine, _LCursorLine, _LCursorCol;
  174. extern struct RefreshElement *_HeadRefreshList;
  175. extern struct RastPort *_RPort;
  176. extern struct ViewPort *_VPort;
  177. extern struct IntuitionBase *IntuitionBase;
  178. extern struct GfxBase *GfxBase;
  179. extern struct IOStdReq ioreq;
  180. extern struct Screen *_CursesScreen;
  181. extern struct Window *_CursesWindow;
  182. extern struct MsgPort *_CursesMsgPort;
  183. extern int _FontHeight, _FontWidth, _FontBase;
  184. extern BPTR _ifh;
  185. extern char *__area;
  186. extern char *__capary[];
  187. extern int __no_caps;
  188.  
  189. extern char *_clstr;
  190. extern char *_cmstr;
  191.  
  192.  
  193. /*
  194.  * Prototypes.
  195.  */
  196. void _DoEcho(WINDOW *, char);
  197. int _Scroll(WINDOW *, int, int, int);
  198. void _CleanExit(int);
  199. void _ZapCursor(void);
  200. void _DrawCursor(void);
  201. void _ToggleCursor(int, int);
  202. void _CleanUp(void);
  203. /* Prototypes for functions defined in _ansi.c */
  204. void _ANSIInit(void);
  205. void _ANSIClear(void);
  206. void _ANSIMove(int line,
  207.               int col);
  208. void _ANSIFlash(void);
  209. void _ANSIClearRect(int line,
  210.                    int col,
  211.                    int height,
  212.                    int width);
  213. long _RawMode(BPTR afh);
  214. long _CanonMode(BPTR afh);
  215. WINDOW *_CreatWindow(int NLines, int NCols, int StartLine, int StartCol, WINDOW *Orig);
  216.  
  217.