Contents of the DISPLAY.DOC file
dispfile() version 2.0 28 September 89
dispfile() and assorted routines created by me for the public domain.
Author: Mike Taylor CIS: 73310,3013
300 W. Main St.
Maple Shade, NJ 08052 Work: (215) 563-9000 x4443
Function: dispfile(, , , , ,
, , , , ,
Parameters: - text file to display (full name)
, - upper-left row,col of window
, - lower-right row,col of window
- line to place highlight at startup
- normal text color
- text highlight color
- terminating keys
- browse flag
- col increment for left/right arrows
- right margin
Returns: char value - the key that terminated dispfile()
Purpose: to display a text file within a defined window
using as little memory as possible. the text
file to display has to be present or an error
value of 0 is returned (as a character.)
ASSUMPTIONS: the routine assumes that all lines are terminated
with a CR/LF sequence (0x0d and 0x0a) and that the
FILE IS TERMINATED WITH THE EOF CHARACTER (0x1a.)
If the file does not have an EOF character, then the
routine will start bringing in whatever garbage
appears in the buffer following your data.
Cursor Keys: Up, Down - moves the highlight line
Left, Right - moves the window over col's
Home - moves the window to the far left
End - moves the window to the column
PgUp, PgDn - moves the highlight one page
Ctrl-PgUp - moves the highlight to the file top
Ctrl-PgDn - moves the highlight to the file bottom
Ctrl-Right - moves the window 16 col's to the right
Ctrl-Left - moves the window 16 col's to the left
Esc, Return - terminates the function
all other keys are ignored unless they are specified
within parameter. This list will tell the
routine what keys terminate the function. Special
keys must be passed by a unique value and that value
can be found by looking in the keys.h file. See the
test program for an example.
I don't garauntee anything about these routines except that if you find
a bug or want something changed and you don't have access to a C
compiler, then give me a shout and I'll see what I can do.
This routine has been compiled with MSC 5.1, Turbo C 2.0, MASM 5.1 and
TASM 1.0. It does utilize the newer ANSI C ideas (prototypes, etc.)
but all of that has been placed in the .h files. The .asm routines are
all callable from C (large memory model) and don't do anything unusual.
The only part that can be called from Clipper is the main routine
dispfile() and it only calls my .asm and .c routines - no library calls
made (well it does use strcpy() but I've found that in the CLIPPER.LIB
so it probably doesn't cause any problems.)
WARNING: If you want to use TLink to link the .obj's then you should
compile the C routine (display.c) with the appropriate version
of Turbo C so that the resulting .obj file is 100% compatible.
Evidently Turbo C's large memory model is not completely
compatible with Microsoft's. This problem has not been tested
completely but one of the 'bugs' vanished whenever I did this.
Thanks to Gene Winston for discovering this psuedo-bug.
I've tested this routine on the following hardware with no problems:
IBM PC-AT w/mono
IBM PC-AT w/CGA
IBM PC-AT w/VGA mono & color modes (Dell VGA Color Plus)
IBM PS/2 m60 w/VGA mono & color modes
Compaq portable 286 mono & color modes
Dell 386 w/VGA mono & color modes (Dell VGA Color Plus)
Leading Edge PC w/Hercules mono
IBM PC-AT w/Hercules InColor
All public symbols are preceded by a 'd_' so you don't have to worry
about any conflicts with your symbols (unless you happen to have a 'd_'
in front of any!)
1.5 14 Jan 89 Initial release.
1.6 22 Feb 89 Fixed cursor-past-file-end bug when the file size
was within a couple of bytes of the buffer size.
Also fixed some errors in the documentation.
1.7 13 Mar 89 Increased the buffer size to 4096 bytes so that
Gene could display one of his files. It turned
out that only 4 or 5 of his lines (> 100 chars)
could fit in the buffer and yet for some reason
(GRIN), the pseudo-window routine was expecting
8. Also rewrote some of the line-up/down code
to treat buffer boundaries a little cleaner (not
efficient, but easier.)
1.8 17 Mar 89 Set up the keyboard routine to accept a string
of char values to terminate the function when
1.9 12 Sep 89 Reality Check Release - recompiled all of the
code and retested everything to make sure it
all still works.
1.95 27 Sep 89 Added and parameters.
2.0 28 Sep 89 Added which is a flag to change the
way the routine processes the up/down arrows;
if it is .T., then the up/down arrows will
scroll the window one line up/down and if it
is .F., it will screen one line up/down only
when the highlight is at the bottom/top of the
window. and will now default
to 1 and 132 respectively if they are not
present in the parameter list. This release
also fixed a bug in 1.95 that caused my
debugging data to be written to the mono
screen (I forgot to comment out the code).
Files included in DISPLAY.ARC:
DISPLAY DOC the file you are reading
DISPLAY C contains dispfile() and c routines
DISPSUB ASM contains asm routines
TEST PRG test program to show dispfile() call
DISPLAY MAK make file to create dispfile() .obj files
TEST MAK make file to create test program
DISPLAY OBJ object files for routines
DISPLAY H include files
TEST TXT test text file