Jul 252018
 
The Last Byte memory manager, version 2.31, Makes more memory available by taking advantage of various manufacturers chips. Advanced utilties.
File WINDOW_C.ZIP from The Programmer’s Corner in
Category C Source Code
Excellent windowed screen and field-entry routines, with full C source code.
File Name File Size Zip Size Zip Type
CUSTOMIO.C 1968 888 deflated
CUSTOMIO.EXE 12496 7796 deflated
LATTICE.LIB 9823 4766 deflated
WINDDEMO.C 1668 792 deflated
WINDDEMO.EXE 8928 5797 deflated
WINDOWS.DOC 7878 3053 deflated
WINDOWS.H 3090 1032 deflated
WINDOWS.LIB 8287 4073 deflated
W_BEEP.ASM 1330 544 deflated
W_CENTER.C 753 376 deflated
W_CLOSE.C 2779 860 deflated
W_CURSOR.C 1277 380 deflated
W_FIELDS.C 10291 2225 deflated
W_INIT.C 7011 2106 deflated
W_MEMCPY.ASM 1706 668 deflated
W_OPEN.C 2389 724 deflated
W_PUTC.C 4711 1373 deflated
W_PUTW.ASM 1691 639 deflated
TPCREAD.ME.HTML 294 221 deflated

 

Download File WINDOW_C.ZIP Here

Contents of the WINDOWS.DOC file


WINDOWS.C

Copyright 1987 Robert Kline & students of NOVA DAPR 298-03-A
Revisions Copyright 1988 Robert Kline

Package of functions to manage windowed display techniques on the IBM PC
family and compatible machines. In addition to the functions
defined in this file, the library contains 3 other functions, beep(),
w_putw(), and w_memcpy(), declared in the windows header file, and
written in assembly language. These two files have been assembled
for Microsoft C, Turbo C, and Lattice C (the first two are identical,
as Microsoft and Borland follow the same segment-naming and other
interface conventions; Lattice handles several assembly interface
details in ways not directly compatible with the other two). The
only other function not in the ANSI draft standard is int86(), which
is widely available on C compilers for the 8086 family of machines,
including the three compilers named above. The windows.lib file
contains the object modules for all functions declared in windows.h,
compiled using the 'small' memory model. There is a separately
compiled and libraried version for work with Lattice C (lattice.lib).

Included in this package are the following files:
windows.not this file
windows.h header file needed to compile or use windows.c
w_init.c C source code files
w_open.c (7 altogether)
w_putc.c
w_center.c
w_close.c
w_cursor.c
w_fields.c
w_putw.asm assembly-language code for three of the
w_memcpy.asm routines used
w_beep.asm
windows.lib library for Microsoft C & Turbo C
lattice.lib same for Lattice C
winddemo.c a driver to demonstrate the routines
winddemo.exe executable demonstration program
customio.c another demo
customio.exe

To compile and link winddemo with Turbo C, Command Line Version:
tcc -ms winddemo windows.lib

To compile and link winddemo with Turbo C, Environment Version:
create project file winddemo.prj to look like this--
winddemo
windows.lib
from the menu select Project, then winddemo.prj, then
press F9 key

To compile and link with Microsoft Quick C:
qcl /AS winddemo.c windows.lib;

To compile and link with Microsoft C 5.0:
msc winddemo;
link winddemo,,,windows

To compile and link with Lattice C:
lc winddemo
link cs winddemo,winddemo,,lcs lattice

Same procedure will work with any other program. Just
substitute your file for winddemo.

Here are the functions in the package, with very brief descriptions:

w_init() sets up main_w, top_w; must be called before anything else
w_create() creates Window structure with passed parameters as settings
w_draw()copies data from window storage to screen
w_error() exits from program with message when malloc runs out of memory
w_clear()sets window's storage to spaces; does not affect screen display
w_show()calls w_draw() and w_border() to display window
w_border()draws single- or double-line border for window if it has one
w_title()puts window's title on screen if it has one
w_open() adds window to linked list (with w_link()) and displays window
w_link()adds window to top of linked list
w_select()moves open window to top of list
w_putc() displays character and saves it in window's storage
w_puts() displays string and puts it in window's storage
w__scroll()scrolls data in window storage without changing screen
w_scroll()scrolls data in window storage and on screen
w_center()centers a string on a given row of a given window
w_close()closes a window (does not destroy structure)
w_unlink()removes window from linked list
w_refresh()redraws screen from the bottom window up
w_dispose()releases the storage for a Window structure
w_putcrs()moves the hardware cursor to the window's current location
crs_off()turns off the cursor display
crs_on()turns on the cursor display
showField()display prompt and data area for field
getField()very sophisticated version of gets()
clearToEnd()delete from current field position to end of field
fieldStart()move to beginning of field
fieldEndmove to end of field data
fieldLeftmove left one position in field, if possible
fieldRightmove right one position in field, if possible
toggleInserttoggle value of insert flag
delChar()remove character at current position and close up string
backspace()destructive backspace, closing up string from right
addChar()adds character to string if it meets field specifications
fatCursor()sets large cursor display, used to indicate insert mode
thinCursor()sets normal cursor display, used when insert mode is off
w_putw()moves character & attribute to video memory; handles snow
w_memcpy()moves blocks of data to video memory; handles snow
beep()less obnoxious sound than with putchar('\a');

In addition to these globally available functions, the programmer has access to
the following external variables:
vidMemsegment address for video display; set by w_init
main_wpointer to the Window structure for the whole screen
top_wpointer to the Window structure for the active (top) window
layers_wnumber of windows in the linked list
colsnumber of columns (80/40) on physical screen; set by w_init()
insertFlagkeeps track of whether insert mode is on
beepFlagtells whether to beep when field size is exceeded
snowFlagset by w_init, depending on current video mode; can be turned
off by application program if set by w_init if snow is not a
problem

Most of the C source files group more than one function in a single file:
w_init.c:w_init, w_create, w_draw, w_error, w_clear, w_show, w_border,
w_title (also definitions of global variables)
w_open.c:w_open, w_link, w_select
w_putc.c:w_putc, w_puts, w__scroll, w_scroll
w_center.c:w_center
w_close.c:w_close, w_unlink, w_refresh, w_dispose
w_cursor.c:w_putcrs, crs_off, crs_on
w_fields.c:showField, getField, clearToEnd, fieldStart, fieldEnd,
fieldLeft, fieldRight, toggleInsert, delChar, addChar,
backspace, fatCursor, thinCursor

The skeletal structure of a program using the package consists of the
following steps:

1. call w_init();
2. create window with w_create();
3. open the window with w_open();
4. write to the window with w_puts(), w_putc, or w_center();
5. repeat steps 2-4 as needed; for a window which is already
open, simply call w_select to bring it to the top if it
is obscured by other windows;
6. when a window should disappear, call w_close();
7. if there is any possibility of running out of space,
call w_dispose() to free up space for any windows
no longer needed.

For input, set up Field structures with appropriate values, call showField()
to display the prompts and fields, then call getField() to read the strings
from each field. The field's structure has space for indicating whether the
field accepts letters, digits, or special characters as listed in a string
pointed to by the "specials" member. If you only want some letters or digits
and want to screen out the others, turn off the alpha or num flags and put
the ones you want in the specials string. Since getFields() returns the value
of the key the user pressed to leave the field, the caller can use this return
value to determine which action to take next (move to succeeding/previous
field, store the whole record, etc.). It can be instructive to look at the
source code for the two examples provided: winddemo.c and customio.c.


 July 25, 2018  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)