home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / c / curses / src / acurses.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-30  |  4.4 KB  |  176 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.8  92/06/10  23:43:32  sie
  25.  * Added serial support.
  26.  * 
  27.  * Revision 1.7  92/01/25  23:51:51  sie
  28.  * Define for TABSIZE.
  29.  * 
  30.  * Revision 1.6  91/12/28  22:43:00  sie
  31.  * changed attrs to UBYTE from short + some tidying up.
  32.  * 
  33.  * Revision 1.5  91/12/28  14:02:45  sie
  34.  * Removed WinStat.
  35.  * Renamed LineElement as lnel.
  36.  * 
  37.  * Revision 1.4  91/12/26  14:52:31  sie
  38.  * Removed Next & Prev from WinStat as a list is no longer required.
  39.  * 
  40.  * Revision 1.3  91/09/07  11:54:19  sie
  41.  * V2.00 curses.
  42.  * 
  43.  * Revision 1.2  91/08/23  21:38:47  sie
  44.  * Port to GNU C.
  45.  * 
  46.  * Revision 1.1  91/02/05  21:19:43  sie
  47.  * Initial revision
  48.  * 
  49.  *
  50.  */
  51.  
  52. #include <intuition/intuition.h>
  53. #include <intuition/screens.h>
  54. #include <sys/types.h>
  55. #include <exec/types.h>
  56. #include <exec/io.h>
  57. #include <exec/memory.h>
  58. #include <devices/audio.h>
  59.  
  60. #include <proto/exec.h>
  61. #include <proto/intuition.h>
  62. #include <proto/graphics.h>
  63. #include <stdlib.h>
  64. #include <dos.h>
  65. #include <proto/console.h>
  66. #include <proto/dos.h>
  67. #include <string.h>
  68. #include "curses.h"
  69.  
  70. /* min() and max() are not part of c.lib */
  71. #ifndef min
  72. #define min(a,b) ((a)<(b)?(a):(b))
  73. #endif
  74. #ifndef max
  75. #define max(a,b) ((a)>(b)?(a):(b))
  76. #endif
  77.  
  78.   
  79. #define MAXTEXTLEN     80    /* Max text to an output call */
  80. #define SOUNDLENGTH     2    /* Number of bytes in the sound wave */
  81. #define CAPSMASK     0x07    /* leftshift | rightshift | capslock */
  82. #define SHIFTMASK    0x03    /* leftshift | rightshift */
  83. #define MAXLINES       64    /* Maximum number of lines (PAL LACE) */
  84. #define MAXCOLS        80    /* No overscan yet */
  85. #define TABSIZE         8    /* distance between tab stops */
  86. #define ANSIBUFSIZ     32    /* buffers for building ANSI sequences */
  87. /*
  88.  * Type of curses
  89.  */
  90.  
  91. #define CUST_CURSES    0    /* Use custom screen (default) */
  92. #define ANSI_CURSES    1    /* Use ANSI codes to work on serial lines */
  93.  
  94. /*
  95.  *    characters
  96.  */
  97.   
  98. #define BS            0x08    /* Backspace */
  99. #define CR            0x0d    /* Carriage return */
  100. #define ESC           0x1b    /* Escape */
  101.   
  102. /*
  103.  *    My Flags. These are global to all windows, not window specific.
  104.  */
  105.  
  106. #define CFLAG_CURSOR    0001    /* T=Cursor on, F=Cursor off. */
  107. #define CFLAG_CBREAK    0002    /* T=cbreak mode, F=nocbreak mode */
  108. #define CFLAG_NLCR      0004    /* T=nl to cr mapping, F=no mapping */
  109. #define CFLAG_ECHO      0010    /* T=Echo enabled, F=no echo */
  110. #define CFLAG_INITSCR   0020    /* T=initscr has been called */
  111. #define CFLAG_KEYPAD    0040    /* T=translate ANSI codes to special ints */
  112.  
  113. /*
  114.  *    WINDOW flags, these are specific to each window.
  115.  */
  116.  
  117. #define CWF_MOVED    0001    /* move() has been done on this window */
  118.  
  119. /*
  120.  *    Buffer size for raw key events.
  121.  */
  122. #define RAWBUFSIZ    32
  123.  
  124. /*
  125.  *    Scroll directions
  126.  */
  127. #define SCROLL_UP    1
  128. #define SCROLL_DOWN  2
  129.  
  130. /*
  131.  *    Simple implementation of wnoutrefresh() and doupdate()
  132.  */
  133.  
  134. struct RefreshElement {
  135.   WINDOW *WinPtr;
  136.   struct RefreshElement *Next;
  137. };
  138.  
  139.  
  140. /*
  141.  * Externals in _data.c
  142.  */
  143. extern unsigned char CursesFlags;
  144. extern int CursesType;
  145. extern unsigned char GetchNChars, GetchBufPos;
  146. extern short CursorCol, CursorLine, LCursorLine, LCursorCol;
  147. extern struct WindowState *HeadWindowList;
  148. extern struct RefreshElement *HeadRefreshList;
  149. extern struct RastPort *RPort;
  150. extern struct ViewPort *VPort;
  151. extern struct IntuitionBase *IntuitionBase;
  152. extern struct GfxBase *GfxBase;
  153. extern struct IOStdReq ioreq;
  154. extern struct Screen *CursesScreen;
  155. extern struct Window *CursesWindow;
  156. extern int FontHeight, FontWidth, FontBase;
  157. extern struct FileHandle *ifh;
  158.  
  159.  
  160. /*
  161.  * Prototypes.
  162.  */
  163.  
  164. void DoEcho(WINDOW *, char);
  165. int Scroll(WINDOW *, int, int, int);
  166. void CleanExit(int);
  167. void ZapCursor(void);
  168. void DrawCursor(void);
  169. void ToggleCursor(int, int);
  170. void CleanUp(void);
  171. /* Prototypes for functions defined in _ansi.c */
  172. void ANSIClear(void);
  173. void ANSIMove(int line, int col);
  174. void ANSIFlash(void);
  175. void ANSIClearRect(int line, int col, int height, int width);
  176.