DISPLIB Reposting part 1 of 6
Gary K. Sloane
sloane at noscvax.UUCP
Sat Aug 9 10:21:06 AEST 1986
Since it got truncated across the net I have recieved about 25 requests
for a repost. Here it is! Run sh (NOT csh) against all the sharchives,
then follow the instructions in README. Good luck.
-------------------cut here ---------------------------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
# README
# Makefile
# This archive created: Fri Aug 8 17:18:55 1986
# By: Gary K. Sloane (Computer Sciences Corporation, San Diego)
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'README'
then
echo shar: "will not over-write existing file 'README'"
else
cat << \SHAR_EOF > 'README'
#
# README file for DISPLIB
#
# Donated into the public domain for any use whatever by anyone.
# Please retain this header.
#
# This display library is a seriously modified version of a
# display library posted to USENET several years ago. Many thanks.
#
# * **************************************************************** *
# * Gary K. Sloane/Computer Sciences Corporation/San Diego, CA 92110 *
# * DDD: (619) 225-8401 *
# * MILNET: sloane at nosc.ARPA *
# * UUCP: [ihnp4,akgua,decvax,dcdwest,ucbvax]!sdcsvax!noscvax!sloane *
# * **************************************************************** *
#
Here is a SIMPLE display library, similar to curses, that lets
you do full screen applications and onscreen editing from C.
There is no warranty, express or implied.
There is (alas!) no real documentation, so here are some pointers:
CAVEATS
--------
1. This is ONLY tested on a Berkeley 4.[123] system.
2. This library does NOT support screen refresh (like ctrl-L in curses)
since it does not map the screen into memory.
3. This library does NOT do windowing.
DESCRIPTION
-----------
Displib is an object archive of C language functions that allow C application
programmers to write full-screen applications. It is kind of like a stripped
down version of curses. It includes not only most of the primitives you would
expect, but also a set of functions to standardize screens within an
application.
abb - see if input is a valid abbreviation of target
bell - ring the bell on the terminal
clear - clear the entire CRT screen
cleod - clear from current cursor position to end of CRT screen
cleol - clear from current cursor position to end of line
clmsg - clear the 'message' area of the screen (see below)
clrfield - clear a field
clscr - clear the 'main' area of the screen (see below)
date2ymd - convert a mm/dd/yy date string to a yymmdd date string
editdate - edit a date onscreen in cbreak mode
edits - edit a string onscreen in cbreak mode
extract - extract delimited fields from a string
gotoxy - move the cursor to a specified row and column
home - move the cursor to the home (upper left corner) position
initscrn - clear the CRT screen and draw the 'title', 'main',
and 'message' areas
inverse - go into inverse video mode (see normal)
msg - display a message to the 'message' area
normal - go to normal video mode (see inverse)
power - exponentiation
putpad - put out a termcap string with padding
reload - overlay the current program (called by edits and editdate)
stoi - convert string to positive integer
terminit - initialize the displib data structures and check the tty
description from termcap
termreset - put the terminal back in normal (echo, cooked) mode
termset - put the terminal in funny (-echo, cbreak) mode
tmsg - go to the 'message' area
today - build today's date
ttyset - set various modes in the tty driver
The screen (if you use initscrn, tmsg, clmsg, clscr, or msg) is set up in a
"standard" form, in which the top 3 lines (the title area) is reserved for
system and screen titles, the bottom 3 lines (the message area) is used
for help, error messages, and other stuff, and the central part of the screen
(the main area) is used for the actual application. The test.c program
uses "standard" screen format.
TODO
-----
1. extract the archive via sh, NOT csh.
2. type "% make rebuild"
3. remove the rebuild paragraph from Makefile
4. type "% make all"
5. type "% test" to run a small demo (includes a date edit)
USING IT
---------
1. every program that will make calls to displib needs the following:
#include "displib.h"
2. every program that will use displib should call terminit() and
termset() *before any other displib routines*.
3. every program should call termreset() before exiting to restore the
tty to its normal (cooked with echo) state.
SHAR_EOF
fi
if test -f 'Makefile'
then
echo shar: "will not over-write existing file 'Makefile'"
else
cat << \SHAR_EOF > 'Makefile'
#
# MAKEFILE FOR THE DISPLAY LIBRARY "DISPLIB"
#
# Donated into the public domain for any use whatever by anyone.
# Please retain this header.
#
# This display library is a seriously modified version of a
# display library posted to USENET several years ago. Many thanks.
#
# * **************************************************************** *
# * Gary K. Sloane/Computer Sciences Corporation/San Diego, CA 92110 *
# * DDD: (619) 225-8401 *
# * MILNET: sloane at nosc.ARPA *
# * UUCP: [ihnp4,akgua,decvax,dcdwest,ucbvax]!sdcsvax!noscvax!sloane *
# * **************************************************************** *
#
# where should the archive be installed?
DESTDIR = .
# where is the displib.h include file
IDIR = .
# flags to cc and ld
CFLAGS = -O
all: libdisp.a test
libdisp.a: libdisp.o
ar cru libdisp.a libdisp.o
ranlib libdisp.a
test: test.o libdisp.a
cc -o test test.o libdisp.a -ltermlib
.c.o:
${CC} -I${IDIR} ${CFLAGS} -c $*.c
-ld -x -r $*.o
mv a.out $*.o
rebuild: FRC
cat part1 part2 part3 part4 > libdisp.c
rm part1 part2 part3 part4
@echo "delete the rebuild paragraph from the Makefile before going on"
FRC:
SHAR_EOF
fi
exit 0
# End of shell archive
More information about the Comp.sources.unix
mailing list