home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-01 | 7.4 KB | 173 lines | [TEXT/R*ch] |
- This is a public domain implementation of Curses for IBM PC's and
- compatibles. It was developed on an IBM PC-AT clone using a Monochrome
- (Hercules compatible) display adapter. It should run on other adapters as
- well, but has not been tested. There is no support for displays with more
- than 25 lines, and I am also not sure of the support for CGA displays with
- 40 characters per line.
-
- The curses functions included are a major subset of that provided on
- System V. Specifically, pads are not included, nor are the lower-level
- "terminfo" calls.
-
- This source code is placed in the public domain and may be included in any
- product in whole or in part. The only restriction on the use of this code
- is that I specifically disallow the use of this free code to create a
- virtually identical product for sale commercially. (In other words,
- please do not delete my name from the source code, put your name in its
- place, and then sell this package as if it were your own.)
-
- Permission is specifically granted on the use of these subroutines within
- any private, commercial, public domain, shareware, or whatever program.
-
- Files
-
- Included in this distribution are the following files:
-
- curses.c Portable source code for curses entry points.
- curses.h Header file required by all programs that access curses.
- makefile A makefile to build the necessary .obj, .lib, and .exe files.
- readme This file.
- t.c A unit test to test the functionality of curses (and to demo
- some of its features).
- v_msdos.c IBM-PC (MS-DOS?) specific low-level screen and keyboard
- functions.
-
- Use
-
- If you have access to Unix documentation, the use of curses is virtually
- identical. If you do not have access to this, the best information on
- curses is probably "Screen Updating and Cursor Movement Optimization: A
- Library Package", by Kenneth Arnold. It is available electronically a
- number of places, including the Xenix data library in the TRS-80
- Professional Forum on CompuServe.
-
- Porting
-
- The curses routines exist in two modules:
- - curses.c All curses entry points.
- - v_msdos.c Routines containing machine specific code.
-
- The machine specific entry points (within v_msdos.c) are described below:
-
- ms_init() Perform any initializations that need to be done.
- This could include accessing a terminal file,
- initializing the "acs_map" array, etc.
-
- ms_refresh() Make the display screen look like the specified window.
-
- ms_end() Perform any necessary cleanup (freeing of allocated
- memory, closing files, etc.).
-
- ms_beep() Sound an alarm, and optionally flash the screen.
-
- ms_kbinp() Get a single character from the terminal. Do not echo
- the character.
-
- acs_map[] Alternate character set map array. Refer to curses.h
- for the mappings of the alternate character set.
- These mappings were taken from the curses makefile
- from System V/386.
-
- To port the code to another system, you will need to rewrite the v_msdos.c
- code for the target machine.
-
- CURSES window structure
-
- The WINDOW structure is used to communicate between the application
- program, curses, and the machine specific implementation module. Curses.c
- should be the only module modifying any of the information within this
- structure. In addition, the application program should only use the
- defined subroutines and macros to access the information within the
- structure.
-
- For those attempting to implement a machine-specific implementation
- module, the following is a description of the fields in the WINDOW
- structure:
-
- _cury, _curx Current location of the cursor, relative to the
- window (0,0 = top left corner of window).
- _maxy, _maxx The size of the window in lines and columns,
- respectively.
- _begy, _begx The location of the upper left hand corner of this
- window on the display (0,0 = top left corner of
- display).
- _flags Special attributes of this window. The following
- flags are defined, although only those preceded by an
- asterisk are actually used (the names were chosen for
- compatibility with Unix curses):
- _SUBWIN Window is a subwindow of another.
- _ENDLINE
- _FULLWIN
- _SCROLLWIN
- * _FLUSH Flush input on receipt of input.
- _ISPAD Window may be larger than screen.
- * _WINCHANGED Window has changed since last refresh.
- * _WINMOVED Window has been moved since last
- refresh.
- _attrs Current default character attributes for window.
- _clear Boolean - If true, redraw window from scratch.
- _leave Boolean - If true, cursor position is not important.
- _scroll Boolean - If true, window may be scrolled.
- _use_idl Boolean - If true, need to wait for terminal to
- update.
- _use_keypad Boolean - If true, return special characters for
- keypad characters (eg, KEY_INS).
- _use_meta Boolean - If true, use a meta key.
- _nodelay Boolean - If true, wgetch() is non-blocking and
- returns ERR if no character waiting.
- _y Physical description of the current window. An array
- of "chtype", whose dimensions are _maxy and _maxx
- (eg, chtype _y[maxy][maxx];).
- _firstch Not used - First screen updating command.
- _lastch Not used - Points to next screen updating command.
- _notimeout Boolean - If true, wait for function key string when a
- lead-in character (usually ESC) is received.
- _need_idl Not used - included for compatibility with Unix
- curses.
- _tmarg,_bmarg Scrolling region - _tmarg is the first line (from
- zero) that scrolls, _bmarg is the last line (from
- zero) that scrolls.
-
- The names of these members were chosen to be compatible with System V
- curses.
-
- Non-portable enhancements
-
- An enhancement has been added in that the function wprintw() uses a
- dynamically allocated buffer. Prior to the first call of wprintw(),
- you may set the external variable "curses_prntw_size" to the number of
- characters to allocate for wprintw()'s buffer. In a like manner, you may
- set the external variable "curses_prntw" to point to an actual buffer.
- The wprintw() buffer is an array of chars (not chtypes).
-
- By default, curses uses a buffer size of 512 and dynamically allocates the
- buffer on the first call to wprintw().
-
- Enhancements / Bug fixes / Support
-
- Since the target audience for this package is Unix programmers who want to
- port their code to DOS (or other operating systems), documenting the
- functions is left to the official sources. If you need help using curses,
- please do not contact me. Instead, refer to the information in the
- section entitled "Use" for where you can find the documentation.
-
- If you need help porting to another environment, drop me a line at one of
- the addresses below. If you are successful in you port, I would be
- interested in distributing the implementation module(s) with future
- releases of curses.
-
- If you send me bug fixes and enhancements, I will add them to later
- releases of the code (with the proper credit going to the author or
- authors). Please make all enhancements compatible with System V curses.
- I will also attempt to alert all known contributors of future releases
- of the product.
-
- I can be reached electronically at the following addresses:
-
- CompuServe [72236,3516]
- Delphi LARRYG
- Bix LAR3RY
- uucp lg@bsw.com -or- lg@risk.bsw.com
- US Mail 104 Lowell Road / Salem, NH 03079 / USA
-
-