Category : C Source Code
Archive   : HIM100.ZIP
Filename : HIMSWMAN.DOC

 
Output of file : HIMSWMAN.DOC contained in archive : HIM100.ZIP







HIM
Human Interface Manager
Programmer's Guide
First Edition

For Version 1.0


Copyright 1987, 1988 Allsoft
ALL RIGHTS RESERVED.



Published by

Allsoft
100 Calle Playa Del Sol NE
Albuquerque, NM 87109
(505) 823-9528

(C) 1987, 1988 Allsoft

All rights reserved. No part of this publication may be
stored in a retrieval system, or transmitted in any
form or by any means, electronic, mechanical, photocopying,
recording or otherwise except as specified in this manual.
Printed in the United States of America.




First Printing: March, 1988






HIM and Allsoft are trademarks of Allsoft
MS-DOS is a trademark of Microsoft
IBM is a trademark of International Business Machines Corp.
Table of Contents

1 Human Interface Manager (HIM).......................................... 1-1
1.1 Overview......................................................... 1-1
1.1.1 Introduction............................................... 1-1
1.1.2 Compilers Supported........................................ 1-1
1.1.3 Components................................................. 1-1
1.1.4 Notational Conventions..................................... 1-2
1.2 Getting Started.................................................. 1-2
1.2.1 Backing Up Your Disks...................................... 1-2
1.2.2 Disk Contents.............................................. 1-2
1.2.3 Include Files.............................................. 1-3
1.2.4 Library Files.............................................. 1-3
1.2.5 Skeleton MAIN()............................................ 1-3
1.2.6 Compiling.................................................. 1-4
1.2.7 Linking.................................................... 1-4
1.3 Shareware........................................................ 1-4
1.3.1 Registration............................................... 1-5
1.3.2 Technical Support.......................................... 1-6
2 List Manager........................................................... 2-1
2.1 Introduction..................................................... 2-1
2.2 Symbolic Constants............................................... 2-1
2.2.1 Error Constants............................................ 2-1
2.2.2 List ordering constants.................................... 2-1
2.3 Module Initialization............................................ 2-1
2.4 Include Files.................................................... 2-2
2.5 Function Overview................................................ 2-2
2.6 Function Definitions............................................. 2-2
3 Keyboard Manager....................................................... 3-1
3.1 Introduction..................................................... 3-1
3.2 Components....................................................... 3-1
3.3 Symbolic Constants............................................... 3-3
3.3.1 Error Codes................................................ 3-3
3.3.2 UIR Function Codes......................................... 3-3
3.3.3 Keycode Definitions........................................ 3-3
3.3.4 Module Initialization...................................... 3-4
3.3.5 Include Files.............................................. 3-5
3.3.6 Function Overview.......................................... 3-5
3.3.7 Function Definitions....................................... 3-6
4 Window Manager......................................................... 4-1
4.1 Introduction..................................................... 4-1
4.2 Components....................................................... 4-1
4.3 Symbolic Constants............................................... 4-1
4.3.1 Colors..................................................... 4-1
4.3.2 Cursor Types............................................... 4-2
4.3.3 Scroll Directions.......................................... 4-2
4.3.4 Error Codes................................................ 4-2
4.4 Module Initialization............................................ 4-3
4.5 Include Files.................................................... 4-3
4.6 Function Overview................................................ 4-3
4.7 Function Definitions............................................. 4-5
5 Help Manager........................................................... 5-1
5.1 Introduction..................................................... 5-1
5.2 Help File Builder................................................ 5-1
5.3 Symbolic Constants............................................... 5-2

Table of Contents

5.3.1 Error Constants............................................ 5-2
5.4 Module Initialization............................................ 5-2
5.5 Include Files.................................................... 5-2
5.6 Function Overview................................................ 5-3
5.7 Function Definitions............................................. 5-3
6 Menu Manager........................................................... 6-1
6.1 Introduction..................................................... 6-1
6.2 Module Initialization............................................ 6-1
6.3 Include Files.................................................... 6-2
6.4 Function Overview................................................ 6-2
6.5 Function Definitions............................................. 6-3
7 Forms Manager.......................................................... 7-1
7.1 Introduction..................................................... 7-1
7.2 Components....................................................... 7-1
7.2.1 Kernel..................................................... 7-1
7.2.2 Special Functions.......................................... 7-1
7.2.3 Character Validation....................................... 7-1
7.2.4 Field Validation and Display............................... 7-1
7.3 Theory of Operation.............................................. 7-4
7.4 Symbolic Constants............................................... 7-6
7.5 Module Initialization............................................ 7-6
7.6 Function Overview................................................ 7-7
7.7 Function Definitions............................................. 7-10

1 Human Interface Manager (HIM)

1.1 Overview

1.1.1 Introduction

HIM (Human Interface Manager) is a library of more than 200 functions and macros
designed for use in C programs. HIM makes designing and coding user interfaces
much easier by providing a rich set of functions designed specifically for
presenting information to, and obtaining information from a user of your
application.

1.1.2 Compilers Supported

The HIM library has been successfully tested using the Microsoft C V4.0 and
V5.0 compilers. Others will be supported in the near future.

1.1.3 Components

HIM is divided into 7 separate categories, each performing a different task
relating to a user interface.

List Manager - With the List Manager your application can create a list, add and
delete any kind of data structure to the list, sort with the option of using
your comparision routine, and query items in the list via search, next, and
previous functions.

Keyboard Manager - No more messy switch statements every time you ask for a key.
Just tell the Keyboard Manager what function to call when a certain key is
pressed and the routing is handled for you! Multiple input sources, outputs,
and journal files are supported as well as the ability to define a background
routine which will be called repeatably while waiting for input.

Window Manager - Yes, it does do windows (sorry, no floors). Colors, titles on
4 sides, and a rich set of output and editing functions will give your
applications that snappy and professional look. Flexible output with color is
available with our printf() look-alike, wnprintf().

Help Manager - Nothing is appreciated more by a user than a program with
complete online documentation. The Help Manager in combination with the
Keyboard Manager's ability to trap specific keycodes (F1 maybe??) gives you the
option of providing online help easily and painlessly. All you need to do is
inform the help manager what help should be given at different points in your
program, when the user asks for help it will be there.

Menu Manager - The normally messy chore of providing menus is easy with the Menu
Manager, just create a list, add menu items to it and call one of the menu
routines! Different flavors of menus such as nested, pop-up, and browse only
are supported.

Forms Manager (optional) - Data entry couldn't be easier. With the Forms
Manager you have the ability of completely defining a input screen, field types,
flow thru the screen, individual data field help, and validation. Using these
functions in combination with the Form Painter program lets you code an
application in hours instead of days!

1 - 1
Form Painter (optional) - Used in combination with the Forms Manager, this nifty
utility lets you completely define forms "on-screen", enter help text, and
test the forms for proper input validation. After the forms have been defined
you can keep them in their Screen Definition File (SDF) for later use at runtime
or create C source code which becomes part of your finished application program.

1.1.4 Notational Conventions

The following notational conventions are used throughout this manual:

Italics - Italics are used for the names of arguments to library routines. In
an actual program, a specific name or value replaces the italicized argument
name. In an actual program, the user supplies a particular argument for the
placeholder lnum. In the description text of a routine, parameter names are
italicized so that you can scan the text and easily find the section pertaining
to the parameter of interest.

Examples - Programming examples are displayed in a special typeface to resemble
the output on your screen. Note that comments in the examples are not delimited
by /* and */ in order to produce cleaner text. If you use the program fragments
or examples you will need to delimit comments with /* and */.

Ellipsis dots - Vertical ellipsis dots are used in program example to indicate
that a portion of the program is omitted. For instatnce, in the following
example, the ellipsis dots between the two statements indicate that intervening
program lines occur but are not shown:

int lnum;

lnum = lmcreate(NULL,0,0);
.
.
.
lmdestroy(lnum);

Horizontal ellipsis dots following an item indicate that more items having the
same form may appear. For instance,

={ expression [,expression]...}

indicates that one or more expressions separated by commas may appear between
the braces ({ }).

1.2 Getting Started

This section describes what's in the HIM Library disk set, information regarding
compiling and linking, and a skeleton program which illustrates the hardest part
of any program, getting started.

1.2.1 Backing Up Your Disks

Since the distribution disks are not copy protected in any way, the normal DOS
DISKCOPY command will work just fine. Consult your DOS reference manual
regarding DISKCOPY.


1 - 2
1.2.2 Disk Contents

There is a file named DISKCONT.DOC on the disk 1 distribution floppy which
contains a listing of all distribution disks.

1.2.3 Include Files

Each package in the HIM Library has a .h include file. These files MUST be
included into your application source using the #include preprocessor directive.
For ease of updating later, put the Forms Processing include files in a separate
directory and then add this directory to your environment variable INCLUDE.
This environmental variable is filled in using the DOS SET command:

SET INCLUDE=directory1;directory2...

When the Microsoft C compiler sees a #include line it will search each of the
directories specified in the above INCLUDE variable. See your compiler
reference manual for further details.

1.2.4 Library Files

HIM has one library for each of the 4 memory models:

himmss - Microsoft Small Model Library
himmsm - Microsoft Medium Model Library
himmsc - Microsoft Compact Model Library
himmsl - Microsoft Large Model Library

The large model library can be used for Huge model programs. In order for the
linker to find your libraries you must tell it where to search, this is handled
by defining an environmental variable LIB= using the DOS SET command:

SET LIB=directory1;directory2

By putting the Forms Processing Library in one of the directories specified in
the SET LIB= command you need only specify the library name on the link line,
not the entire path.

1.2.5 Skeleton MAIN()

Below is a skeleton main() which illustrates which include files to use and
initialization of each module in the Forms Processing package. Note that this
example assumes you are using all modules of the package. If you were not going
to use the Help Manager for example, you would not include its .h file and would
not call its initialization routine. An important note is that the List Manager
is used by everybody and therfore MUST be initialized. Also, each of the
initialization routines accept parameters which define how the package will
perform. The parameters shown in the example are what most likely would be
used, you fill in the parameters to suit your application best.

#include "stdio.h" /* standard C include file */
#include "malloc.h" /* memory allocation/free */
#include "lm.h" /* list manager */
#include "km.h" /* keyboard manager */
#include "wn.h" /* window manager */

1 - 3
#include "hm.h" /* help manager */
#include "mm.h" /* menu manager */
#include "fp.h" /* forms manager */

main()
/*****/
{
int kbhit(), getch(); /* used in kminit() call */

lminit(malloc,free,0); /* init list manager FIRST */
kminit(kbhit,getch); /* init keyboard manager SECOND */
wninit(0,0,NULL,malloc,free); /* init window manager before menus */
hminit("goodhelp.hlp",0,0,0, /* and before help manager */
WNBLACK,WNCYAN);
fpinit(); /* init forms manager */

kmsir(KF1,hmhelp); /* setup keycode intercept of F1 to */
hmscontext("level1_help"); /* invoke help when pressed */
.
.
.
} /* end of main */

1.2.6 Compiling

Assuming your program source file is named "goodstuf.c", the command to compile
using Microsoft C V5.0 is:

CL /c /AL goodstuf.c

The /AL switch tells the compiler to compile for Large model. The default
without the switch is Small model. Remember to set the INCLUDE= variable to
point to your include files.

1.2.7 Linking

After compiling "goodstuf.c" you will end up with "goodstuf.obj" which needs to
be linked with the Forms Processing Library as well as other .obj modules or
libraries you might have. The link line to use for Link V3.51 is:

LINK/NOE/map goodstuf,goodstuf,goodstuf,himmsl;

Remember to set the LIB= variable to point to the subdirectory containing
himmsl.lib so the linker can find it.

1.3 Shareware

Allsoft distributes HIM with the marketing approach called "shareware". The
diskette(s) with the base library files (EXCLUDING forms and forms painter)
can be freely copied and shared with others, or purchased from Allsoft for a
small fee. We ask you to help us distribute HIM by sharing unmodified copies
of the diskette, to make it easy for other people to try HIM. We also permit
unlimited copying of the diskette(s) to make it easy for people in a company,
school, or other group to use HIM.


1 - 4
Support and continued development of HIM depends on programmers who "register"
their copy of the HIM library. Registration has a number of benefits:

- A hardbound copy of the full Human Interface Manager manual.
- Diskettes with your unique registration number.
- Allsoft support service for one year:
- Compuserve E-mail for technical questions.
- Software updates.
- C source code for base HIM library (EXCLUDING forms and form painter).
- Option to buy Forms Manager and Form Painter utility.
- Thanks from us for your support and encouragement!


Your registration makes it possible for us to enhance HIM with new
features YOU want to see and support if you have technical problems or
questions. We believe every user of HIM should have one of our manuals.

You MUST register if you incorporate any HIM routine(s) in a commercial software
program. You must NOT use any HIM routine(s) in a competing product. There is
no royalty due for registered users.

Registered owners receive a commission when someone else registers from one of
their copies. People who like HIM register and give copies to friends or
associates with IBM PC's or compatibles. The commission is our way of thanking
you for distributing HIM.

Allsoft sells HIM manuals and other materials in quantity. Larger organizations
often copy the diskette and buy our manuals. Registration for yearly support
service is available separately if you already have a manual. Call or write
for a full price list.

We really do encourage you to give away HIM diskettes...with some restrictions.
As the copyright owner, Allsoft will permit you to sell or give away copies of
the HIM library(s) diskette, with the following restrictions:

- You must NOT distribute the Forms Manager or Form Painter software.
- You must distribute ALL files on the base HIM library diskette(s).
- You must NOT distribute copies of the printed manual.
- You must NOT distribute any files from the HIM SOURCE diskette(s).
- You must use Allsoft copyright notices on media with Allsoft files.
- You must use Allsoft trademark notices on "Allsoft" and "HIM".

You may add your own files, put files on several diskettes, distribute files
via modem, or compress files as long as their contents remain unchanged. You
may print, copy, and distribute any text (OTHER THAN SOURCE CODE) contained
on the disks.

1.3.1 Registration

To register, send a check or call us with your Visa/MasterCard number. We also
accept purchase orders from established companies or organizations. If your
copy of HIM came from someone else, we need your old registration number to
credit the owner. You can get your new registration number over the phone or
by mail on your diskette(s). Use the order form following this section or
print the file HIMORDER.DOC to print your own.

1 - 5
When you get a registered copy from Allsoft, you receive new HIM diskettes with
your registration number on them. Use this number for technical support and
make sure to write it on any copies you make for associates so that the
commission can be properly sent to you.

1.3.2 Technical Support

Technical support is obtained by one of two ways; phone call-back or Compuserve
E-mail.

The phone call-back number is:

(505) 823-9528

The Compuserve E-Mail tech support account is:

[76505,2014]

Be sure to give your registration number, name, and a voice phone number where
you can be reached. If your problem is of any complexity don't bother
explaining it via E-mail, just leave your registration number, name, and phone,
voice is faster than typing!


































1 - 6
Allsoft ORDER FORM (good thru 12/88)

SEND TO:
Allsoft Via Compuserve:
100 Calle Playa Del Sol NE [76505,2014]
Albuquerque, NM 87109
(505) 823-9528

Quanity Item Price Total
======= ==== ===== =====
[ ] HIM Diskettes $16.00 _____
[ ] Hardbound Manual $45.00 _____
[ ] Support (1 yr.) $25.00 _____
[ ] Full Registration $79.00 _____
Includes:
- HIM Diskettes and manual
- Support (1 yr.) and 2 updates or HIM
C source code.
[ ] Forms Manager
Libraries (all models) $75.00 _____
Libraries and Source $99.00 _____
[ ] Form Painter (Source incl.) $49.00 _____
Overseas Shipping $20.00 _____
NM orders add 5.25% _____
TOTAL _____

Note : Forms Manager and Form Painter purchase
requires full registration.

Registration Number on current disks : __________

[ ] Check [ ] P.O. [ ] Visa/MC

Visa/MC # : _____________________________________
Exp. Date : _____________________________________

Signature : _____________________________________

SHIP TO:
Name : _____________________________________
Company : _____________________________________
Address : _____________________________________
City, St : _____________________________________
Zip : _____________________________________
Day Phone : _____________________________________












1 - 7
























































1 - 8
2 List Manager

2.1 Introduction

The List Manager is a collection of library routines which allow you to
manage lists of various flavors.

Some of the List Manager highlights:

- Creation of up to 32767 lists
- Ability to store header information with list
- Elements in list can be "Marked" and "Unmarked"
- Flexible ordering function for organizing lists
- Object oriented

The last item, object oriented, is a useful feature that deserves some
explanation. Unlike most library packages the List Manager routines do
not require that applications maintain pointers to complicated structures.
Instead, your application uses the package to create a list and in turn
receives an integer list number back. This number is used to reference the
list in all other calls to the List Manager routines. This has advantages
in that your application only has to manipulate a simple data type, an int,
and later changes to the internal list structure are transparent to older
applications

2.2 Symbolic Constants

The following symbolic constants can be found in the include file .

2.2.1 Error Constants

A successful List Manager function call will return a value greater than or
equal to zero. An error condition will cause one of the following negative
values to be returned:

Constant Value Description
======== ===== ===========
LMMAERROR -1 memory allocation error
LMBLERROR -2 bad list number
LMBEERROR -3 bad element number
LMNOEL -4 no more elements

2.2.2 List ordering constants

One of these constants can be used in the lmreorder() function:

Constant Value Description
======== ===== ===========
LMORIG 1 original order
LMASC 2 ascending order
LMDESC 3 descending order

2.3 Module Initialization

Before creating and using a list there needs to be a one time initialization

2 - 1
of the List Manager package. This initializes internal data structures and
allows you to specify your own memory allocation/deallocation routines to be
used. See the function LMINIT() for details on initialization.

2.4 Include Files

The C include file "lm.h" must be #includ'ed at the top of your application
source file in order to use the List Manager package. This gives you
access to symbolic constants used by the packages as well as letting the
compiler do parameter type checking.

2.5 Function Overview

All List Manager functions return an error code value. Zero or greater
indicates success. The functions are:

elnum= lmael(lnum,ptr,len,localf) add an element to list lnum
lnum = lmcreate(ptr,len,localf) create new list w/optional header info
code = lmdel(lnum,elnum) delete an element. -1 does all
code = lmdestroy(lnum) destroy, release mem used by list.
stat = lmelstat(lnum,elnum) mark status of an element -1 tells any
elnum= lmfindel(lnum,str,slen,casef,strt) search for an element
ptr = lmgel(lnum,elnum) get ptr to an element in list lnum
elnum= lmgfirstel(lnum) get first el with current order
ptr = lmgheader(lnum) get pointer to header.
elnum= lmglastel(lnum) get last el with current order
elnum= lmgnextel(lnum) get next el with current order
num = lmgnumels(lnum) return number of elements in list.
elnum= lmgprevel(lnum) get prev el with current order
code = lminit(mar,mfr,debugf) init package
code = lmmarkel(lnum,elnum) mark an element. -1 does all
code = lmreorder(lnum,order,croutine) reorder list. LMORIG, LMASC, or LMDESC
code = lmsel(lnum,ptr,len,localf) change size of data area for element
code = lmunmarkel(lnum,elnum) unmark an element -1 does all

2.6 Function Definitions

These List Manager function definitions are presented in alphabetical order,
each starting on a new page, to facilitate your search for information.
Function definitions are comprised of the following sections:

- Summary - function and parameter declarations
- Description - detailed description
- Return Value - explanation of return values
- See Also - related functions
- Example - programming example

A negative return value by any function indicates an error.








2 - 2
lmael

Summary

#include "malloc.h"
#include "lm.h"

int lmael(lnum, ptr, len, localf);

int lnum; list number that element gets added to
char *ptr; points to element data
int len; size of element data
int localf; memory allocation flag

Description

The lmael function is used to add something to an existing list. You must first
create a list using lmcreate before you can add something to it. Lnum is the
list number you're adding an element to, ptr points to the element data, len
is the size in characters of your data, and localf tells this function whether
or not to allocate memory for your element data and store it locally. A value
of 0 supplied for len will cause this routine to assume that ptr points to a
null terminated string and the size (including null) will be calculated for
you. A value of 1 for localf will cause memory to be allocated and the data
pointed to by ptr will be copied into this allocated block. Elements added to
a list via lmael are stored in the order they were added. If you want a
particular order for later retrieval you must use the lmreorder function.

Return Value

The lmael function returns a positive integer for future reference to this newly
added element. A negative value will be returned if lnum is invalid or memory
allocation failed. Symbolic error constants can be found in the include file
.

See Also

lmdel, lmgel, lmsel


















2 - 3
lmael

Example

#include "malloc.h"
#include "lm.h"

int lnum, elnum1, elnum2;

struct emp_info_s{
char name[40];
int age;
} employee;

lminit(malloc,free); init the list manager package
lnum = lmcreate(NULL,0,0); create empty list without header
.
.
printf("\nEnter your name , age ");
scanf("%s,%d", employee.name, &employee.age);

elnum1 = lmael(lnum,"Good Info1",0,0); add string to list
elnum2 = lmael(lnum,&employee,sizeof(employee),1); add employee record to list

































2 - 4
lmcreate

Summary

#include "malloc.h"
#include "lm.h"

int lmcreate(ptr, len, localf);
char *ptr; pointer to list header info
int len; size of list header
int localf; storage allocator flag

Description

The lmcreate function is used to create an empty list with optional header
information. Ptr is a pointer to a block of memory which holds important
information that you would like to be stored with the list structure. If you do
not have any information to be stored with the list supply a value of NULL. Len
is the size of your header structure in units of char. Localf specifies whether
memory for your header information is needed. If localf is set to 1, len amount
of memory will be allocated and your header information pointed to by ptr will
be copied into this memory block. A value of 0 for localf causes just ptr to be
saved with the list.

If your list header information is known at compile time and is static then you
would want to supply a localf value of 0. If you are building the header
structure at run time and have not allocated permanent storage for it, supply a
value of 1 for localf and the needed allocation will be done for you. You can
later obtain a pointer to the allocated block by a call to the lmgheader
function. If ptr is NULL, len and localf are ignored. If a value of 0 is
supplied for len then it will be assumed that ptr points to a null terminated
string and the size (including the null) will be calculated for you. If you
supply a non-zero value for len be sure to account for your null.

Return Value

The lmcreate function returns a positive integer list number which you will need
in order to call other list manager functions. A negative return value
indicates a memory allocation error.

See Also

lmdestroy, lmael













2 - 5
lmcreate

Example

#include "malloc.h"
#include "lm.h"

struct good_stuff_s{ header to be kept with list
int goodint;
char goodstr[80];
} good_header;
int ln; to use our list later

lminit(malloc,free); init the package
ln = lmcreate(&good_header, sizeof(good_header), 1);









































2 - 6
lmdel

Summary

#include "malloc.h"
#include "lm.h"

int lmdel(lnum,elnum);
int lnum; list number
int elnum; element number

Description

The lmdel function is used to delete an element of a list. If -1 is supplied as
elnum, all elements of lnum will be deleted. Once all elements of a list have
been deleted it is neccessary to call lmdestroy to delete the empty list
structure. Only memory allocated for local element data storage (localf == 1)
will be freed.

Return Value

A return value of 0 indicates all went well. A negative value means either lnum
or elnum was invalid.

See Also

lmael, lmcreate

Example

#include "malloc.h"
#include "lm.h"

int lnum1,lnum2,elnum;

lminit(malloc,free); init the package
lnum1 = lmcreate(NULL,0,0); create empty list wo/header
lnum2 = lmcreate("LIST #2",0,0); create empty list w/header
elnum = lmael(lnum1,"Good_Info",0,0); create element for list
lmael(lnum2,"Menu Item 1",0,0); build another list
lmael(lnum2,"Menu Item 2",0,0);
lmael(lnum2,"Menu Item 3",0,0);
.
.
.
lmdel(lnum1,elnum); delete 1 element from 1st list
lmdel(lnum2,-1); delete all elements from 2nd list









2 - 7
lmdestroy

Summary

#include "malloc.h"
#include "lm.h"

int lmdestroy(lnum);
int lnum; list number to be destroyed

Description

The lmdestroy function is used to destroy a list that was created with lmcreate.
Any memory that was allocated for list elements and header information will be
freed. Lnum is the list number you wish to destroy. Supplying a value of -1
for lnum will destroy ALL lists that have been created. This function will only
free memory that was allocated for a list when the localf value in the lmcreate
call was set to 1. You are responsible for your own static data structures.

Return Value

This function returns a value of 0 if all went well. A negative integer will be
returned if a bad list number is given (excluding -1).

See Also

lmcreate, lminit, lmael

Example

#include "malloc.h"
#include "lm.h"

int ln1, ln2;

lminit(malloc,free); init the package
ln1 = lmcreate("password=SECRET", 0, 0); string is static so don't allocate
memory
ln2 = lmcreate(NULL,0,0); no header needed
.
.
.
lmdestroy(-1); get rid of ALL lists created













2 - 8
lmelstat

Summary

#include "malloc.h"
#include "lm.h"

int lmelstat(lnum,elnum);
int lnum; list number
int elnum; element number

Description

The lmelstat function returns the "mark" status of element elnum in list lnum.
If -1 is supplied for elnum, the logical OR of all list elements will be
returned. This allows to easily see if any elements are marked.

Return Value

A value of 0 will be returned if the list element is "unmarked", 1 indicates the
element is "marked", and a negative return value indicates that lnum or elnum is
invalid. All elements are initially created with a status of "unmarked".

See Also

lmmarkel, lmunmarkel

Example

#include "malloc.h"
#include "lm.h"

int lnum, elnum;
char name[40];
char sex;

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create empty list

printf("\nEnter your name, sex ");
scanf("%s,%c",name,&sex);
elnum = lmael(lnum,name,0,1); add name to list
if (toupper(sex) == 'M')
lmmarkel(lnum,elnum); mark name if sex == male
.
.
.
printf("\nName Sex");
printf("\n======================");
printf("\n%19s%c",lmgel(lnum,elnum),(lmelstat(lnum,elnum) == 1)?'M':'F');






2 - 9
lmfindel

Summary

#include "malloc.h"
#include "lm.h"

int lmfindel(lnum,str,slen,casef,strt);
int lnum; list number
char *str; search target
int slen; how many chars to match
int casef; case sensitive flag
int strt; start element

Description

The lmfindel function is used to search for an item in a list. Lnum is the list
to search, str is the string to search for, and strt sets the search starting
position in the list. A value of 0 for casef signifies a case insensitive
search, 1 means case matters. Only the first slen characters of str are looked
at in doing the search. If slen is 0, the entire string is searched for.

If you want the search to start at the first element of lnum, set strt to 0.
Since lmfindel uses the retrieval functions lmgel and lmgnextel the list will be
traversed in the order that was set by lmreorder.

Note that this function is only good for searching list elements that are
strings. If you need to search for binary data such as structures, create your
own search routine using lmgel, lmfirstel, and lmnextel.

Return Value

A positive integer return value from lmfindel indicates that an element matching
your search criteria was found. This positive number will be the actual element
number which can be used in the retrieval routine lmgel. A negative number
returned indicates a match was not found.

See Also

lmgfirstel, lmgnextel, lmgprevel, lmglastel, lmgnumels
















2 - 10
lmfindel

Example

#include "malloc.h"
#include "lm.h"

int lnum, elnum;

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create empty list wo/header
lmael(lnum,"Pyle, Gomer",0,0); build a list of names
lmael(lnum,"Butts, Seymour",0,0);
lmael(lnum,"Peabody, Prisilla",0,0);
.
.
lmreorder(lnum,LMASC,(int (*)())NULL); order list alphabetically
elnum = lmfindel(lnum,"P",1,0,0); will find "Peabody, Prisilla"
elnum = lmfindel(lnum,"Butts, Seymour ",0,0,0); no match. Space after "Seymour"





































2 - 11
lmgel

Summary

#include "malloc.h"
#include "lm.h"

char *lmgel(lnum,elnum);
int lnum; list number
int elnum; element number

Description

The lmgel function obtains a pointer to list element elnum from list number
lnum. The element must have been added using the lmael function.

Return Value

A character pointer to the list element data is returned. If list lnum or
element elnum doesn't exist, NULL will be returned. Be sure to cast the
character pointer returned to the data type that was stored.

See Also

lmael, lmsel

Example

#include "malloc.h"
#include "lm.h"

int lnum, elnum;
char *name[40];

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create list wo/header
.
.
printf("\nEnter your name");
scanf("%s",name);
elnum = lmael(lnum,name,0,1); add name to list















2 - 12
lmgfirstel

Summary

#include "malloc.h"
#include "lm.h"

int lmgfirstel(lnum);
int lnum; list number

Description

The lmgfirstel function will obtain the first element in list lnum. "First"
depends on the ordering of your list. If lmreorder has not been called then the
first element added with lmael will be obtained.

Return Value

A positive integer returned indicates you now have the first element in the
list. A negative return value means the list is empty or lnum is invalid.

See Also

lmgnextel, lmgprevel, lmglastel, lmgnumels

Example

#include "malloc.h"
#include "lm.h"

int lnum;

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create empty list wo/header
lmael(lnum,"ZZZZ",0,0); build backward ordered list
lmael(lnum,"YYYY",0,0);
lmael(lnum,"XXXX",0,0);
.
.
printf("\n1st element is %s",lmgel(lnum,lmgfirstel(lnum))); "ZZZZ" will print
lmreorder(lnum,LMASC,(int (*)())NULL); now list is in ascending order
printf("\n1st element is %s",lmgel(lnum,lmgfirstel(lnum))); "XXXX" will print














2 - 13
lmgheader

Summary

#include "malloc.h"
#include "lm.h"

char *lmgheader(lnum);
int lnum; list number

Description

The lmgheader function obtains a pointer to the header information for list
number lnum. The existence of this header information depends on what
parameters were passed in the call to lmcreate.

Return Value

A character pointer to the header information specified for lmcreate will be
returned. If header information doesn't exist for lnum, NULL will be returned.

See Also

lmcreate

Example

#include "malloc.h"
#include "lm.h"

lminit(malloc,free); init the package
ln = lmcreate("Heres my header",0,0); create the list w/header
.
.
.
printf("\Header == %s",lmgheader(ln)); print it




















2 - 14
lmglastel

Summary

#include "malloc.h"
#include "lm.h"

int lmglastel(lnum);
int lnum; list number

Description

The lmglastel function will obtain the last element in list lnum. "Last"
depends on the ordering of your list.

Return Value

A positive integer returned indicates you now have the last element in the list.
A negative return value means the list is empty or lnum is invalid.

See Also

lmfirstel, lmgprevel, lmgnextel, lmgnumels

Example

#include "malloc.h"
#include "lm.h"

int lnum;

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create empty list wo/header
lmael(lnum,"ZZZZ",0,0); build backward ordered list
lmael(lnum,"YYYY",0,0);
lmael(lnum,"XXXX",0,0);
.
.
printf("\nlast element is %s",lmgel(lnum,lmglastel(lnum))); "XXXX" will print
lmreorder(lnum,LMASC,(int (*)())NULL); now list is in ascending order
printf("\nlast element is %s",lmgel(lnum,lmglastel(lnum))); "ZZZZ" will print















2 - 15
lmgnextel

Summary

#include "malloc.h"
#include "lm.h"

int lmgnextel(lnum);
int lnum; list number

Description

The lmgnextel function will obtain the next element in list lnum. "Next"
depends on the ordering of your list and what retrieval function has been called
last. Any list manager function that returns an element number sets an internal
pointer. The lmgnextel and lmgprevel routines use this internal pointer in
deciding which element to return.

Return Value

A positive integer returned indicates you now have the next element in the list.
A negative return value means there is no next element or lnum is invalid.

See Also

lmfirstel, lmgprevel, lmglastel, lmgnumels

Example

#include "malloc.h"
#include "lm.h"

int lnum;

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create empty list wo/header
lmael(lnum,"ZZZZ",0,0); build backward ordered list
lmael(lnum,"YYYY",0,0);
lmael(lnum,"XXXX",0,0);
.
.
printf("\n1st element is %s",lmgel(lnum,lmgfirstel(lnum))); "ZZZZ" will print
lmreorder(lnum,LMASC,(int (*)())NULL); now list is in ascending order
printf("\n1st element is %s",lmgel(lnum,lmgfirstel(lnum))); "XXXX" will print
printf("\nNext element is %s",lmgel(lnum,lmgnextel(lnum))); "YYYY" will print











2 - 16
lmgnumels

Summary

#include "malloc.h"
#include "lm.h"

int lmgnumels(lnum);
int lnum; list number

Description

The lmgnumels function returns the number of elements in a list. All elements,
regardless of their "mark/unmark" status are counted.

Return Value

The total number of elements in lnum is returned. A negative value indicates an
invalid lnum value.

See Also

lmael, lmgfirstel, lmgnextel

Example

#include "malloc.h"
#include "lm.h"

int lnum;

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create empty list wo/header
lmael(lnum,"item 1",0,0); build a list
lmael(lnum,"item 2",0,0);
.
.
.
printf("\nThere are %d elements in list %d",lmgnumels(lnum),lnum);

















2 - 17
lmgprevel

Summary

#include "malloc.h"
#include "lm.h"

int lmgprevel(lnum);
int lnum; list number

Description

The lmgprevel function will obtain the previous element in list lnum.
"Previous" depends on the ordering of your list and what retrieval function has
been called last. Any list manager function that returns an element number sets
an internal pointer. The lmgnextel and lmgprevel routines use this internal
pointer in deciding which element to return.

Return Value

A positive integer returned indicates you now have the previous element in the
list. A negative return value means there is no previous element or lnum is
invalid.

See Also

lmfirstel, lmgnextel, lmglastel, lmgnumels

Example

#include "malloc.h"
#include "lm.h"

int lnum;

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create empty list wo/header
lmael(lnum,"ZZZZ",0,0); build backward ordered list
lmael(lnum,"YYYY",0,0);
lmael(lnum,"XXXX",0,0);
printf("\n1st element is %s",lmgel(lnum,lmgfirstel(lnum))); "ZZZZ" will print
lmreorder(lnum,LMASC,(int (*)())NULL); now list is in ascending order
printf("\n1st element is %s",lmgel(lnum,lmgfirstel(lnum))); "XXXX" will print
printf("\nnext element is %s",lmgel(lnum,lmgnextel(lnum))); "YYYY" will print
printf("\nprev element is %s",lmgel(lnum,lmgprevel(lnum))); "XXXX" will print











2 - 18
lminit

Summary

#include "malloc.h"
#include "lm.h"

int lminit(umar,umfr,debugf);
char *(*mar)(); Pointer to memory allocation routine
void (*mfr)(); Pointer to memory free routine
int debugf; true if internal node checks to be done

Description

Lminit initializes the list manager package and must be called prior to
calling any other list manager routines. Umar points to a function which
allocates, and returns a pointer to, a specified block of memory. Umfr
points to a function which frees a previously allocated block of memory.

The synopsis for umar and umfr is:

char *(*umar)(size);
int size; number of characters to allocate

void (*umfr)(cptr);
char *cptr; pointer to allocated block

If size characters of memory cannot be allocated by your supplied routine
umar then a value of NULL should be returned. The supplied routine umfr will
never be called with cptr pointing to an invalid block of memory, therefore
your routine does not need to have this checking built in.

The reason for using supplied allocation/free routines is to give you a hand
in monitoring that all important resource, system memory. If you do not want
to supply your own allocation/free routines then supply pointers to the built
in C library routines malloc() and free().

The value of debugf determines if internal consistency checks are to be done
each time a list is accessed. A value of one (1) turns the checks on, a
value of zero (0) turns them off. When consistency checks are on, the list
manager runs very slow but can help when an errant pointer elsewhere in your
program decides to trash memory. When checking is enabled (debugf == 1) and
a list node is determined to be corrupted a error message will be printed to
stderr and your program aborted.

Return Value

The lminit() function always returns an integer value of 0.

See Also

lmcreate, lmdestroy




2 - 19
lminit

Example

#include "malloc.h"
#include "lm.h"

lminit(malloc,free,0); All allocation/free calls will be to library routines
















































2 - 20
lmmarkel

Summary

#include "malloc.h"
#include "lm.h"

int lmmarkel(lnum,elnum);
int lnum; list number
int elnum; element number

Description

The lmmarkel function is used to "mark" element elnum is list lnum. If -1 is
supplied for elnum, all elements in lnum will be marked. This mark attribute is
for use by application routines you write and is not looked at by any of the
list manager functions. When you create a new element via lmael, its mark
status is set to FALSE.

Return Value

A return value of 0 indicates all went well. A negative value indicates an
invalid list or element number.

See Also

lmunmarkel, lmelstat

Example

#include "malloc.h"
#include "lm.h"

int lnum, el1, el2, el3;

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create list wo/header
el1 = lmael(lnum,"Bob",0,0); build the list
el2 = lmael(lnum,"Samantha",0,0);
el3 = lmael(lnum,"Sonya",0,0);
lmmarkel(lnum,el1); mark the males















2 - 21
lmreorder

Summary

#include "malloc.h"
#include "lm.h"

int lmreorder(lnum,order,croutine);
int lnum; list number
int order; type of ordering
int (*croutine)(); compare routine

Description

The lmreorder function is used to change the ordering of elements in a list.
Lnum is the list to be reordered, order indicates ascending, descending, or
original reordering, and croutine points to an optional comparision routine that
lmreorder is to use in sorting the list.

The following symbolic constants for order can be found in the include file
:

Constant Ordering
======== ========
LMASC Ascending order
LMDESC Descending order
LMORIG Original order elements were added via lmael

If croutine is supplied it must be written for the following synopsis:

int (*croutine)(element1, element2, order);
char *element1, *element2;
int order;

The return value expected back is:

1 if element1 and element2 should be swapped based on order.
0 if element1 and element2 should not be swapped based on order.

The criteria for determining what value your comparision should return is this:

- Assume element1 and element2 are the only 2 elements of a list.
- Assume element1 is the first element in the list.

Depending on the value of order:

-- If element1 and element2 need to be swapped, return 1.
-- If element1 and element2 do not need to be swapped, return 0.

A built in string comparision routine will be used if croutine is set to
(int (*)())NULL.





2 - 22
lmreorder

Return Value

A value of 0 will be returned if all went well. A negative value indicates an
invalid value for lnum.

See Also

lmgfirstel, lmgnextel, lmglastel

Example

#include "malloc.h"
#include "lm.h"

int lnum;

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create empty list wo/header
lmael(lnum,"ZZZZ",0,0); build backward ordered list
lmael(lnum,"YYYY",0,0);
lmael(lnum,"XXXX",0,0);
printf("\n1st element is %s",lmgel(lnum,lmgfirstel(lnum))); "ZZZZ" will print
lmreorder(lnum,LMASC,(int (*)())NULL); now list is in ascending order
printf("\n1st element is %s",lmgel(lnum,lmgfirstel(lnum))); "XXXX" will print






























2 - 23
lmsel

Summary

#include "malloc.h"
#include "lm.h"

int lmsel(lnum,elnum,ptr,len,localf);
int lnum; list number
int elnum; element number
char *ptr; pointer to new element data
int len; size of new data
int localf; storage allocation flag

Description

The lmsel function is used when you need to change the size of a list element's
data area. Lnum and elnum are the list and element number you're referencing.
Ptr, len, and localf perform the same function as in lmael. Essentially, this
function allows you to change an elements data pointer, size, and/or storage
while keeping the same element number.

Return Value

The lmsel function returns 0 if all went well. A negative return value
indicates either a bad list number or element number, or a memory allocation
error. Symbolic error constants can be found in the include file .

See Also

lmael

























2 - 24
lmsel

Example

#include "malloc.h"
#include "lm.h"

int lnum, elnum;

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create list wo/header
elnum = lmael(lnum,"Default data",0,0); create an element
.
.
moddata(lnum,elnum);
.
.

moddata(lnum,elnum)
/*****************/
int lnum, elnum;
{
char name[80];

printf("\nEnter your name");
scanf("%s",name);
lmsel(lnum,elnum,name,80,1); store new element data. Localf value of 1
will cause 81 bytes of memory to be allocated
and the contents of name[] will be copied
into the allocated block.
}

























2 - 25
lmunmarkel

Summary

#include "malloc.h"
#include "lm.h"

int lmunmarkel(lnum,elnum);
int lnum; list number
int elnum; element number

Description

The lmunmarkel function is used to "unmark" element elnum is list lnum. If -1
is supplied for elnum, all elements in lnum will be unmarked. This mark
attribute is for use by application routines you write and is not looked at by
any of the list manager functions. When you create a new element via lmael, its
mark status is set to FALSE.

Return Value

A return value of 0 indicates all went well. A negative value indicates an
invalid list or element number.

See Also

lmmarkel, lmelstat

Example

#include "malloc.h"
#include "lm.h"

int lnum, el1, el2, el3;

lminit(malloc,free); init the package
lnum = lmcreate(NULL,0,0); create list wo/header
el1 = lmael(lnum,"Bob",0,0); build the list
el2 = lmael(lnum,"Samantha",0,0);
el3 = lmael(lnum,"Sonya",0,0);
lmmarkel(lnum,el1); mark the male
.
.
.
lmunmarkel(lnum,-1); unmark all marked elements











2 - 26
3 Keyboard Manager

3.1 Introduction

The Keyboard Manager allows you great flexibility in obtaining and redirecting
keystrokes from a user while running your application. Features include:

- Input from keyboard, file, or defined input sources
- Filtering allows input of function keys from all input sources
- Input can be redirected to a file and/or defined outputs
- Intercept functions can be called when a defined key is hit
- Application defined background routine called before each key input
- Object oriented

3.2 Components

As can be seen in Figure KM-1, the Keyboard Manager is made up of 4 separate and
complete modules, an input multiplexer, filter, redirector, and intercept
processor.

Multiplexer - The multiplexer provides a means of obtaining keycodes from many
different input sources, while as an added convenience has a mechanism for
calling a background function when waiting for input. Referring to Figure KM-1,
the possible input sources to the multiplexer are the keyboard, text file, or
user supplied input functions. All of these sources are definable by you and
there is no limit on the number of user input routines you can have. An example
user input routine which reads a mouse and simulates arrow keys is supplied with
this package for your use.

Filter - The filter provides a mechanism for inputting non-printable ASCII
characters and IBM specific function keys from an input source other than the
keyboard. If a character sequence of the form: ~ddd is encountered by the
filter it will be translated into a single keycode output, where ddd is the
decimal equivalent of the desired keycode. This convention for representing
keycodes allows for easy input from a file or user input routines and is used by
the next module, the redirector.

Redirector - The redirector module has the ability to redirect keycodes to an
open journal file and/or user supplied output routines. There is no limit on
the number of user output routines you can have and the file output will be put
in a form usable by the filter module. Note that all keycodes entering this
module are passed to the calling routine in addition to the outputs.

Intercept Processor - This last module provides a very powerful function, that
of calling a user supplied routine whenever a certain keycode is encountered. A
code returned by the keycode activated function determines if the code is passed
to the calling routine.









3 - 1
Keyboard File Application Input Routines
\ | /
\ | /
**************************
* *
* Input Multiplexer * ---> Background Routine
* *
**************************
|
| Code (0-255) or (300-432)
\|/
**************************
* *
* Filter *
* *
**************************
|
| Code (0-255) or (300-432)
\|/
**************************
* * ---> File
* Redirector *
* * ---> Application Output Routines
**************************
|
| Code (0-255) or (300-432)
\|/
**************************
* *
* Intercept Processor * ---> Application Intercept Routines
* *
**************************
|
| Code (0-255) or (300-432)
\|/

Calling Routine

Figure KM-1
Keystroke Pipeline

Context Save/Restore - The last feature needing mention is the ability to push
and pop the current module context. This allows a child subroutine, such as an
editor, to save the current state of the keyboard manager, reconfigure it to
its liking, and before exiting restore the package to the state it was in before
being called. There is no limit on the depth of context nesting other than
available memory.









3 - 2
3.3 Symbolic Constants

All of the following constants are defined in the include file .

3.3.1 Error Codes

Any negative return value indicates one of the following errors:

Constant Value Description
=============================================
KMMAERROR -1 Memory allocation error
KMFOERROR -2 File open error
KMFCERROR -3 File close error
KMFRERROR -4 File read error
KMFWERROR -5 File write error

3.3.2 UIR Function Codes

These are the possible operations that may be asked of a user supplied input
routine:

Constant Value Description
=============================================
fuirsabort 1 Set active abort code
fuirqabort 2 Is abort code pending?
fuirchavail 3 Is character available?
fuirgetch 4 Return a character

3.3.3 Keycode Definitions

Any keycode returned that is in the range 0-127 will map to a normal ASCII
character. A keycode value >300 indicates that one of the keyboard function
keys has been pressed. Here are constants that your applications should use
when looking for certain keycodes:

Constant Value Description
=============================================
KBELL 7 ASCII ctrl-g character
KBS 8 ASCII ctrl-h character
KTAB 9 ASCII ctrl-i character
KLF 10 ASCII line feed character
KCR 12 ASCII carriage return
KESC 27 ASCII escape character
KBTAB 315 Backwards tab key
KF1 359 Function keys
KF2 360
KF3 361
KF4 362
KF5 363
KF6 364
KF7 365
KF8 366
KF9 367
KF10 368
KHOME 371

3 - 3
KUP 372
KPGUP 373
KLEFT 375
KRIGHT 377
KEND 379
KDOWN 380
KPGDN 381
KINS 382
KDEL 383
KSF1 384 Shifted Function keys
KSF2 385
KSF3 386
KSF4 387
KSF5 388
KSF6 389
KSF7 390
KSF8 391
KSF9 392
KSF10 393
KCF1 394 Ctrl Function keys
KCF2 395
KCF3 396
KCF4 397
KCF5 398
KCF6 399
KCF7 400
KCF8 401
KCF9 402
KCF10 403
KAF1 404 Alt Function keys
KAF2 405
KAF3 406
KAF4 407
KAF5 408
KAF6 409
KAF7 410
KAF8 411
KAF9 412
KAF10 413

3.3.4 Module Initialization

Before the Keyboard Manager can be used it must be initialized. This is
accomplished by calling the kminit function before any other Keyboard Manager
functions and AFTER calling the list manager initialization function lminit.
Since the Keyboard Manager makes extensive use of the List Manager it must be
initialized first. By calling kminit you are allowing internal data structures
to be setup and telling the package which functions to call for obtaining a
"keyboard" character. A skeleton initialization is given here:

#include list manager include file
#include keyboard manager include file
This file (km.h) MUST be included
#include for malloc and free declarations


3 - 4
int kbhit(), getch(); used by keyboard manager

lminit(malloc,free,0); initialize the list manager first
kminit(kbhit,getch); initialize the keyboard manager

The 2 function pointers supplied in the kminit call tell the package which
routines to call for determining when a keycode is ready (kbhit), and for
obtaining a keycode (getch). You can supply pointers to your own routines by
following the following synopsis:

int kbhit(); returns non-zero if keycode ready
int getch(); waits for keycode then returns it

Note that the routine you supply in place of kbhit does not wait for a key, it
just reports whether or not one is ready.

If you intend to use other HIM routines it is important that you return codes
as given in the Symbolic Constants section otherwise it is up to you what codes
to return and how you use them.

3.3.5 Include Files

The C include file "km.h" must be #includ'ed at the top of your application
source file in order to use the Keyboard Manager package. This gives you
access to symbolic constants used by the packages as well as letting the
compiler do parameter type checking.

3.3.6 Function Overview

All Keyboard Manager functions return an error code value. Zero or greater
indicates success. The functions are:

code = kmclosei() close input journal file
code = kmcloseo() close output journal file
kmdbgr() delete background routine
kmdir(keycode) delete intercept routine for keycode
kmduir(unum) delete user input routine
kmduor(unum) delete user output routine
ptr = kmgbgr() get pointer to background function
keycode = kmgesc() get current filtering escape char
keycode = kmgetch() wait for keycode from an input source
ptr = kmgir(keycode) get pointer to intercept routine
ptr = kmguir(unum) get pointer to user input routine
ptr = kmguor(unum) get pointer to user output routine
code = kminit(kquery,kget) init keyboard manager
code = kmkbhit() query if keycode available
code = kmopeni(filename) open file for input
code = kmopeno(filename) open file for output
kmpop() pop keyboard manager context
code = kmpush() push keyboard manager context
kmresumebgr() resume calling background routine
kmresumei() resume input from input file
kmresumeir(keycode) resume intercept routine for keycode
kmresumeo() resume output to output file
kmresumeuir(unum) resume input from user input routine

3 - 5
kmresumeuor(unum) resume output to user output routine
kmsbgr(ptr) register background routine
kmsesc(keycode) register escape char for filtering
code = kmsir(keycode,ptr) register intercept routine for keycode
code = kmsuir(ptr) register user input routine
code = kmsuor(ptr) register user output routine
kmsuspendbgr() suspend background routine
kmsuspendi() suspend input from open input file
kmsuspendir(keycode) suspend intercept routine for keycode
kmsuspendo() suspend output to open output file
kmsuspenduir(unum) suspend user input routine
kmsuspenduor(unum) suspend user output routine

3.3.7 Function Definitions

These List Manager function definitions are presented in alphabetical order,
each starting on a new page, to facilitate your search for information.
Function definitions are comprised of the following sections:

- Summary - function and parameter declarations
- Description - detailed description
- Return Value - explanation of return values
- See Also - related functions
- Example - programming example

A negative return value by any function indicates an error.






























3 - 6
kmclosei

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmclosei(); close input file

Description

The kmclosei function is used to close an open keycode input file.

Return Value

A 0 return value indicates a successful close while a negative value indicates
an error. You will not get an error for closing an already closed file.

See Also

kmcloseo, kmopeni, kmopeno, kmsuspendi, kmsuspendo

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
.
.
kmopeni("D:\\goodin.dat"); open input file
.
.
.
kmclosei(); close it
















3 - 7
kmcloseo

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmcloseo(); close output file

Description

The kmcloseo function is used to close an open keycode output file.

Return Value

A 0 return value indicates a successful close while a negative value indicates
an error. You will not get an error for closing an already closed file.

See Also

kmclosei, kmopeni, kmopeno, kmsuspendi, kmsuspendo

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
.
.
kmopeno("D:\\goodout.dat"); open output file
.
.
.
kmcloseo(); close it
















3 - 8
kmdbgr

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmdbgr(); delete background routine

Description

The kmdbgr functions is used to delete the currently registered background
routine.

Return Value

The kmdbgr functions has no return value.

See Also

kmsbgr, kmgbgr, kmsuspendbgr, kmresumebgr



































3 - 9
kmdbgr

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

#include "time.h" used by showtime() function

int kbhit(), getch(); used in kminit() call
void showtime(); for kmsbgr() function call
void (*ptr)(); for kmgbgr() function call
int wnum;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wnum = wncreate(0,0,80,25,WNBLUE,
WNCYAN,WNBLUE,WNCYAN); open full screen window
kmsbgr(showtime); register background routine
ptr = kmgbgr(); get pointer to current background
kmdbgr(); delete current background routine
}

showtime() show time while waiting for key input
{
static long lasttime;
long nowtime;
long time();
struct tm *newtime;

if (time(&nowtime) != lasttime){ we'll display time if changed
wnlocate(wnum,1,1); position the cursor in main window
newtime = localtime(&nowtime); get time in usable format
wnprintf(wnum,"%s",
asctime(newtime)); print time in upper left of window
lasttime = nowtime; update the status var
}
}
















3 - 10
kmdir

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmdir(keycode); delete intercept routine
int keycode; keycode to intercept

Description

The kmdir function will delete the intercept routine being called for keycode.
A value of -1 supplied for keycode will delete ALL intercept routines.

Return Value

The kmdir function has no return value. If keycode is invalid it will be
ignored.

See Also

kmgir, kmsir, kmsuspendir, kmresumeir
































3 - 11
kmdir

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int myhelproutine(); called when F1 is pressed
int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
kmsir(KF1,myhelproutine); register F1 as help key
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()
kmsuspenduor(unum); suspend output for awhile
kmsuspendir(KF1); don't give help for password
getpassword(); call a useful routine
kmresumeuor(unum); resume output
kmresumeir(KF1); make help active again
.
.
.
kmduor(-1); delete ALL output routines
kmdir(-1); delete ALL intercept routines
.
.
.
myhelproutine(code) called when F1 is pressed
/*****************/
int code; current key being input
{
. this would be a help routine
. for your user. Instead of writing
. your own, use the Help Manager!
}








3 - 12
kmduir

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmduir(unum); delete UIR
int unum; user input routine number

Description

The kmduir routine will delete UIR unum from the internal list of input sources.
A value of -1 supplied as unum will delete ALL user input routines.

Return Value

The kmduir function has no return value. If unum is invalid it is ignored.

See Also

kmguir, kmsuir, kmsuspenduir, kmresumeuir

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

see kmsuir for example

























3 - 13
kmduor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmduor(unum); delete UOR
int unum; user output routine number

Description

The kmduor function is used to delete a User Output Routine (UOR).

A value of -1 for unum will cause the kmduor function to delete ALL registered
User Output Routines.

Return Value

The kmduor function has no return value. If unum is invalid, no action will be
taken.

See Also

kmguor, kmsuor, kmsuspenduor, kmresumeuor






























3 - 14
kmduor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()
kmsuspenduor(unum); suspend output for awhile
getpassword(); call a useful routine
kmresumeuor(unum); resume output
.
.
.
kmduor(-1); delete ALL output routines
























3 - 15
kmgbgr

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void (*kmgbgr())(); get pointer to background routine

Description

The kmgbgr function is used to get a pointer to the currently registered
background routine.

Return Value

The kmgbgr will return a pointer to the currently registered background
routine. If there is no background routine a value of (void (*)())NULL
is returned.

See Also

kmsbgr, kmdbgr, kmsuspendbgr, kmresumebgr
































3 - 16
kmgbgr

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

#include "time.h" used by showtime() function

int kbhit(), getch(); used in kminit() call
void showtime(); for kmsbgr() function call
void (*ptr)(); for kmgbgr() function call
int wnum;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wnum = wncreate(0,0,80,25,WNBLUE,
WNCYAN,WNBLUE,WNCYAN); open full screen window
kmsbgr(showtime); register background routine
ptr = kmgbgr(); get pointer to current background
kmdbgr(); delete current background routine
}

showtime() show time while waiting for key input
{
static long lasttime;
long nowtime;
long time();
struct tm *newtime;

if (time(&nowtime) != lasttime){ we'll display time if changed
wnlocate(wnum,1,1); position the cursor in main window
newtime = localtime(&nowtime); get time in usable format
wnprintf(wnum,"%s",
asctime(newtime)); print time in upper left of window
lasttime = nowtime; update the status var
}
}
















3 - 17
kmgesc

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmgesc(); get escape character
void kmsesc(ch); set escape character
int ch; new escape character

Description

The kmgesc function is used to obtain the current filter "escape" character
while kmsesc is used to set a new escape character.

The "escape" character is the one character the user types in order to signal
the keyboard manager that they are entering a 3 digit keycode.

At initialization, the escape code is a tilde (~) character. If the user
wanted to input the keycode for Ctrl-G he/she could type ~007 and the
keyboard manager would only pass one keycode (ctrl-g) to the calling
application.

Note that the escape code setting does not get passed to the new keyboard
context if a kmpush is done.

Return Value

The kmgesc function returns the current escape character. The kmsesc function
has no return value.

See Also

mpush, kmpop

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

nt kbhit(), getch(); used in kminit() call
int c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager

kmsesc('$'); use dollar sign as trigger






3 - 18
kmgetch

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmgetch();

Description

The kmgetch function is used to obtain a keycode from the Keyboard Manager.
Unlike the kmkbhit function, this routine will not return until a keycode is
available from an input source. If a particular input source was active the
last time this function was called, that source will be the first one queried
for a keycode.

While this routine is waiting for a keycode from an input source the registered
background routine (if any) will be called repeatabley. Also, no matter what
input source is active, if another input source has an abort character pending
it will be passed thru. An example of this would be if keycodes were coming
from an input file but the user pressed the abort code at the keyboard.
Normally you would not want mixing of input characters like this but the abort
code is the exception.

Return Value

A keycode in one of the ranges 0-127 or 300-432 will be returned. A keycode in
the range 0-127 indicates the user entered a normal ASCII character while a
keycode in the range 300-432 indicates a function key was input.

See Also

kmkbhit, kmopeni, kmsbgr, kmsuir

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager

c = kmgetch(); wait for a keycode







3 - 19
kmgir

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int (*kmgir(keycode))(); get pointer to intercept routine
int keycode; keycode to intercept

Description

The kmgir function obtains a pointer to the intercept routine registered for
keycode. This allows a subroutine to reassign a keycode and put it back before
returning (a better way is to use kmpush and kmpop).

Return Value

Kmgir will return a pointer to the routine being called when keycode is input.
A value of (void (*)())NULL will be returned if there is no intercept routine
registered for keycode.

See Also

kmsir, kmdir, kmsuspendir, kmresumeir






























3 - 20
kmgir

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int myhelproutine(); called when F1 is pressed
int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
kmsir(KF1,myhelproutine); register F1 as help key
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()
kmsuspenduor(unum); suspend output for awhile
kmsuspendir(KF1); don't give help for password
getpassword(); call a useful routine
kmresumeuor(unum); resume output
kmresumeir(KF1); make help active again
.
.
.
kmduor(-1); delete ALL output routines
kmdir(-1); delete ALL intercept routines
.
.
.
myhelproutine(code) called when F1 is pressed
/*****************/
int code; current key being input
{
. this would be a help routine
. for your user. Instead of writing
. your own, use the Help Manager!
}








3 - 21
kmguir

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int (*kmguir(unum))(); get pointer to UIR
int unum; user input routine number

Description

The kmguir function will return a pointer to user input routine unum.

Return Value

A pointer to User Input Routine unum will be returned by kmguir. If unum does
not exist, a value of int (*)())NULL will be returned.

See Also

kmsuir, kmduir, kmsuspenduir, kmresumeuir

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

see kmsuir for example

























3 - 22
kmguor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int (*kmguor(unum))(); get pointer to UOR
int unum; user output routine number

Description

The kmguor function is used to get a pointer to a User Output Routine (UOR).

Return Value

The kmguor function returns a pointer to registered UOR unum or
(void (*)())NULL if unum is invalid.

See Also

kmsuor, kmduor, kmsuspenduor, kmresumeuor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()
kmsuspenduor(unum); suspend output for awhile
getpassword(); call a useful routine
kmresumeuor(unum); resume output
.
.
.
kmduor(-1); delete ALL output routines


3 - 23
kminit

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kminit(kquery,kget);
int (*kquery)(); keycode ready? routine
int (*kget)(); keycode fetch routine

Description

The kminit function is used to initialize the Keyboard Manager and must be
called before any other Keyboard Manager routines and AFTER the List Manager
lminit function. Kquery is a pointer to a function which will be called when
the Keyboard Manager needs to know if a keycode is ready while kget points to a
function which will be called when the package needs to fetch a keycode. Under
normal circumstances you will supply pointers to the built in functions kbhit
and getch.

Since the Keyboard Manager makes extensive use of the List Manager it is
important to call lminit before any other routines.

Return Value

A value of 0 will be returned if all went well. A negative return value
indicates a memory allocation error was returned from a call to the List
Manager.

See Also

kmkbhit, kmgetch

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call

lminit(malloc,free); init the list manager
kminit(kbhit,getch,0); init the keyboard manager











3 - 24
kmkbhit

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmkbhit();

Description

The kmkbhit function is used to tell if there is a keycode available from the
Keyboard Manager. All input sources are (keyboard, file, user input routines)
are queried and if a keycode is available this function will return a true
value.

Note that if the user is in the midst of entering a manual keycode (see kmsesc)
you will not get a true status returned even though actual keycodes have been
entered.

If there is an active background routine registered it will be called before any
input sources are queried.

Return Value

A non-zero return value indicates a keycode is available for fetching via
kmgetch. A zero value means there are no keycodes available.

See Also

kmgetch

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int c;

lminit(malloc,free); init the list manager
kminit(kbhit,getch); init the keyboard manager
.
.
while (!kmkbhit())
; wait for keycode
c = kmgetch(); get the keycode







3 - 25
kmopeni

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmopeni(filename);
char *filename; input file

Description

The kmopeni function is used to open an ASCII text file pointed to by filename
which will be used as an input source when obtaining keycodes. If there are no
other active input sources all keycodes will be obtained from the text file
until it is empty, suspended, or closed.

To represent non-printing ASCII characters and function keys in the text file
use the following format: ~xxx Where xxx is the 3 digit decimal keycode
preceded by the tilde (~) character. Here are some examples:

character/key code
============================
Ctrl-C ~003
ESC ~027
Tilde (~) ~126
F10 function key ~368

Note that even though keycodes are being obtained from a file it is possible for
another input source (keyboard, user input routine) to supply the active abort
character. In this case the abort character will be passed thru to the calling
application.

Return Value

The kmopeni function returns 0 if all went well. A negative value indicates an
error. Error codes can be found in the include file .

See Also

kmclosei, kmsuspendi, kmresumei, kmsesc, kmfgesc














3 - 26
kmopeni

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
.
.
.
kmopeni("D:\\goodin.txt"); open input file








































3 - 27
kmopeno

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmopeno(filename);
char *filename; output file

Description

The kmopeno function is used to open an ASCII text file pointed to by filename
which will receive all input keycodes. After opening this output file, all
input keycodes will be written to this file in addition to being supplied to the
calling routine.

To represent non-printing ASCII characters and function keys in the text file
the following format will be used: ~xxx Where xxx is the 3 digit decimal
keycode followed by the tilde (~) character. Here are some examples:

character/key code
============================
Ctrl-C ~003
ESC ~027
Tilde (~) ~126
F10 function key ~368

Return Value

The kmopeno function returns 0 if all went well. A negative value indicates an
error. Error codes can be found in the include file .

See Also

kmcloseo, kmsuspendo, kmresumeo

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
.
.
.
kmopeno("D:\\goodout.txt"); open output file




3 - 28
kmpop

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmpop(); pop to previous context

Description

The kmpop function will restore the context of the Keyboard Manager to what it
was prior to calling kmpush.

Return Value

The kmpop function has no return value. If there is no saved context to pop
the function will do nothing.

See Also

kmpush, kminit, kmsuir, kmsuor, kmsir

































3 - 29
kmpop

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int myhelproutine(); called when F1 is pressed
int dosomething(); a do something routine
int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
kmsir(KF1,myhelproutine); register F1 as help key
kmsir(KF10,dosomething); F10 will cause dosomething() to be called
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()
kmsuspenduor(unum); suspend output for awhile
kmsuspendir(KF1); don't give help for password
getpassword(); call a useful routine
kmresumeuor(unum); resume output
kmresumeir(KF1); make help active again
.
.
.
kmduor(-1); delete ALL output routines
kmdir(-1); delete ALL intercept routines
.
.
.
myhelproutine(code) called when F1 is pressed
/*****************/
int code; current key being input
{
. this would be a help routine
. for your user. Instead of writing
. your own, use the Help Manager!
}

dosomething(code)
/****************/ called when F10 is pressed
int code;
{

3 - 30
kmpop

kmpush(); save current context
.
. now, the entire keyboard manager could be
. reconfigured.
kmpop(); And now the previous state is restored
}
















































3 - 31
kmpush

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmpush(); push current context

Description

The kmpush function will save the current context of the Keyboard Manager
including all input sources, filter character, outputs, and intercept routines.
After the push the Keyboard Manager will be in the same state as just after
calling kminit.

Return Value

The kmpush function will return 0 if all went well or a negative value if an
error occured.

See Also

kmpop, kminit, kmsuir, kmsuor, kmsir
































3 - 32
kmpush

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int myhelproutine(); called when F1 is pressed
int dosomething(); a do something routine
int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
kmsir(KF1,myhelproutine); register F1 as help key
kmsir(KF10,dosomething); F10 will cause dosomething() to be called
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()
kmsuspenduor(unum); suspend output for awhile
kmsuspendir(KF1); don't give help for password
getpassword(); call a useful routine
kmresumeuor(unum); resume output
kmresumeir(KF1); make help active again
.
.
.
kmduor(-1); delete ALL output routines
kmdir(-1); delete ALL intercept routines
.
.
.
myhelproutine(code) called when F1 is pressed
/*****************/
int code; current key being input
{
. this would be a help routine
. for your user. Instead of writing
. your own, use the Help Manager!
}

dosomething(code)
/****************/ called when F10 is pressed
int code;
{

3 - 33
kmpush

kmpush(); save current context
.
. now, the entire keyboard manager could be
. reconfigured.
kmpop(); And now the previous state is restored
}
















































3 - 34
kmresumebgr

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmresumebgr();

Description

The kmresumebgr function resumes calling the registered background routine.

Return Value

This function has no return value.

See Also

kmsuspendbgr, kmsbgr, kmgbgr, kmdbgr



































3 - 35
kmresumebgr

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

#include "time.h" used by showtime() function

int kbhit(), getch(); used in kminit() call
void showtime(); for kmsbgr() function call
int wnum;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wnum = wncreate(0,0,80,25,WNBLUE,
WNCYAN,WNBLUE,WNCYAN); open full screen window
kmsbgr(showtime); register background routine
.
. do other stuff
.
kmsuspendbgr(); stop displaying time for awhile
.
.
.
kmresumebgr(); resume showing time
}

showtime() show time while waiting for key input
{
static long lasttime;
long nowtime;
long time();
struct tm *newtime;

if (time(&nowtime) != lasttime){ we'll display time if changed
wnlocate(wnum,1,1); position the cursor in main window
newtime = localtime(&nowtime); get time in usable format
wnprintf(wnum,"%s",
asctime(newtime)); print time in upper left of window
lasttime = nowtime; update the status var
}
}











3 - 36
kmresumei

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmresumei(); resume input from file

Description

The kmresumei function will resume input from a suspended input file.

Return Value

This function has no return value. It will not cause any problem to resume a
file that is not suspended.

See Also

kmresumeo, kmopeni, kmopeno, kmsuspendi, kmsuspendo

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int c;

lminit(malloc,free),0); init the list manager
kminit(kbhit,getch); init the keyboard manager
kmopeni("goodin.put"); read keycodes from an input file
while ((c = kmgetch()) != KESC)
... do something
kmsuspendi(); suspend the input file
... now process the keyboard
kmresumei(); resume input from file
















3 - 37
kmresumeir

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmresumeir(keycode); resume a suspended intercept routine
int keycode; intercept routine to suspend/resume

Description

The kmresumeir function will resume a suspended intercept routine. A value
of -1 for keycode will resume ALL suspended interception routines.

Return Value

This function has no return value. An invalid keycode will be ignored.

See Also

kmsuspendir, kmsir, kmgir, kmdir

































3 - 38
kmresumeir

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int myhelproutine(); called when F1 is pressed
int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
kmsir(KF1,myhelproutine); register F1 as help key
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()

kmsuspenduor(unum); suspend output for awhile
kmsuspendir(KF1); don't give help for password
getpassword(); call a useful routine
kmresumeuor(unum); resume output
kmresumeir(KF1); make help active again
.
.
.
kmduor(-1); delete ALL output routines
kmdir(-1); delete ALL intercept routines
.
.
.
myhelproutine(code) called when F1 is pressed
/*****************/
int code; current key being input
{
. this would be a help routine
. for your user. Instead of writing
. your own, use the Help Manager!
}







3 - 39
kmresumeo

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmresumeo(); resume output to file

Description

The kmresumeo function will resume output to a suspended output file.

Return Value

This function has no return value. It will not cause any problem to resume a
file that is not suspended.

See Also

kmresumei, kmopeni, kmopeno, kmsuspendi, kmsuspendo

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int c;

lminit(malloc,free); init the list manager
kminit(kbhit,getch); init the keyboard manager
kmopeno("goodout.put"); put keycodes to a journal file
while ((c = kmgetch()) != KESC)
... do something
kmsuspendo(); suspend the output file
... now process the keyboard
kmresumeo(); resume output to file
















3 - 40
kmresumeuir

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmresumeuir(unum); resume a user input routine
int unum; uir number to suspend/resume

Description

The kmresumeuir function is used to resume input from user input routine unum.
A value of -1 supplied for unum will resume ALL suspended user input routines.

Return Value

This function has no return value. If unum is invalid, the action will not
be carried out.

See Also

kmsuspenduir, kmsuir, kmguir, kmduir

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int goodroutine(); our user input routine
int myuir;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
myuir = kmsuir(goodroutine); register goodroutine as an input source
.
.
kmsuspenduir(myuir); turn off goodroutine as an input source
.
.
.
kmresumeuir(myuir); resume input from goodroutine











3 - 41
kmresumeuor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmresumeuor(unum); resume a user output routine
int unum; UOR to suspend/resume

Description

The kmresumeuor function will resume a suspended UOR. A value of -1 supplied
for unum will cause all suspended UOR's to be resumed.

Return Value

This function has no return value. If unum is invalid it will be ignored.

See Also

kmsuspenduor, kmsuor, kmduor, kmguor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()
kmsuspenduor(unum); suspend output for awhile
getpassword(); call a useful routine
kmresumeuor(unum); resume output
.
.
.
kmduor(-1); delete ALL output routines


3 - 42
kmsbgr

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmsbgr(ptr); set background routine
void (*ptr)(); pointer to background routine

Description

The kmsbgr function is used to register a background routine. The function
pointed to by ptr will be called by the Keyboard Manager once before each
keycode is input and repeatedly while waiting for input. Parameters will not
be passed to the function and no return value is expected.

If you would like more than 1 background routine to be called you will have to
utilize the kmgbgr function and build the chain of functions yourself.

Return Value

The kmsbgr function has no return value.

See Also

kmgbgr, kmdbgr, kmsuspendbgr, kmresumebgr




























3 - 43
kmsbgr

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

#include "time.h" used by showtime() function

int kbhit(), getch(); used in kminit() call
void showtime(); for kmsbgr() function call
void (*ptr)(); for kmgbgr() function call
int wnum;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wnum = wncreate(0,0,80,25,WNBLUE,
WNCYAN,WNBLUE,WNCYAN); open full screen window
kmsbgr(showtime); register background routine
ptr = kmgbgr(); get pointer to current background
.
. do other stuff
.
kmdbgr(); delete current background routine
}

showtime() show time while waiting for key input
{
static long lasttime;
long nowtime;
long time();
struct tm *newtime;

if (time(&nowtime) != lasttime){ we'll display time if changed
wnlocate(wnum,1,1); position the cursor in main window
newtime = localtime(&nowtime); get time in usable format
wnprintf(wnum,"%s",
asctime(newtime)); print time in upper left of window
lasttime = nowtime; update the status var
}
}













3 - 44
kmsesc

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmgesc(); get escape character
void kmsesc(ch); set escape character
int ch; new escape character

Description

The kmgesc function is used to obtain the current filter "escape" character
while kmsesc is used to set a new escape character.

The "escape" character is the one character the user types in order to signal
the keyboard manager that they are entering a 3 digit keycode.

At initialization, the escape code is a tilde (~) character. If the user
wanted to input the keycode for Ctrl-G he/she could type ~007 and the
keyboard manager would only pass one keycode (ctrl-g) to the calling
application.

Note that the escape code setting does not get passed to the new keyboard
context if a kmpush is done.

Return Value

The kmgesc function returns the current escape character. The kmsesc function
has no return value.

See Also

kmpush, kmpop

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager

kmsesc('$'); use dollar sign as trigger






3 - 45
kmsir

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmsir(keycode, ptr); register intercept routine
int keycode; keycode to intercept
int (*ptr)(); pointer to intercept routine

Description

The kmsir function is used to register a user supplied Intercept Routine.
Ptr points to the intercept routine that will be called when keycode is input
thru the Keyboard Manager. When keycode is seen by the Keyboard Manager it
will be passed to ptr as follows:

(*ptr)(keycode);

If your intercept routine returns a value of -1 keycode will NOT be passed to
the calling application. Any other value WILL be passed. Note that this allows
your "intercept" routine to do keycode filtering/translating as well as some
other useful action.

Return Value

The kmsir function will return keycode if all went well. A negative value
indicates an error.

See Also

kmgir, kmdir, kmsuspendir, kmresumeir






















3 - 46
kmsir

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int myhelproutine(); called when F1 is pressed
int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
kmsir(KF1,myhelproutine); register F1 as help key
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()
kmsuspenduor(unum); suspend output for awhile
kmsuspendir(KF1); don't give help for password
getpassword(); call a useful routine
kmresumeuor(unum); resume output
kmresumeir(KF1); make help active again
.
.
.
kmduor(-1); delete ALL output routines
kmdir(-1); delete ALL intercept routines
.
.
.
myhelproutine(code) called when F1 is pressed
/*****************/
int code; current key being input
{
. this would be a help routine
. for your user. Instead of writing
. your own, use the Help Manager!
}








3 - 47
kmsuir

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmsuir(ptr); set User Input Routine
int (*ptr)(); pointer to user input routine

Description

The kmsuir is used to register a User Input Routine (UIR).

The kmsuir function adds the function pointed to by ptr to the internal list of
possible input sources. When the Keyboard Manager needs input, ptr will be
queried along with all other input sources. The function you supply as an input
source must be capable of responding to the following synopsis:

int (ptr)(func,data);
int func; function code
int data; data to pass to your input function

Depending on func, your input function needs to do different things:

func == fuirsabort
If your input function is called by the Keyboard Manager with a func value of
fuirsabort you are being requested to make a note of the new abort code. For
this function code, data will contain the new abort keycode.

func == fuirqabort
Your input function will be called with this function code when the Keyboard
Manager needs to know if your input source has the current abort code pending.
A non-zero return value from your input function indicates an abort code is
pending.

func == fuirchavail
This function code is asking your input routine if any keycode is pending. A
non-zero return value from you indicates that a keycode is ready.

func == fuirgetch
This function call tells your input function to not return until a keycode is
available from its input. The return value will be the input keycode.

Return Value

A positive UIR number is returned from kmsuir if all went well. A negative
number indicates an error (see km.h).

See Also

kmguir, kmduir, kmsuspenduir, kmresumeuir



3 - 48
kmsuir

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

/*
mouseuir.c

This program will demonstrate how a mouse can be used to simulate arrow
keycodes with the Keyboard Manager package. It will be registered as
a User Input Routine (UIR) and whenever movement of the mouse is noted the
correct arrow keycode will be sent to the Keyboard Manager. Added
capabilities such as button command support is not present in this
example but could easily be added.

This program will create a window and place the cursor in the center. As
the user enters arrow keycodes the cursor will be moved. Hit the ESCAPE
key or press any mouse button to exit the program.

This program must be linked with the mouse driver library in addition to
the Forms Processing Lib.

NOTE: The mouse driver must be loaded.

*/

#define MOUSE mousecms(&m1,&m2,&m3,&m4) /* mousecms=small, mousecml=large */

#include "stdio.h"
#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int m1,m2,m3,m4;

main()
/***********/
{
int kbhit(),getch(); /* for kminit call */
int crow,ccol,lrow,lcol; /* current and last cursor row,col */
int keycode;
int wnum; /* window number */
int uir; /* uir number from kmsuir() */
int mouseuir(); /* our mouse User Input Routine */

lminit(malloc,free,0); /* init list manager */
kminit(kbhit,getch); /* init keyboard manager */
wninit(0,0,NULL,0,malloc,free); /* init window manager */

wnum = wncreate(0,0,80,25,WNBLUE,WNCYAN,WNBLUE,WNCYAN); /* create window */
wnttitle(wnum,"[ Mouse Tester ]"); /* put up top title */

3 - 49
kmsuir

wnbtitle(wnum,"[ ESC or mouse button to exit ]"); /* bottom title */

m1 = 0;
MOUSE; /* see if driver is installed (m1==0) */
if (m1 != -1){
wndestroy(wnum); /* take down window */
printf("\nSorry. Mouse driver not found.");
exit(1);
}
else{
uir = kmsuir(mouseuir); /* register User Input Routine */
kmmsabort(KESC); /* tell keyboard package what an abort is */
crow = 10;
lrow = -1;
ccol = 40;
lcol = -1;
for (;;){
if ((lrow != crow) || (lcol != ccol)){ /* don't move unless changed */
wnlocate(wnum,crow,ccol); /* position cursor */
lrow = crow;
lcol = ccol; /* update last coords */
}
keycode = kmgetch(); /* get a key from keyboard manager */
switch (keycode){
case KUP: /* up arrow key */
crow = (crow == 1)?crow:--crow;
break;
case KDOWN: /* down arrow key */
crow = (crow == 23)?crow:++crow;
break;
case KRIGHT: /* right arrow key */
ccol = (ccol == 78)?ccol:++ccol;
break;
case KLEFT: /* left arrow key */
ccol = (ccol == 1)?ccol:--ccol;
break;
case KESC: /* escape keycode */
wndestroy(wnum);/* take down window */
exit(0);
break;
}
}
kmduir(uir); /* remove from list just to be clean */
}
wndestroy(wnum);
printf("\nbye bye...");
exit(0);
} /* end of main */

/************** User Input Routine section **************/

/* these global static vars are for the mouse input routines */


3 - 50
kmsuir

#define KQ 20
int current_abort_code = KESC;
int waiting_keycode[KQ];
int nwaiting,in,out;

mouseuir(func,data)
/******************/
/* This is the actual user input routine which was registered via kmsuir()
above.
*/
int func,data;
{
int tkey;

switch(func){ /* a UIR must be capable of performing 4 functions: */
case fuirsabort: /* set abort keycode */
current_abort_code = data;
break;

case fuirqabort: /* is abort code pending */
m1 = 3; /* get mouse position and button status */
MOUSE; /* call the mouse driver */
if (m2 & 7){
push_keycode(current_abort_code);
return(1); /* button down, return abort true */
}
else
return(0); /* no button down */
break;

case fuirchavail: /* keycode ready yet? */
return(mouseuirchavail());
break;

case fuirgetch: /* don't return until char ready */
while (!mouseuirchavail())
; /* wait for keycode */
return(pop_keycode());
break;
}
} /* end of mouseuir */

mouseuirchavail()
/****************/
{
if (any_keycodes())
return(1);
else{
if (mouseuirbuttondown()){
push_keycode(current_abort_code);
return(1); /* yes, keycode is ready */
}
m1 = 11; /* get relative mouse movement */

3 - 51
kmsuir

MOUSE; /* call driver */
if (m3 > 0) /* did mouse move to the right? */
push_keycode(KRIGHT);
else if (m3 < 0) /* did mouse move to the left? */
push_keycode(KLEFT);
if (m4 > 0) /* did mouse move down? */
push_keycode(KDOWN);
else if (m4 < 0) /* did mouse move up? */
push_keycode(KUP);

return(any_keycodes()); /* return updated status */
}
} /* end of mouseuirchavail */

mouseuirbuttondown()
/*******************/
{
m1 = 3; /* get mouse position and button status */
MOUSE; /* call driver */
if (m2 & 7)
return(1); /* yes, button is down */
else
return(0);
}

clear_keycodes()
/****************/
{
nwaiting = 0;
in = out = 0;
}

any_keycodes()
/*************/
{
return(nwaiting);
}

push_keycode(keycode)
/********************/
int keycode;
{
if (nwaiting < KQ){
waiting_keycode[in++] = keycode;
in = (in == KQ)?0:in;
nwaiting++;
}
}

pop_keycode()
/*************/
{
int i;

3 - 52
kmsuir

i = waiting_keycode[out++];
out = (out == KQ)?0:out;
nwaiting--;
return(i);
}

















































3 - 53
kmsuor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kmsuor(ptr); set User Output Routine
int (*ptr)(); pointer to user output routine

Description

The kmsuor function is used to register a User Output Routine (UOR). Each
active registered UOR will be called every time a keycode is made available
to a calling application via kmgetch.

When your output function is called via ptr, it will be passed the current
keycode that was input:

(*ptr)(keycode);

Return Value

The kmsuor function will return a positive integer unum which is used to
identify the newly registered UOR. A negative return value indicates an error.

See Also

kmguor, kmduor, kmsuspenduor, kmresumeuor


























3 - 54
kmsuor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()
kmsuspenduor(unum); suspend output for awhile
getpassword(); call a useful routine
kmresumeuor(unum); resume output
.
.
.
kmduor(-1); delete ALL output routines
























3 - 55
kmsuspendbgr

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmsuspendbgr();

Description

The kmsuspendbgr function tells the Keyboard Manager to temporarily stop calling
the registered background routine.

Return Value

This function has no return value and it will not cause problems by suspending
an already suspended background.

See Also

kmresumebgr, kmsbgr, kmgbgr, kmdbgr

































3 - 56
kmsuspendbgr

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

#include "time.h" used by showtime() function

int kbhit(), getch(); used in kminit() call
void showtime(); for kmsbgr() function call
int wnum;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wnum = wncreate(0,0,80,25,WNBLUE,
WNCYAN,WNBLUE,WNCYAN); open full screen window
kmsbgr(showtime); register background routine
.
. do other stuff
.
kmsuspendbgr(); stop displaying time for awhile
.
.
.
kmresumebgr(); resume showing time
}

showtime() show time while waiting for key input
{
static long lasttime;
long nowtime;
long time();
struct tm *newtime;

if (time(&nowtime) != lasttime){ we'll display time if changed
wnlocate(wnum,1,1); position the cursor in main window
newtime = localtime(&nowtime); get time in usable format
wnprintf(wnum,"%s",
asctime(newtime)); print time in upper left of window
lasttime = nowtime; update the status var
}
}











3 - 57
kmsuspendi

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmsuspendi(); suspend input

Description

The kmsuspendi function will suspend input from an already opened input file.

Return Value

This function has no return value. It will not cause any problem to suspend
an already suspended file.

See Also

kmsuspendo, kmopeni, kmopeno, kmresumei, kmresumeo

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
kmopeni("goodin.put"); read keycodes from an input file
while ((c = kmgetch()) != KESC)
... do something
kmsuspendi(); suspend the input file
... now process the keyboard
kmresumei(); resume input from file
















3 - 58
kmsuspendir

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmsuspendir(keycode); suspend an intercept routine
int keycode; intercept routine to suspend/resume

Description

The kmsuspend function will temporarily suspend interception of keycode. A
value of -1 for keycode will suspend ALL interception routines.

Return Value

This function has no return value. An invalid keycode will be ignored.

See Also

kmresumeir, kmsir, kmgir, kmdir

































3 - 59
kmsuspendir

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int myhelproutine(); called when F1 is pressed
int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
kmsir(KF1,myhelproutine); register F1 as help key
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()

kmsuspenduor(unum); suspend output for awhile
kmsuspendir(KF1); don't give help for password
getpassword(); call a useful routine
kmresumeuor(unum); resume output
kmresumeir(KF1); make help active again
.
.
.
kmduor(-1); delete ALL output routines
kmdir(-1); delete ALL intercept routines
.
.
.
myhelproutine(code) called when F1 is pressed
/*****************/
int code; current key being input
{
. this would be a help routine
. for your user. Instead of writing
. your own, use the Help Manager!
}







3 - 60
kmsuspendo

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmsuspendi(); suspend input
void kmsuspendo(); suspend output

Description

The kmsuspendo function will suspend output to an open output file.

Return Value

These functions have no return value. It will not cause any problem to suspend
an already suspended file.

See Also

kmsuspendi, kmopeni, kmopeno, kmresumei, kmresumeo

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
kmopeno("goodout.put"); put keycodes to a journal file
while ((c = kmgetch()) != KESC)
... do something
kmsuspendo(); suspend the output file
... now process the keyboard
kmresumeo(); resume output to file















3 - 61
kmsuspenduir

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmsuspenduir(unum); suspend a user input routine
int unum; uir number to suspend/resume

Description

The kmsuspenduir function is used to temporarily suspend input from user input
routine unum. A value of -1 supplied for unum will suspend ALL user input
routines.

Return Value

This function has no return value. If unum is invalid, the action will not
be carried out.

See Also

kmresumeuir, kmsuir, kmguir, kmduir

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call
int goodroutine(); our user input routine
int myuir;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
myuir = kmsuir(goodroutine); register goodroutine as an input source
.
.
kmsuspenduir(myuir); turn off goodroutine as an input source
.
.
.
kmresumeuir(myuir); resume input from goodroutine










3 - 62
kmsuspenduor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"

void kmsuspenduor(unum); suspend a user output routine
int unum; UOR to suspend/resume

Description

The kmsuspenduor function will temporarily suspend output to User Output Routine
unum. A value of -1 supplied for unum will cause all UOR's to be suspended.

Return Value

This function has no return value. If unum is invalid it will be ignored.

See Also

kmresumeuor, kmsuor, kmduor, kmguor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"

int kbhit(), getch(); used in kminit() call

int goodout(); my output routine
int outwin; where output will be echoed
int unum, c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
wncreate(0,0,20,6,WNBLUE,WNCYAN,
WNBLACK,WNRED); create output window for goodout()

unum = kmsuor(goodout); register the output routine
.
.
.
while ((c = kmgetch()) != KESC) just wait for esc. Everything will be
; sent to goodout()
kmsuspenduor(unum); suspend output for awhile
getpassword(); call a useful routine
kmresumeuor(unum); resume output
.
.
.
kmduor(-1); delete ALL output routines


3 - 63

























































3 - 64
4 Window Manager

4.1 Introduction

The Window Manager is a collection of library routines which allow you to
create, manipulate, and print in text screen windows. Features of the Window
Manager include:

- Screen area under window can be saved to memory or a file
- Titles can be placed on all 4 window sides
- Definable border drawing characters or none at all
- Two styles of cursor -- different in each window
- Completely definable colors
- Extensive editing functions
- Windows can be changed after creation
- Object oriented functions

Object oriented means you will not have to maintain pointers to internal data
structures of the window package. Once a window is created, you will receive an
integer window number. All future references to the newly created window will
be thru this number. This allows a separation between your application and the
data structures of the Window Manager which produces fewer bugs and allows us to
change our internal structure without affecting existing routines.

4.2 Components

The window manager routines can be broken down into 8 separate categories:

- Initialization, creation, and deletion of windows
- Window query routines
- Window set routines
- Size and movement routines
- Titling routines
- Printing routines
- Editing routines

Since the Window Manager is a object oriented package, there are over 50
routines which allow your application to obtain or change a window's location,
appearance, or content. Since your application doesn't have access to any data
structures all window manipulations are done thru a well behaved, debugged, set
of routines.

4.3 Symbolic Constants

All of the following constants are defined in the include file .

4.3.1 Colors
The following color constants or values can be used when specifying background
and/or foreground colors:

Constant Value Description
==================================
WNBLACK 0 Black
WNBLUE 1 Blue
WNGREEN 2 Green

4 - 1
WNCYAN 3 Cyan
WNRED 4 Red
WNMAGENTA 5 Magenta
WNBROWN 6 Brown
WNGRAY 7 Gray
WNDGRAY 8 Dark Gray
WNLBLUE 9 Light Blue
WNLGREEN 10 Light Green
WNLCYAN 11 Light Cyan
WNLRED 12 Light Red
WNLMAGENTA 13 Light Magenta
WNYELLOW 14 Yellow
WNWHITE 15 White

All of the above values can be used to specify a background color, only 0-7 may
be used as a foreground color.

Blinking - To make your text blink, bitwise OR the constant WNBLINK with the
text foreground constant ( blinking cyan == WNCYAN | WNBLINK).

Mono Highlight - The following values can be used to specify the type of
highlighting to be used on mono displays:

Constant Value Description
==================================
WNNORMAL 0x07 White text on black
WNREVERSE 0x70 Black text on white
WNUNDERLINE 0x47 White text w/underline

4.3.2 Cursor Types

The wnswcmode function allows these window cursor styles:

Constant Value Cursor Type
==================================
WNNOCURSOR 0 No Cursor
WNUNDCURSOR 1 Underline cursor
WNSOLCURSOR 2 Solid cursor

4.3.3 Scroll Directions

The following values can be used in the wnscroll function for scrolling a
window:

Constant Value Direction of Scroll
==========================================
WUP 0 Up
WDOWN 1 Down

4.3.4 Error Codes

All error codes returned by the window routines are negative integers or a NULL
character pointer. These are the possible error return codes:

Error Code Value Description


4 - 2
==================================
WNMAERROR -1 Memory Allocation Error
WNFWERROR -2 File Write Error
WNBADWIN -3 Invalid Window Number
WNFRERROR -4 File Read Error

4.4 Module Initialization

Before any windows can be created and used the initialization routine wninit()
must be called. This is a one time call and must be done AFTER the List Manager
is initialized via lminit. The Window Manager makes extensive use of lists
therefore the List Manager must be initialized prior to calling wninit. When
calling wninit you need to supply parameters which tell whether screen saves are
to be done to memory or a file, memory allocation/deallocation routines to use,
file transfer buffer and size, and an already opened file handle. The state of
the memory/file save parameter determines which of the other parameters need to
be supplied. A basic initialization synopsis is shown here:

#include list manager declarations and symbolic constants
#include window manager declarations and color constants
#include for initializing the list manager package

int wnum;

lminit(malloc,free,0); init the list manager
wninit(0,0,NULL,0,malloc,free); init window manager, screen saves to memory
.
.
wnum = wncreate(....); create a window
.
. move, manipulate, and print in window
.
wndestroy(wnum); remove the window when your done

4.5 Include Files

The C include file "wn.h" must be #includ'ed at the top of your application
source file in order to use the Window Manager package. This gives you
access to symbolic constants used by the packages as well as letting the
compiler do parameter type checking.

4.6 Function Overview

All Window Manager functions return an error code value. Zero or greater
indicates success. The functions are:

code = wninit(mfflag, wh, wbuf,
wbsize, wmar, wmfr); init window manager
wnum = wncreate(row,col,width,height,
bc,fc,bbc,bfc); create new window
code = wndestroy(wnum); remove a window
code = wncls(wnum); clear a window
code = wnfill(wnum,c); fill a window with fill character
att = wnghmatt(); get highlight colors for mono
code = wnshmatt(att); set highlight colors for mono

4 - 3
code = wngcparms(&wsave,&wscroll,
&wcmode,&ul,&ur,&ll,
&lr,&vti,&vbi,&hli,
&hri,&ic,&vc,&hc); get parameters used for new windows
code = wnscparms(wsave,wscroll,wcmode,
ul,ur,ll,lr,vti,vbi,
hli,hri,ic,vc,hc); set parameters used for new windows


row = wngwrow(wnum) get row of upper left window corner
col = wngwcol(wnum) get col of upper left window corner
width = wngwwidth(wnum) get width of window
height = wngwheight(wnum) get height of window
bc = wngwbc(wnum) get background color
fc = wngwfc(wnum) get foreground color
bbc = wngwbbc(wnum) get border background color
bfc = wngwbfc(wnum) get border foreground color
tbc = wngwtbc(wnum) get titles background color
tfc = wngwtfc(wnum) get titles foreground color
crow = wngwcrow(wnum) get cursor row in window
ccol = wngwccol(wnum) get cursor col in window
cmode = wngwcmode(wnum) get current cursor mode in window
wwrap = wngwwwrap(wnum) get word wrap status
scroll = wngwscroll(wnum) get scroll status
code = wngwbchars(wnum,&ul,&ur,&ll,
&lr,&vc,&hc,&vti,
&vbi,&hli,&hri,&ic)get current window border characters

code = wnswcolor(wnum,bc,fc) set background,foreground color
code = wnswbcolor(wnum,bbc,bfc) set border background,foreground color
code = wnswtcolor(wnum,tbc,tfc) set titles background,foreground color
code = wnswcmode(wnum,cmode) set current cursor mode in window
code = wnswscroll(wnum,scroll) set window scroll flag
codd = wnswbchars(wnum,ul,ur,ll,lr,
vc,hc,vti,vbi,hli,
hri,ic) set border drawing chars
code = wnsize(wnum,newwidth,
newheight) resize existing window
code = wnmove(wnum,newrow,newcol) move existing window
code = wnmovechar(wnum,torow,tocol) move char at current cursor
code = wngchar(wnum) get char from current cursor location
code = wnmoves(wnum,torow,tocol,len) move string at current cursor
code = wnscroll(wnum,srow,nrows,dir) scroll window contents up or down
code = wndline(wnum) delete current row and bring up text
code = wndeol(wnum) delete to end of line w/out bring up
code = wndeow(wnum) delete to end of window
code = wnbs(wnum) destructive backspace in window
code = wninsline(wnum) open up blank row
code = wninschar(wnum) open up blank character.
code = wnputncolor(wnum,bc,fc,len); change attribute of displayed text
code = wnlputncolor(wnum,row,col,bc,
fc,len) change attribute of text at row,col
code = wnputhcolor(wnum,bc,fc,len); change att of highlighted text
code = wnlputhcolor(wnum,bc,fc,len); change att of text at row,col


4 - 4
code = wnttitle(wnum,str); put title at top of window
code = wnbtitle(wnum,str); put title at bottom of window
code = wnltitle(wnum,str); put title at left edge of window
code = wnrtitle(wnum,str); put title at right edge of window

4.7 Function Definitions

These List Manager function definitions are presented in alphabetical order,
each starting on a new page, to facilitate your search for information.
Function definitions are comprised of the following sections:

- Summary - function and parameter declarations
- Description - detailed description
- Return Value - explanation of return values
- See Also - related functions
- Example - programming example

A negative return value by any function indicates an error.






































4 - 5
wnbs

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wnbs(wnum);
int wnum; window number

Description

The wnbs function is used to move all characters to the right of, and including,
the current cursor position 1 position to the left. The current cursor position
will be updated after the characters have been moved. If the current cursor
column is already column 1, the function will do nothing. All color attributes
will be moved with the characters.

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wnins

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnlocate(wnum,2,1); position cursor
wnprintf(wnum,"Hello world");
wnlocate(wnum,"2,4);
wnbs(wnum); row 2 contains "Helo world"










4 - 6
wnbtitle

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnbtitle(wnum,str); bottom title routine
int wnltitle(wnum,str); left title routine
int wnrtitle(wnum,str); right title routine
int wnttitle(wnum,str); top title routine

int wnum; window number
char *str; title string

Description

The wnbtitle, wnltitle, wnrtitle, and wnttitle functions are used to place a
title string, str, in the border of window wnum. The title string str will be
centered vertically if using wnltitle or wnrtitle, horizontally if using
wnbtitle or wnttitle. Passing a null terminated string with length of 0 will
cause a displayed title to be removed. If the title string is too long it will
be truncated to fit the window border.

The string str will be bordered on both ends by the current window border
characters so if you want something that looks clean you should probably
bracket your title strings with something like "[ good title ]" instead of
just "good title".

After creation, window title colors will be the same as the border characters.
Use the wnswtcolor function prior to calling a titling routine if you want
different title colors.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wnswtcolor













4 - 7
wnbtitle

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnttitle(wnum,"[ Main Menu ]"); top title same color as border
wnswtcolor(wnum,WNBLUE,WNCYAN); color for new titles
wnbtitle(wnum,"[ ESC to Exit ]"); bottom title with new colors





































4 - 8
wncls

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wncls(wnum);
int wnum; window to clear with spaces

Description

The wncls function is used to fill the inside of window wnum with spaces. Its
effect is to clear the window. Note that it is not neccessary to use wncls
right after creating a window, it will be called for you.

Return Value

A return value of 0 indicates all went well. A negative value means an invalid
wnum was supplied.

See Also

wnfill

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wncls(wnum); clear window















4 - 9
wncreate

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wncreate(row,col,width,height,bc,fc,bbc,bfc);

int row,col; screen position of upper left window corner
int width,height; size of window
int bc,fc; window background, foreground color
int bbc,bfc; window border background, foreground color

Description

The wncreate function is used to create and display an empty screen window.
Row, and col specify where the upper left window corner should appear on the
screen. Width and height specify the window size including the border. Bc and
fc specify the internal window colors, where bc is the background color and fc
is the text color. Bbc and bfc specify the window border colors, both
background and foreground.

Unless the creation defaults are change via wnscparms, newly created windows
will have the following default properties:

Screen save - on
Window scroll - on
Cursor type - WNUNDCURSOR
Title colors - same as border colors
Border characters - double line drawing set
Cursor position - 1,1 with window cleared

Return Value

The wncreate function will return a positive integer window number which is to
be used with other Window Manager routines. A negative return value indicates
an error. Symbolic error and color constants can be found in the include file
.

See Also

wndestroy, wnscparms











4 - 10
wncreate

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window









































4 - 11
wndeol

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wndeol(wnum);
int wnum; window number

Description

The wndeol function will delete all characters from the current cursor position
to the right edge of window wnum. All deleted characters including the current
cursor position will be set to blanks using the current background color. If
the entire line is deleted due to the cursor being at column 1, the lines below
the current line will not be scrolled up.

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wndline

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnprintf(wnum,"This is line 1\n");
wnprintf(wnum,"This is line 2\n");
wnprintf(wnum,"This is line 3\n");
wnprintf(wnum,"This is line 4\n");
wnprintf(wnum,"This is line 5\n");
wnprintf(wnum,"This is line 6\n");
.
.
.
wnlocate(wnum,3,7); position cursor at row 3, col 7
wndeol(wnum); line 3 now "This i"



4 - 12
wndeow

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wndeow(wnum);
int wnum; window number

Description

The wndeow function will delete all characters from the current cursor position
to the last row and column in window wnum. All deleted characters will be set
to blanks using the current window background color.

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wndeol, wndline

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnprintf(wnum,"This is line 1\n");
wnprintf(wnum,"This is line 2\n");
wnprintf(wnum,"This is line 3\n");
wnprintf(wnum,"This is line 4\n");
wnprintf(wnum,"This is line 5\n");
wnprintf(wnum,"This is line 6\n");
.
.
.
wnlocate(wnum,1,7); position cursor at row 1, col 7
wndeow(wnum); only "This i" of line 1 remains





4 - 13
wndestroy

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wndestroy(wnum);
int wnum; window to take down

Description

The wndestroy function is used to remove a window from the screen, restore the
screen under the window if it was saved, and finally, free any memory that was
used by the window. Wnum is the window number to be removed, -1 supplied for
wnum will remove all existing windows in the reverse order of creation. Note
that if you choose to destroy windows individually you must pay attention to the
order so that screen area under the windows are restored properly.

If the file screen save mode was specified in wninit, it is the applications
responsibility to close this file.

Return Value

The wndestroy function returns 0 if all went well. A negative value indicates
an error. Symbolic error codes can be found in the include file .

See Also

wncreate, wninit

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
.
wndestroy(wnum); take window down









4 - 14
wndline

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wndline(wnum);
int wnum; window number

Description

The wndline function is used to delete the current cursor line in window wnum.
All lines below the current line will be scrolled up.

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wndeol

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnprintf(wnum,"This is line 1\n");
wnprintf(wnum,"This is line 2\n");
wnprintf(wnum,"This is line 3\n");
wnprintf(wnum,"This is line 4\n");
wnprintf(wnum,"This is line 5\n");
wnprintf(wnum,"This is line 6\n");
.
.
.
wnlocate(wnum,3,1); position cursor at row 3, col 1
wndline(wnum); line 3 now missing






4 - 15
wnfill

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnfill(wnum,c);
int wnum; window number to fill
int c; fill character

Description

The wnfill function is used to paint the inside of a window with a specified
fill character c. The current background/foreground in effect for the
window wnum will be used for the fill.

Return Value

The wnfill returns 0 if all went well. A negative return value indicates an
invalid wnum.

See Also

wncls.

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnfill(wnum,176); fill window with  character














4 - 16
wngchar

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngchar(wnum)
int wnum; window to get character from

Description

The wngchar function is used to obtain the character at the current cursor
location in window wnum.

Return Value

The ASCII character value at the current window cursor location will be
returned. If wnum is illegal, 0 will be returned. If there is another window
overlapping the current cursor position of wnum the returned value will be
undefined.

See Also

wnputchar

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnlocate(wnum,2,3); position cursor
wnputchar(wnum,'V'); put a character at 2,3
wnlocate(wnum,2,3);
c = wngchar(wnum); c == 'V'










4 - 17
wngcparms

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wngcparms(wsave,wscroll,wcmode,ul,ur,ll,lr,f1,f2,f3,f4,f5,vc,hc);

int *wsave; screen save flag
int *wscroll; window scroll flag
int *wcmode; cursor style
int *ul,*ur,*ll,*lr; border corner characters
int *f1,*f2,*f3,*f4,*f5; dummy fill characters
int *vc,*hc; vertical and horizontal drawing characters

Description

The wngcparms function is used to obtain the default window creation parameters
that are not specified in the wncreate call. The state or value of these
parameters are used when creating windows via wncreate. Wsave is false if
screen saves under new windows are NOT to be done, wscroll and wcmode are the
default scroll flag and cursor style to be used, ul, ur, ll, lr, vc, and hc are
the characters used when drawing the window border. F1, f2, f3, f4, and f5 are
dummy variables, in later versions they will represent characters used for
drawing crossbars and intersecting lines inside of windows.

Return Value

This function has no return value.

See Also

wnscparms, wncreate, wninit, wngwbchars

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;
int save,scroll,cmode;
int ul,ur,ll,lr;
int f1,vc,hc;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wngcparms(&save,&scroll,&cmode,&ul,&ur,&ll,&lr,&f1,&f1,&f1,&f1,&f1,&vc,&hc);


4 - 18
wnghmatt

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnghmatt();

Description

The wnghmatt function retrieves the attribute currently being used by newly
created windows for displaying highlighted text on a mono display. This value
is used by the wnputhcolor function which in turn is used by the menu and field
processing routines. By setting this value you can affect how highlight items
look when run on a mono display.

Return Value

Currently there are 3 possible return values:

WNNORMAL -- Normal white on black background
WNREVERSE -- Reverse video black text on white
WNUNDERLINE -- Normal white on black with underline

See Also

wnshmatt, wnputhcolor, wnlputhcolor, wnputncolor, wnlputncolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;
int att;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

att = wnghmatt();









4 - 19
wngnmatt

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngnmatt();

Description

The wngnmatt function retrieves the attribute currently being used by newly
created windows for displaying normal text on a mono display. This value is
used by the wnputhcolor function which in turn is used by the menu and field
processing routines. By setting this value you can affect how normal items look
when run on a mono display.

Return Value

Currently there are 3 possible return values:

WNNORMAL -- Normal white on black background
WNREVERSE -- Reverse video black text on white
WNUNDERLINE -- Normal white on black with underline

See Also

wnshmatt, wngnmatt, wnputhcolor, wnlputhcolor, wnputncolor, wnlputncolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;
int att;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
att = wngnmatt();










4 - 20
wngwbbc

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwbc(wnum); return current background color
int wngwfc(wnum); return current foreground color
int wngwbbc(wnum); return current border background color
int wngwbfc(wnum); return current border foreground color
int wngwtbc(wnum); return current titles background color
int wngwtfc(wnum); return current titles foreground color
int wnum; window number

Description

The wngwbc, wngwfc, wngwbbc, wngwbfc, wngwtbc, and wngwtfc return the current
color settings for window wnum.

Return Value

A positive return value from any of the functions indicates the color for which
you were interested in. Any foreground color > 128 indicates blinking is
active. A negative return value means wnum is invalid.

See Also

wnswcolor, wnswbcolor, wnswtcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

color = wngwtbc(wnum); WNBLUE will return since titles default at creation time
to the border colors unless changed.









4 - 21
wngwbc

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwbc(wnum); return current background color
int wngwfc(wnum); return current foreground color
int wngwbbc(wnum); return current border background color
int wngwbfc(wnum); return current border foreground color
int wngwtbc(wnum); return current titles background color
int wngwtfc(wnum); return current titles foreground color
int wnum; window number

Description

The wngwbc, wngwfc, wngwbbc, wngwbfc, wngwtbc, and wngwtfc return the current
color settings for window wnum.

Return Value

A positive return value from any of the functions indicates the color for which
you were interested in. Any foreground color > 128 indicates blinking is
active. A negative return value means wnum is invalid.

See Also

wnswcolor, wnswbcolor, wnswtcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

color = wngwtbc(wnum); WNBLUE will return since titles default at creation time
to the border colors unless changed.









4 - 22
wngwbchars

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwbchars(wnum,ul,ur,ll,lr,vc,hc);
int wnum; window number
int *ul,*ur; upper left/right corner characters
int *ll,*lr; lower left/right corner characters
int *vc,*hc; vertical/horizontal drawing character

Description

The wngwbchars function is used to obtain the current border box drawing
characters for window wnum. Ul, ur, ll, lr are the 4 corner characters while vc
and hc are the vertical and horizontal drawing characters.

Return Value

A value of 0 will be returned if all went well. A negative value indicates an
invalid wnum.

See Also

wncreate, wngcparms, wnscparms, wnswbchars

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;
int ul,ur,ll,lr,vc,hc;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wngwbchars(&ul,&ur,&ll,&lr,&vc,&hc);











4 - 23
wngwbfc

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwbc(wnum); return current background color
int wngwfc(wnum); return current foreground color
int wngwbbc(wnum); return current border background color
int wngwbfc(wnum); return current border foreground color
int wngwtbc(wnum); return current titles background color
int wngwtfc(wnum); return current titles foreground color
int wnum; window number

Description

The wngwbc, wngwfc, wngwbbc, wngwbfc, wngwtbc, and wngwtfc return the current
color settings for window wnum.

Return Value

A positive return value from any of the functions indicates the color for which
you were interested in. Any foreground color > 128 indicates blinking is
active. A negative return value means wnum is invalid.

See Also

wnswcolor, wnswbcolor, wnswtcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

color = wngwtbc(wnum); WNBLUE will return since titles default at creation time
to the border colors unless changed.









4 - 24
wngwccol

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwccol(wnum); get current cursor column
int wngwcrow(wnum); get current cursor row
int wnum; window number

Description

The wngwccol and wngwcrow functions are used to obtain the current cursor
position for a given window wnum.

Return Value

The cursor column number is returned by wngwccol while the current cursor row is
returned by wngwcrow. Both values are referenced from the window origin and are
zero based. If the cursor for window wnum were at the upper left corner, just
inside the window border, values returned would be row 1, column 1.

See Also

wngwcmode, wnswcmode

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
.
wnlocate(wnum,2,5); position cursor
wnprintf(wnum,"Hello"); this will move cursor
row = wngwcrow(wnum); row will == 2
col = wngwccol(wnum); col will == 10 (5 + "Hello" == 10)









4 - 25
wngwcmode

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwcmode(wnum);
int wnum; window number

Description

The wngwcmode function returns the current cursor mode for window wnum.

Return Value

The following possible return values indicate the current cursor type for window
wnum:

Return Value Cursor Type
=============================================
WNNOCURSOR None
WNUNDCURSOR Underline Blinking
WNSOLCURSOR Solid Blinking

See Also

wnswcmode

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnswcmode(wnum,WNSOLCURSOR); set the cursor type
ctype = wngwcmode(wnum); return value will be WNSOLCURSOR










4 - 26
wngwcol

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwcol(wnum); return column of upper left corner
int wngwrow(wnum); return row of upper left corner
int wnum; window number

Description

The wngwcol and wngwrow functions are used to obtain the current position of
window wnum. The values returned are those for the upper left corner of the
indicated window.

Return Value

Wngwcol returns the column (0-79) that contains the upper left window corner.
Wngrow returns the row (0-24) that contains the upper left window corner. A
negative return value from either functions indicates an invalid wnum.

See Also

wnmove, wnsize, wngwwidth, wngwheight

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

row = wngwrow(wnum); 5 will be returned
col = wngwcol(wnum); 10 will be returned











4 - 27
wngwcrow

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwccol(wnum); get current cursor column
int wngwcrow(wnum); get current cursor row
int wnum; window number

Description

The wngwccol and wngwcrow functions are used to obtain the current cursor
position for a given window wnum.

Return Value

The cursor column number is returned by wngwccol while the current cursor row is
returned by wngwcrow. Both values are referenced from the window origin and are
zero based. If the cursor for window wnum were at the upper left corner, just
inside the window border, values returned would be row 1, column 1.

See Also

wngwcmode, wnswcmode

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
.
wnlocate(wnum,2,5); position cursor
wnprintf(wnum,"Hello"); this will move cursor
row = wngwcrow(wnum); row will == 2
col = wngwccol(wnum); col will == 10 (5 + "Hello" == 10)









4 - 28
wngwfc

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwbc(wnum); return current background color
int wngwfc(wnum); return current foreground color
int wngwbbc(wnum); return current border background color
int wngwbfc(wnum); return current border foreground color
int wngwtbc(wnum); return current titles background color
int wngwtfc(wnum); return current titles foreground color
int wnum; window number

Description

The wngwbc, wngwfc, wngwbbc, wngwbfc, wngwtbc, and wngwtfc return the current
color settings for window wnum.

Return Value

A positive return value from any of the functions indicates the color for which
you were interested in. Any foreground color > 128 indicates blinking is
active. A negative return value means wnum is invalid.

See Also

wnswcolor, wnswbcolor, wnswtcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

color = wngwtbc(wnum); WNBLUE will return since titles default at creation time
to the border colors unless changed.









4 - 29
wngwheight

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwheight(wnum); return window height
int wngwwidth(wnum); return window width
int wnum; wnum

Description

The wngwheight and wngwwidth functions are used to obtain the current size of
window wnum.

Return Value

Wngwheight returns the height of wnum and wngwwidth returns the width. Both
values include the window border. A negative return value indicates an invalid
wnum.

See Also

wnsize

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
width = wngwwidth(wnum); 70 will be returned
height = wngwheight(wnum); 10 will be returned













4 - 30
wngwrow

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwcol(wnum); return column of upper left corner
int wngwrow(wnum); return row of upper left corner
int wnum; window number

Description

The wngwcol and wngwrow functions are used to obtain the current position of
window wnum. The values returned are those for the upper left corner of the
indicated window.

Return Value

Wngwcol returns the column (0-79) that contains the upper left window corner.
Wngrow returns the row (0-24) that contains the upper left window corner. A
negative return value from either function indicates an invalid wnum.

See Also

wnmove, wnsize, wngwwidth, wngwheight

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

row = wngwrow(wnum); 5 will be returned
col = wngwcol(wnum); 10 will be returned











4 - 31
wngwscroll

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwscroll(wnum);
int wnum; window number

Description

The wngwscroll function returns the scroll status for window wnum. The ability
to turn scroll on or off is needed if you want to place a character at the lower
right window corner. If scroll is on, all text lines will scroll up in the
window. If scroll is off, the cursor will wrap to location 1,1.

Return Value

A return value of 0 indicates window scrolling is off, 1 is on, and a negative
value means an invalid wnum.

See Also

wnswscroll

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
sstat = wngwscroll(wnum);














4 - 32
wngwtbc

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwbc(wnum); return current background color
int wngwfc(wnum); return current foreground color
int wngwbbc(wnum); return current border background color
int wngwbfc(wnum); return current border foreground color
int wngwtbc(wnum); return current titles background color
int wngwtfc(wnum); return current titles foreground color
int wnum; window number

Description

The wngwbc, wngwfc, wngwbbc, wngwbfc, wngwtbc, and wngwtfc return the current
color settings for window wnum.

Return Value

A positive return value from any of the functions indicates the color for which
you were interested in. Any foreground color > 128 indicates blinking is
active. A negative return value means wnum is invalid.

See Also

wnswcolor, wnswbcolor, wnswtcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

color = wngwtbc(wnum); WNBLUE will return since titles default at creation time
to the border colors unless changed.









4 - 33
wngwtfc

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwbc(wnum); return current background color
int wngwfc(wnum); return current foreground color
int wngwbbc(wnum); return current border background color
int wngwbfc(wnum); return current border foreground color
int wngwtbc(wnum); return current titles background color
int wngwtfc(wnum); return current titles foreground color
int wnum; window number

Description

The wngwbc, wngwfc, wngwbbc, wngwbfc, wngwtbc, and wngwtfc return the current
color settings for window wnum.

Return Value

A positive return value from any of the functions indicates the color for which
you were interested in. Any foreground color > 128 indicates blinking is
active. A negative return value means wnum is invalid.

See Also

wnswcolor, wnswbcolor, wnswtcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

color = wngwtbc(wnum); WNBLUE will return since titles default at creation time
to the border colors unless changed.









4 - 34
wngwwidth

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wngwheight(wnum); return window height
int wngwwidth(wnum); return window width
int wnum; wnum

Description

The wngwheight and wngwwidth functions are used to obtain the current size of
window wnum.

Return Value

Wngwheight returns the height of wnum and wngwwidth returns the width. Both
values include the window border. A negative return value indicates an invalid
wnum.

See Also

wnsize

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
width = wngwwidth(wnum); 70 will be returned
height = wngwheight(wnum); 10 will be returned













4 - 35
wninit

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wninit(mfflag, wh, wbuf, wbsize, wmar, wmfr);

int mfflag; memory/file screen save flag
int wh; file handle
int wbuf; file transfer buffer
int wbsize; file transfer buffer size
char *(*wmar)(); memory allocation routine
void (*wmfr)(); memory free routine

Description

The wninit function is used to initialize the Window Manager package and must be
called BEFORE any other window routines and AFTER calling the List Manager
initializer, lminit. Mfflag determines where screen saves under a window will
be put, 0 for memory, or 1 for saving to a file. If screen saves are to be put
in a file (mfflag), wh, wbuf, and wbsize must be supplied. Wh is the file
handle of an already opened file, wbuf is a pointer to a transfer buffer, and
wbsize is the size of the buffer. The buffer size must be at least char
buf[2]. If screen saves are to be to memory, wmar and wfr point to routines for
allocating/deallocating memory. The synopsis for these 2 routines are:

char *(*wmar)(lsize);
void (*mfr)(cptr);

long lsize; size of memory to allocate of size char
char *cptr; pointer to allocated memory block

Return Value

The wninit function returns 0 if all went well or a negative number if there was
a memory allocation error. Even if you specify mfflag = 1 there can be a memory
allocation error when this module calls the List Manager package to create
various internal data lists.

See Also

wncreate










4 - 36
wninit

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

#define cnull (char *(*)())NULL
#define vnull (void (*)())NULL

int wnum, fileh;
static char wbuf[4096]; file transfer buffer

fileh = open("wjunk.dat", O_RDWR | O_CREAT); screen save file

lminit(malloc,free,0); init list manager first thing
wninit(1, fileh, 4096, cnull, vnull); init window manager, save to a file
.
.
.
close(fileh);
remove("wjunk.dat");
































4 - 37
wninschar

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wninschar(wnum);
int wnum; window number

Description

The wninschar function is used to open a blank character slot at the current
cursor position, all characters to the right of, and including, the current
cursor position will be shifted to the right 1 character. The rightmost window
character will be lost.

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wnbs, wndeol, wninsline

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnlputs(wnum,2,3,"hello world");
wnlocate(wnum,2,5);
wninschar(wnum); row 2 is now "hell o world"












4 - 38
wninsline

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wninsline(wnum);
int wnum; window number

Description

The wninsline function is used to insert a blank line at the current cursor
position in window wnum. The inserted blank line is filled with the current
background color and all rows below the current row are scrolled down.

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wndline, wnscroll

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnlputs(wnum,2,1,"this is row 2");
wnlputs(wnum,3,1,"this is row 3");
wnlocate(wnum,3,1);
wninsline(wnum);
wnputs(wnum,"this is between row 2 and old row 3");











4 - 39
wninwindow

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wninwindow(wnum,row,col);
int wnum; window number
int row,col; position in window

Description

The wninwindow function tells you if the position row,col is INSIDE the border
of window wnum.

Return Value

A 0 return value indicates that row,col is not inside the border, 1 indicates
row,col is inside, and a negative return value means wnum is invalid.

See Also

wnwrowtos, wnwcoltos

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum, stat;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

stat = wninwindow(wnum,0,0); stat is false
stat = wninwindow(wnum,1,1); stat is true
stat = wninwindow(wnum,8,68); stat is true
stat = wninwindow(wnum,9,68); stat is false











4 - 40
wnlocate

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnlocate(wnum,row,col);
int wnum; window number
int row,col; new cursor position

Description

The wnlocate function is used to position the cursor for window number wnum.
Row,col is the desired cursor location. Window Manager text placement routines
will use the current cursor location as their printing start point.

With this routine it is possible to position the cursor on the window border
(0,0 ...). This will allow you to put text on the border corners, however, the
text colors will be those set by wnswcolor.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum. If the values for row or col are outside window wnum they will be ignored
and the cursor position will not be changed.

See Also

wnlputchar, wnlputncolor, wnlputhcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnlocate(wnum,0,0); locate cursor at upper left corner
wnprintf(wnum,"%d",wnum); print window number







4 - 41
wnlputchar

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnlputchar(wnum,row,col,c);
int wnputchar(wnum,c);
int wnum; window number
int row,col; cursor position
int c; character to print

Description

The wnlputchar and wnputchar functions are used to print a single character, c,
in window wnum. The wnlputchar function will call wnlocate with row,col prior
to printing while wnputchar assumes you have called wnlocate. Colors used will
be those set in the wncreate or wnswcolor functions. If row or col are outside
the window, the cursor position will not change and a character will not be
printed.

After printing, the cursor will be advanced 1 character to the right. If the
new column is in the right edge border or beyond, the cursor row will be
advanced and the cursor column set to 1. If the new cursor row (if any) winds
up in the bottom border or beyond, the window scroll flag will be looked at. If
the scroll flag is set, all text in the window will be scrolled up and the
cursor row will be set just above the bottom border. If the scroll flag is
false, the cursor row will be set to 1 and the window text will not be scrolled.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wnlputs, wnputs, wnprintf
















4 - 42
wnlputchar

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnlputchar(wnum,0,0,'1'); put "1" at upper corner in border
wnlocate(wnum,2,5); locate cursor
wnputchar(wnum,'X'); place an "X"





































4 - 43
wnlputhcolor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wnlputhcolor(wnum,row,col,bc,fc,len);
void wnputhcolor(wnum,bc,fc,len);
int wnum; window number
int row,col; cursor position
int bc; background color
int fc; foreground color
int len; number of characters to color

Description

The wnlputhcolor and wnputhcolor functions are used to color existing text in
window wnum. One of these 2 functions should be used when it is desired to
highlight text in an existing window.

If running on a color monitor, there is no difference between wnputncolor and
wnputhcolor, when running on a monochrome monitor though things are a little
different. In a mono display system the values of bc and fc are ignored and a
monochrome highlight attribute (as set by wnshmatt) is used. This approach
allows you to set up a color scheme that looks good on a color display without
worrying about how things will look on a mono display.

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wnputncolor, wnlputncolor, wnshmatt


















4 - 44
wnlputhcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnshmatt(WNUNDERLINE); how highlight will look on mono
wnsnmatt(WNREVERSE); how normal text will look on mono
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnlputs(wnum,2,1,"Hello World"); will be reverse video on mono
.
. because of how we set the monochrome attributes before the wncreate, the
. next line will cause "World" to turn green on yellow in a color system,
. underlined on a mono display.
.
wnlputhcolor(wnum,2,7,WNYELLOW,WNGREEN);































4 - 45
wnlputncolor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wnlputncolor(wnum,row,col,bc,fc,len);
void wnputncolor(wnum,bc,fc,len);
int wnum; window number
int bc; background color
int fc; text color
int len; number of columns to color
int row,col; cursor location

Description

The wnlputncolor and wnputncolor are used to change the colors of text already
displayed in window wnum. The wnputncolor function will change the color of len
number of characters, starting at the current cursor position. The background
will be changed to bc and the foreground to fc. The wnlputncolor routine will
change the current cursor position to row,col via wnlocate prior to changing
text colors.

Here are the available color constants as defined in the include file :

Constant Value Description Fc/Bc
==============================================
WNBLACK 0 Black Both
WNBLUE 1 Blue Both
WNGREEN 2 Green Both
WNCYAN 3 Cyan Both
WNRED 4 Red Both
WNMAGENTA 5 Magenta Both
WNBROWN 6 Brown Both
WNGRAY 7 Gray Both
WNDGRAY 8 Dark Gray Bc Only
WNLBLUE 9 Light Blue Bc Only
WNLGREEN 10 Light Green Bc Only
WNLCYAN 11 Light Cyan Bc Only
WNLRED 12 Light Red Bc Only
WNLMAGENTA 13 Light Magenta Bc Only
WNYELLOW 14 Yellow Bc Only
WNWHITE 15 White Bc Only

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wnputhcolor, wnlputhcolor, wnprintf

4 - 46
wnlputncolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnlputs(wnum,3,1,"Hello World");
.
. The next line will change "World" to blinking green on yellow (yuk)
.
wnlputncolor(wnum,3,7,WNYELLOW, WNGREEN | WNBLINK);



































4 - 47
wnlputs

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnlputs(wnum,row,col,str);
int wnputs(wnum,str);
int wnum; window number
int row,col; cursor position
char *str; null termination string to print

Description

The wnlputs and wnputs function print a null terminated string, str, in window
wnum. The wnlputs function will call wnlocate with row,col prior to printing
while wnputs assumes you have called wnlocate. Colors used will be those set in
the wncreate or wnswcolor functions. If row or col are outside the window, the
cursor position will not change and your string will not be printed.

Rules for cursor wrap and scrolling are the same as the wnputchar function.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wnputchar, wnlocate, wnprintf

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnlputs(wnum,2,7,"Hello World"); locate and print string







4 - 48
wnltitle

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnbtitle(wnum,str); bottom title routine
int wnltitle(wnum,str); left title routine
int wnrtitle(wnum,str); right title routine
int wnttitle(wnum,str); top title routine

int wnum; window number
char *str; title string

Description

The wnbtitle, wnltitle, wnrtitle, and wnttitle functions are used to place a
title string, str, in the border of window wnum. The title string str will be
centered vertically if using wnltitle or wnrtitle, horizontally if using
wnbtitle or wnttitle. Passing a null terminated string with length of 0 will
cause a displayed title to be removed. If the title string is too long it will
be truncated to fit the window border.

The string str will be bordered on both ends by the current window border
characters so if you want something that looks clean you should probably
bracket your title strings with something like "[ good title ]" instead of
just "good title".

After creation, window title colors will be the same as the border characters.
Use the wnswtcolor function prior to calling a titling routine if you want
different title colors.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wnswtcolor













4 - 49
wnltitle

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnttitle(wnum,"[ Main Menu ]"); top title same color as border
wnswtcolor(wnum,WNBLUE,WNCYAN); color for new titles
wnbtitle(wnum,"[ ESC to Exit ]"); bottom title with new colors





































4 - 50
wnmove

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnmove(wnum,row,col);
int wnum; window number
int row,col; new window location

Description

The wnmove function is used to move existing window wnum to a new screen
location row and col. The new position is where you want the upper left
window corner to be placed. All text, colors, and titles will be moved with the
window but it is the applications responsibility for making sure the window
being moved will fit at the new location.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wncreate, wnsize

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnmove(wnum,7,13); move right 2, down 3











4 - 51
wnmovechar

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wnmovechar(wnum,torow,tocol);
int wnum; window number
int torow,tocol; new position

Description

The wnmovechar function moves the character and color from the current cursor
location in wnum to the new location torow,tocol. The old character location
will be filled with a space using the default window background color. The
current cursor location does not change.

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wnmoves

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnlocate(wnum,2,3); position cursor
wnputchar(wnum,'V'); put a character at 2,3
wnlocate(wnum,2,3);
wnmovechar(wnum,5,7); move "V" to 5,7 blank now at 2,3









4 - 52
wnmoves

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wnmoves(wnum,torow,tocol,len);
int wnum; window number
int torow,tocol; new position
int len; number of characters to move

Description

The wnmoves function is used to move a string from the current cursor position
in wnum to a new position; torow,tocol. Len number of characters will be moved
along with their color attributes. The space previously occupied by the string
will be filled with blanks using the current window background color.
Overlapping of the old and new locations will be handled correctly but it is
your responsibility to ensure that the new location will accomodate len
characters.

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wnmovechar

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnprintf(wnum,"Hello world"); print something
wnlocate(wnum,1,1);
wnmoves(wnum,1,13); now we have "world Hello"






4 - 53
wnprintf

Summary

#include "malloc.h"

#include "lm.h"
#include "km.h"
#include "wn.h"

int wnprintf(wnum,formatstring[,argument...]);
int wnum; window number
char *formatstring; format control

Description

The wnprintf function formats and prints a series of characters and values to
the window wnum. The formatstring consists of ordinary characters, escape
sequences, and, if there are arguments following the formatstring, format
specifications. Oridinary characters and escape sequences are simply copied to
wnum in order of their appearance.

If there are arguments following the formatstring, then the formatstring must
contain format specifications that determine the output format for these
arguments. Format specifications always begin with a percent sign (%) or tilde
(~), and are described in greater detail below.

The formatstring is read left to right. When the first format specification (if
any) is encountered, the value of the first argument after the formatstring is
converted and output according to the format specification. The second format
specification causes the second argument to be converted and output, and this
continues through the end of the formatstring. If there are more arguments than
there are format specifications, the extra arguments are ignored. The results
are undefined if there are not enough arguments for all the format
specifications.

A format specification has the following form:

%[flags][width][.precision][{F|N|h|l}]type

or

~{bccolor|*},{fccolor|*}~


The second format specification type allows color change information to be
imbedded in formatstring. Each color change specification must include both
background and foreground colors delimited on each side by the tilde (~)
character. An asterisk (*) supplied for one or both colors will cause a change
to the appropriate window default color. Color change specifications are in
effect for a single wnprintf statement, subsequent wnprintf calls will use the
window default colors.

Each field of the first format specification is a single character or a number
signifying a particular format option. The type character, which appears after
the last optional format field, determines whether the associated argument is

4 - 54
wnprintf

interpreted as a character, a string, or a number (see Table P.1). The simplest
format specificatin contains only the percent sign and a type character (for
example, %s). The optional fields control other aspects of the formatting, as
follows:


flags - Justification of output and printing of signs, blanks, decimal points,
octal and hexadecimal prefixes (see Table P.2).

width - Minimum number of character output.

precision - Maximum number of characters printed for all or par of the output
field, or minimum number of digits printed for integer values (see Table P.3).

bccolor - New background color for subsequent output in this wnprintf call.

fccolor - New foreground color for subsequent output in this wnprintf call.

F,N - Prefixes that allow user to override default addressing conventions of
memory model being used:

F - Used in small model to print value that has been declared far.

N - Used in medium, large and huge models for near value.

F and N should be used only with the s and p type characters, since they are
relevant only with arguments that pass a pointer.

h - Used as a prefix with the integer types d,i,o,u,x, and X to specify that the
argument is a short int.

l - Used as a prefix with d,i,o,u,x, and X types to specify that the argument is
a long int; also used as a prefix with e,E,g, or G types to show that the
argument is double, rather than float.


If a percent sign (%) is followed by a character that has no meaning as a format
field, the character is simply copied to wnum. For example, to print a percent-
sign character, use %%.

Table P.1

wnprintf Type Characters
========================

d - Integer - Signed Decimal integer

i - Integer - Signed decimal integer

u - Integer - Unsigned decimal integer

o - Integer - Unsigned Octal integer


4 - 55
wnprintf

x - Integer - Unsigned hexadecimal integer, using "abcdef"

X - Integer - Unsigned hexadecimal integer, using "ABCDEF"

f - Floating point - Signed value having the form [-]dddd.dddd, where dddd is
one or more decimal digits. The number of digits before the decimal point
depends on the magnitude of the number, and the number of digits after the
decimal point depends on the requested precision.

e - Floating point - Signed value having the form [-]d.dddd e [sign]ddd, where d
is a single decimal digit, dddd is one or more decimal digits, ddd is exactly
three decimal digits, and sign is + or -.

E - Floating point - Identical to the "e" format, except that "E" introduces the
exponent instead of "e".

g - Floating point - Signed value printed in "f" or "e" format, whichever is
more compact for the given value and precision (see below). The "e" format is
used only when the exponent of the value is less than -4 or greater than
precision. Trailing eros are truncated and the decimal point appears only if
one or more digits follow it.

G - Floating point - Identical to the "g" format, except that "E" introduces the
exponent (where appropriate) instead of "e".

c - Character - Single character

s - String - Characters printed up to the first null character ('\0') or until
precision is reached.

n - Pointer to integer - Number of characters successfully written so far to the
stream or buffer; this value is stored in the integer whose address is given as
the argument.

p - Far pointer - Prints the address pointed to by the argument in the form
zzzz.yyyy, where zzzz is the segment and yyyy is the offset, and the digits x
and y are uppercase hexadecimal digits; %Np prints only the offset of the
address, yyyy. Since %p expects a pointer to a far value, pointer arguments to p
must be cast to far in small-model programs.


Table P.2

wnprintf Flag Characters
========================

Flag ==> -
Default ==> Right justify
Meaning ==> Left justify the result within the field width.

Flag ==> +
Default ==> Sign appears only for negative signed values (-).
Meaning ==> Prefix the output value with a sign (+ or -) if the output value

4 - 56
wnprintf

is of a signed type.

Flag ==> blank (' ')
Default ==> No blank
Meaning ==> Prefix the output value with a blank if the output value is signed
and positive; the "+" flag overrides the blank flag if both appear,
and a positive signed value will be output with a sign.

Flag ==> # (o,x,X)
Default ==> No Prefix
Meaning ==> When used with the o,x, or X format, the "#" flag prefixes any
nonzero output value with 0, 0x, or 0X, respectively.

Flag ==> # (e,E,f)
Default ==> Decimal point appears only if digits follow it.
Meaning ==> When used with the e,E, or f format, the "#" flag forces the output
value to contain a decimal point in all cases.

Flag ==> # (g,G)
Default ==> Decimal point appears only if digits follow it. Trailing zeros are
truncated.
Meaning ==> When used with the g or G format, the "#" flag forces the output
value to contain a decimal point in all cases and prevents the
truncation of trailing zeros. The "#" flag is ignored when used
with c,d,i,u, or s.

The width is a non-negative decimal integer controlling the minimum number of
characters printed. If the number of characters in the ouput value is less than
the specified width, blanks are added on the left or the right (depending on
whether the "-" flag is specifed) until the minimum width is reached. If width
is prefixed with a 0, zeros are added until the minimum width is reached (not
useful for left-justified numbers).

The width specification never causes a value to be truncated; if the number of
characters in the output value is greater than the specified width , or width is
not given, all characters of the value are printed (subject to the precision
specification).

The precision specification is a non-negative decimal integer preceded by a
period (.), which specifies the number of characters to be printed, or the
number of decimal places. Unlike the width specification, the precision can
cause truncation of the output value, or rounding in the case of a floating-
point value.

The precision specification may be an asterisk (*), in which case an argument
from the argument list supplies the value. The precision argument must precede
the value being formatted in the argument list.

The interpretation of the precision value, and the default when precision is
omitted, depend on the type, as shown in Table P.3




4 - 57
wnprintf

Table P.3

How wnprintf Precision Values Affect Type
=========================================

Type(s) ==> d,i,u,o,x,X
Meaning ==> The precision specifies the minimum number of digits to be printed.
If the number of digits in the argument is less than precision,
the output value is padded on the left with zeros. The value is
not truncated when the number of digits exceeds precision.
Default ==> If precision is 0 or omitted entirely, or if the period (.) appears
without a number following it, the precision is set to 1.

Type(s) ==> e,E,f
Meaning ==> The precision specifies the number of digits to be printed after the
decimal point. The last printed digit is rounded.
Default ==> Default precision is six; if precision is 0 or the period (.)
appears without a number following it, no decimal point is printed.

Type(s) ==> g,G
Meaning ==> The precision specifies the maximum number of significant digits
printed.
Default ==> All significant digits are printed.

Type(s) ==> c
Meaning ==> No effect
Default ==> Character printed

Type(s) ==> s
Meaning ==> The precision specifies the maximum number of characters to be
printed. Characters in excess of precision are not printed.
Default ==> Characters are printed until a null character is encountered.

Return Value

The wnprintf function returns the number of characters printed.

See Also

wnputchar, wnputs














4 - 58
wnprintf

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;
char ch = 'h', *string = "hello world";
int count = 234, *ptr, hex = 0x10, oct = 010, dec = 10;
double fp = 251.7366;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(0,0,70,20,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnttitle(wnum,"[ Test Window ]");

wnprintf(wnum,"%d %+d %06d %X %x %o\n\n",
count, count, count, count, count, count);

wnprintf(wnum,"1234567890234%n45678901234567890\n\n",&count);

wnprintf(wnum,"Value of count should be 13; count = %d\n\n",count);

wnprintf(wnum,"%10c%5c\n\n",ch,ch);

wnprintf(wnum,"%25s\n%25.4s\n\n",string,string);

wnprintf(wnum,"%f %.2f %e %E\n\n",fp, fp, fp, fp);

wnprintf(wnum,"%i %i %i\n", hex, oct, dec);

ptr = &count;
wnprintf(wnum,"%Np %p %Fp\n",ptr, (int far *)ptr, (int far *)ptr);

wnprintf(wnum,"cyan on black~%d,%d~ red on yellow",WNYELLOW,WNRED);

















4 - 59
wnprintf

Output:

ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ[ Test Window ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
º234 +234 000234 EA ea 352 º
º º
º123456789012345678901234567890 º
º º
ºValue of count should be 13; count = 13 º
º º
º h h º
º º
º hello world º
º hell º
º º
º251.736600 251.74 2517366e+002 2.517366E+002 º
º º
º16 8 10 º
º127A 1328:127A 1328:127A º
º º
ºcyan on black red on yellow º
º º
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
































4 - 60
wnputchar

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnlputchar(wnum,row,col,c);
int wnputchar(wnum,c);
int wnum; window number
int row,col; cursor position
int c; character to print

Description

The wnlputchar and wnputchar functions are used to print a single character, c,
in window wnum. The wnlputchar function will call wnlocate with row,col prior
to printing while wnputchar assumes you have called wnlocate. Colors used will
be those set in the wncreate or wnswcolor functions. If row or col are outside
the window, the cursor position will not change and a character will not be
printed.

After printing, the cursor will be advanced 1 character to the right. If the
new column is in the right edge border or beyond, the cursor row will be
advanced and the cursor column set to 1. If the new cursor row (if any) winds
up in the bottom border or beyond, the window scroll flag will be looked at. If
the scroll flag is set, all text in the window will be scrolled up and the
cursor row will be set just above the bottom border. If the scroll flag is
false, the cursor row will be set to 1 and the window text will not be scrolled.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wnlputs, wnputs, wnprintf
















4 - 61
wnputchar

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnlputchar(wnum,0,0,'1'); put "1" at upper corner in border
wnlocate(wnum,2,5); locate cursor
wnputchar(wnum,'X'); place an "X"





































4 - 62
wnputhcolor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wnlputhcolor(wnum,row,col,bc,fc,len);
void wnputhcolor(wnum,bc,fc,len);
int wnum; window number
int row,col; cursor position
int bc; background color
int fc; foreground color
int len; number of characters to color

Description

The wnlputhcolor and wnputhcolor functions are used to color existing text in
window wnum. One of these 2 functions should be used when it is desired to
highlight text in an existing window.

If running on a color monitor, there is no difference between wnputncolor and
wnputhcolor, when running on a monochrome monitor though things are a little
different. In a mono display system the values of bc and fc are ignored and a
monochrome highlight attribute (as set by wnshmatt) is used. This approach
allows you to set up a color scheme that looks good on a color display without
worrying about how things will look on a mono display.

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wnputncolor, wnlputncolor, wnshmatt


















4 - 63
wnputhcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnshmatt(WNUNDERLINE); how highlight will look on mono
wnsnmatt(WNREVERSE); how normal text will look on mono
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnlputs(wnum,2,1,"Hello World"); will be reverse video on mono
.
. because of how we set the monochrome attributes before the wncreate, the
. next line will cause "World" to turn green on yellow in a color system,
. underlined on a mono display.
.
wnlputhcolor(wnum,2,7,WNYELLOW,WNGREEN);































4 - 64
wnputncolor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wnlputncolor(wnum,row,col,bc,fc,len);
void wnputncolor(wnum,bc,fc,len);
int wnum; window number
int bc; background color
int fc; text color
int len; number of columns to color
int row,col; cursor location

Description

The wnlputncolor and wnputncolor are used to change the colors of text already
displayed in window wnum. The wnputncolor function will change the color of len
number of characters, starting at the current cursor position. The background
will be changed to bc and the foreground to fc. The wnlputncolor routine will
change the current cursor position to row,col via wnlocate prior to changing
text colors.

Here are the available color constants as defined in the include file :

Constant Value Description Fc/Bc
==============================================
WNBLACK 0 Black Both
WNBLUE 1 Blue Both
WNGREEN 2 Green Both
WNCYAN 3 Cyan Both
WNRED 4 Red Both
WNMAGENTA 5 Magenta Both
WNBROWN 6 Brown Both
WNGRAY 7 Gray Both
WNDGRAY 8 Dark Gray Bc Only
WNLBLUE 9 Light Blue Bc Only
WNLGREEN 10 Light Green Bc Only
WNLCYAN 11 Light Cyan Bc Only
WNLRED 12 Light Red Bc Only
WNLMAGENTA 13 Light Magenta Bc Only
WNYELLOW 14 Yellow Bc Only
WNWHITE 15 White Bc Only

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wnputhcolor, wnlputhcolor, wnprintf

4 - 65
wnputncolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnlputs(wnum,3,1,"Hello World");
.
. The next line will change "World" to blinking green on yellow (yuk)
.
wnlputncolor(wnum,3,7,WNYELLOW, WNGREEN | WNBLINK);



































4 - 66
wnputs

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnlputs(wnum,row,col,str);
int wnputs(wnum,str);
int wnum; window number
int row,col; cursor position
char *str; null termination string to print

Description

The wnlputs and wnputs function print a null terminated string, str, in window
wnum. The wnlputs function will call wnlocate with row,col prior to printing
while wnputs assumes you have called wnlocate. Colors used will be those set in
the wncreate or wnswcolor functions. If row or col are outside the window, the
cursor position will not change and your string will not be printed.

Rules for cursor wrap and scrolling are the same as the wnputchar function.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wnputchar, wnlocate, wnprintf

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnlputs(wnum,2,7,"Hello World"); locate and print string







4 - 67
wnrtitle

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnbtitle(wnum,str); bottom title routine
int wnltitle(wnum,str); left title routine
int wnrtitle(wnum,str); right title routine
int wnttitle(wnum,str); top title routine

int wnum; window number
char *str; title string

Description

The wnbtitle, wnltitle, wnrtitle, and wnttitle functions are used to place a
title string, str, in the border of window wnum. The title string str will be
centered vertically if using wnltitle or wnrtitle, horizontally if using
wnbtitle or wnttitle. Passing a null terminated string with length of 0 will
cause a displayed title to be removed. If the title string is too long it will
be truncated to fit the window border.

The string str will be bordered on both ends by the current window border
characters so if you want something that looks clean you should probably
bracket your title strings with something like "[ good title ]" instead of
just "good title".

After creation, window title colors will be the same as the border characters.
Use the wnswtcolor function prior to calling a titling routine if you want
different title colors.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wnswtcolor













4 - 68
wnrtitle

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnttitle(wnum,"[ Main Menu ]"); top title same color as border
wnswtcolor(wnum,WNBLUE,WNCYAN); color for new titles
wnbtitle(wnum,"[ ESC to Exit ]"); bottom title with new colors





































4 - 69
wnscparms

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wnscparms(wsave,wscroll,wcmode,ul,ur,ll,lr,0,0,0,0,0,vc,hc);

int wsave; screen save flag
int wscroll; scroll on/off flag
int wcmode; cursor style
int ul,ur,ll,lr,vc,hc; border drawing characters

Description

The wnscparms allows you to determine what parameters will be used in creating
new windows. Unless you call the wnscparms function the following parameters
will be used when creating new windows:

Parameter Description Value
==============================================
wsave Screen save under window - on
wscroll Window scroll - on
wcmode Cursor type - WNUNDCURSOR
ul,ur,ll,lr
vc,hc Border characters - double line

If wsave is true, newly created windows will have the screen under them saved to
either memory or file, whichever was specified in the wninit function. A true
value for wscroll will cause all window text to scroll up when a character is
written to the lower right window corner, a false value will cause the cursor to
wrap to position 1,1. Wcmode specifies the cursor style. Ul, ur,ll, and lr are
the corner characters for the window border, vc is used for the left and right
sides while hc is used for the top and bottom. The zeros supplied in the call
are for parameters to be used in future releases.


















4 - 70
wnscparms

If you don't want your windows to have borders, supply a space character for all
of the box drawing set. Normal window printing routines will still stay within
the border confines though. Here are different border types you might want to
have:

Default

201 hc 187 218 191
ÉÍÍÍÍÍÍÍÍÍÍÍÍ» ÚÄÄÄÄÄÄÄÄÄÄÄ¿
º ul ur º ³ ³
º º ³ ³
º º ³ ³
º 186 º vc ³ 179 ³
º º ³ ³
º º ³ ³
º ll lr º ³ ³
ÈÍÍÍÍÍÍÍÍÍÍÍͼ ÀÄÄÄÄÄÄÄÄÄÄÄÙ
200 205 188 192 196 217


214 183 213 184
ÖÄÄÄÄÄÄÄÄÄÄÄÄ· ÕÍÍÍÍÍÍÍÍÍÍ͸
º º ³ ³
º º ³ ³
º º ³ ³
º 186 º ³ 179 ³
º º ³ ³
º º ³ ³
º º ³ ³
ÓÄÄÄÄÄÄÄÄÄÄÄĽ ÔÍÍÍÍÍÍÍÍÍÍ;
211 196 189 212 205 190

Return Value

This function has no return value.

See Also

wngcparms, wnswcmode, wnswscroll, wnswbchars















4 - 71
wnscparms

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnscparms(1,1,WNSOLCURSOR,218,191,192,217,0,0,0,0,0,179,196);
.
. now we'll create a window. Screen save will be on, scroll on,
. cursor will be a blinking solid, and the box drawing set will
. use single line characters.
.
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window



































4 - 72
wnscroll

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wnscroll(wnum,srow,nrows,dir);
int wnum; window number
int srow; top row of scroll area
int nrows; rows to scroll
int dir; scroll direction

Description

The wnscroll function is used to scroll a block of lines inside wnum either up
or down as set by dir. Startrow defines the top row of the scroll window,
nrows tells how many rows will be scrolled. If scrolling up, the top line of
the scroll window will be lost while the new bottom line will be filled with
blanks using the current window background color. If scrolling down, the bottom
line will be lost and the top will be set to blanks.

The current setting of the window scroll flag has no effect on this function.

Symbolic values that can be used for dir:

Constant Direction
============================

WUP Up
WDOWN Down

Return Value

This function has no return value. If any parameters are invalid or out of
range, the operation will not be performed.

See Also

wninsline, wndline














4 - 73
wnscroll

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnprintf(wnum,"This is line 1\n");
wnprintf(wnum,"This is line 2\n");
wnprintf(wnum,"This is line 3\n");
wnprintf(wnum,"This is line 4\n");
wnprintf(wnum,"This is line 5\n");
wnprintf(wnum,"This is line 6\n");
.
.
.
wnscroll(wnum,3,3,WUP); line 3 now missing, blank line between
5 and 6






























4 - 74
wnshmatt

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wnshmatt(att);
int att; highlight mono attribute

Description

The wnshmatt function sets the highlight attribute that will be used for newly
created windows. Currently this value is used by the wnputhcolor function which
in turns is used by the menu package and field processing routines. The value
of att determines how highlighted text will appear on a mono display.

att value display format
==============================================
WNNORMAL white text on black background
WNREVERSE black text on white background
WNUNDERLINE white on black w/underline

Return Value

The wnshmatt function has no return value.

See Also

wnghmatt, wnputhcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnshmatt(WNUNDERLINE); new windows will underline if mono
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window









4 - 75
wnsize

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnsize(wnum,width,height);
int wnum; window number
int width,height; new window size

Description

The wnsize function is used to resize existing window wnum. The top left corner
of the window will remain at its original location and all text and titles will
be destroyed. Cursor style, scroll, border chars, and color will remain as they
were, with only width and height changing.

The parameters width and height specify the new size of window wnum.

Only a window that does not have another window "on top" of itself should be
resized.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wncreate, wnmove

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnsize(wnum,60,5); shrink window







4 - 76
wnsnmatt

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

void wnsnmatt(att);
int att; normal mono attribute

Description

The wnsnmatt function sets the normal text attribute that will be used for newly
created windows when running on a monochrome display. Currently this value is
used by the wnputhcolor function which in turns is used by the menu package and
field processing routines. The value of att determines how normal text will
appear on a mono display.

att value display format
==============================================
WNNORMAL white text on black background
WNREVERSE black text on white background
WNUNDERLINE white on black w/underline

Return Value

The wnshmatt function has no return value.

See Also

wnghmatt, wnshmatt, wngnmatt, wnputhcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager
wnsnmatt(WNUNDERLINE); new windows will underline if mono
wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window









4 - 77
wnswbchars

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnswbchars(wnum,ul,ur,ll,lr,vc,hc);
int wnum; window number
int ul,ur,ll,lr,vc,hc; border characters

Description

The wnswbchars function is used to change the border characters of an existing
window. Ul, ur,ll, and lr are the corner characters, vc is the left/right side
character, and hc is the top/bottom character. Any existing titles will be
destroyed and need to be regenerated. For "clean" window display you should use
the wngcparms and wnscparms functions to alter the border drawing characters
prior to creating your windows. Here are a few window formats and their box
characters:

201 hc 187 218 191
ÉÍÍÍÍÍÍÍÍÍÍÍÍ» ÚÄÄÄÄÄÄÄÄÄÄÄ¿
º ul ur º ³ ³
º º ³ ³
º º ³ ³
º 186 º vc ³ 179 ³
º º ³ ³
º º ³ ³
º ll lr º ³ ³
ÈÍÍÍÍÍÍÍÍÍÍÍͼ ÀÄÄÄÄÄÄÄÄÄÄÄÙ
200 205 188 192 196 217

214 183 213 184
ÖÄÄÄÄÄÄÄÄÄÄÄÄ· ÕÍÍÍÍÍÍÍÍÍÍ͸
º º ³ ³
º º ³ ³
º 186 º ³ 179 ³
º º ³ ³
º º ³ ³
º º ³ ³
ÓÄÄÄÄÄÄÄÄÄÄÄĽ ÔÍÍÍÍÍÍÍÍÍÍ;
211 196 189 212 205 190

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wngwbchars, wnscparms


4 - 78
wnswbchars

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnswbchars(wnum,214,183,211,189,186,196); single top/bottom, double sides








































4 - 79
wnswbcolor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnswbcolor(wnum,bbc,bfc);
int wnum; window number
int bbc; border background color
int bfc; border foreground color

Description

The wnswbcolor function is used to change the border background and foreground
colors of window wnum. Bbc is the new background color, bfc is the new
foreground color.

Note:
This function causes the window border to be redrawn, therefore you will lose
any titles currently present on the window.

The following color constants or values can be used when specifying background
and/or foreground colors:

Constant Value Description Bbc/Bfc
==============================================
WNBLACK 0 Black Both
WNBLUE 1 Blue Both
WNGREEN 2 Green Both
WNCYAN 3 Cyan Both
WNRED 4 Red Both
WNMAGENTA 5 Magenta Both
WNBROWN 6 Brown Both
WNGRAY 7 Gray Both
WNDGRAY 8 Dark Gray Bc Only
WNLBLUE 9 Light Blue Bc Only
WNLGREEN 10 Light Green Bc Only
WNLCYAN 11 Light Cyan Bc Only
WNLRED 12 Light Red Bc Only
WNLMAGENTA 13 Light Magenta Bc Only
WNYELLOW 14 Yellow Bc Only
WNWHITE 15 White Bc Only

Return Value

This function returns 0 if all went well, a negative number indicates an invalid
wnum.

See Also

wnswcolor, wnswtcolor, wngwbbc, wngwbfc


4 - 80
wnswbcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
.
.
.
wnswbcolor(wnum,WNGRAY,WNGREEN); border now green on gray





































4 - 81
wnswcmode

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnswcmode(wnum,cmode);
int wnum; window number
int cmode; cursor mode

Description

The wnswcmode function changes the cursor style for window wnum. The desired
cursor style, cmode, can be 1 of the following:

Constant Description
==========================================
WNNOCURSOR No cursor
WNUNDCURSOR Underline blinking cursor
WNSOLCURSOR Solid blinking cursor

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wngwcmode, wnscparms

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
.
wnswcmode(wnum,WNSOLCURSOR); set cursor to solid








4 - 82
wnswcolor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnswcolor(wnum,bc,fc);
int wnum; window number
int bc; text background color
int fc; text foreground color

Description

The wnswcolor function is used to change the inside text background and
foreground colors of window wnum. Bc is the new background color, fc is the new
foreground color. The new colors will take effect immediately causing already
present text and subsequent text to appear in the new colors.

The following color constants or values can be used when specifying background
and/or foreground colors:

Constant Value Description Fc/Bc
==============================================
WNBLACK 0 Black Both
WNBLUE 1 Blue Both
WNGREEN 2 Green Both
WNCYAN 3 Cyan Both
WNRED 4 Red Both
WNMAGENTA 5 Magenta Both
WNBROWN 6 Brown Both
WNGRAY 7 Gray Both
WNDGRAY 8 Dark Gray Bc Only
WNLBLUE 9 Light Blue Bc Only
WNLGREEN 10 Light Green Bc Only
WNLCYAN 11 Light Cyan Bc Only
WNLRED 12 Light Red Bc Only
WNLMAGENTA 13 Light Magenta Bc Only
WNYELLOW 14 Yellow Bc Only
WNWHITE 15 White Bc Only

Return Value

This function returns 0 if all went well, a negative number indicates an invalid
wnum.

See Also

wnswbcolor, wnswtcolor, wngwbc, wngwfc





4 - 83
wnswcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
.
.
.
wnswcolor(wnum,WNGRAY,WNGREEN); inside now green on gray





































4 - 84
wnswscroll

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnswscroll(wnum,scrollflag);
int wnum; window number
int scrollflag; scroll on/off flag

Description

The wnswscroll function determines cursor positioning when the printing routines
place a character at the lower right window corner. If scrollflag is true, all
text in the window will be scrolled up, false causes the cursor to be wrapped to
position 1,1 without scrolling the window text.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wngwscroll, wnscparms

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
wnswscroll(wnum,1); turn scrolling on
.
. The next 2 lines will print the word "hello" at the lower right corner
. causing all text in the window to scroll up.
.
wnlocate(wnum,8,64);
wnprintf(wnum,"hello"); window will scroll
.
.
wnswscroll(wnum,0); turn scrolling off
wnlocate(wnum,8,64);
wnprintf(wnum,"hello"); cursor wrapped to 1,1


4 - 85
wnswtcolor

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnswtcolor(wnum,tbc,tfc);
int wnum; window number
int tbc; titles background color
int tfc; titles foreground color

Description

The wnswtcolor function is used to change the title text background and
foreground colors of window wnum. Tbc is the new background color, tfc is the
new foreground color. This function will not affect existing titles, only new
ones.

The following color constants or values can be used when specifying background
and/or foreground colors:

Constant Value Description Tbc/Tfc
==============================================
WNBLACK 0 Black Both
WNBLUE 1 Blue Both
WNGREEN 2 Green Both
WNCYAN 3 Cyan Both
WNRED 4 Red Both
WNMAGENTA 5 Magenta Both
WNBROWN 6 Brown Both
WNGRAY 7 Gray Both
WNDGRAY 8 Dark Gray Bc Only
WNLBLUE 9 Light Blue Bc Only
WNLGREEN 10 Light Green Bc Only
WNLCYAN 11 Light Cyan Bc Only
WNLRED 12 Light Red Bc Only
WNLMAGENTA 13 Light Magenta Bc Only
WNYELLOW 14 Yellow Bc Only
WNWHITE 15 White Bc Only

Return Value

This function returns 0 if all went well, a negative number indicates an invalid
wnum.

See Also

wnswbcolor, wnswcolor, wngwbc, wngwfc





4 - 86
wnswtcolor

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
.
.
.
wnswtcolor(wnum,WNGRAY,WNGREEN); new titles now green on gray





































4 - 87
wnttitle

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnbtitle(wnum,str); bottom title routine
int wnltitle(wnum,str); left title routine
int wnrtitle(wnum,str); right title routine
int wnttitle(wnum,str); top title routine

int wnum; window number
char *str; title string

Description

The wnbtitle, wnltitle, wnrtitle, and wnttitle functions are used to place a
title string, str, in the border of window wnum. The title string str will be
centered vertically if using wnltitle or wnrtitle, horizontally if using
wnbtitle or wnttitle. Passing a null terminated string with length of 0 will
cause a displayed title to be removed. If the title string is too long it will
be truncated to fit the window border.

The string str will be bordered on both ends by the current window border
characters so if you want something that looks clean you should probably
bracket your title strings with something like "[ good title ]" instead of
just "good title".

After creation, window title colors will be the same as the border characters.
Use the wnswtcolor function prior to calling a titling routine if you want
different title colors.

Return Value

This function returns 0 if all went well. A negative value indicates an invalid
wnum.

See Also

wnswtcolor













4 - 88
wnttitle

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum = wncreate(5,10,70,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window

wnttitle(wnum,"[ Main Menu ]"); top title same color as border
wnswtcolor(wnum,WNBLUE,WNCYAN); color for new titles
wnbtitle(wnum,"[ ESC to Exit ]"); bottom title with new colors





































4 - 89
wnxlatwtos

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnxlatwtos(wnum,row,col); window position to screen translation
int wnum; window number
int *row,*col; POINTERS to row,col to translate

Description

The wnxlatwtos function is used to obtain the display screen coordinates if
the windows coordinates are known. These routines are most helpful when
creating overlapping windows. Wnum is the window number, row and col are the
window coordinates you want translated to screen coordinates.

Remember, you must supply Pointers to the variables row and col which will be
changed by this routine.

Return Value

A value of 0 indicates the translation went well. A negative return value
indicates an invalid wnum.

It is your responsibility for ensuring that row and col are inside the window
boundries.

See Also

wncreate, wninwindow






















4 - 90
wnxlatwtos

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"

int wnum1, wnum2;
int row,col;

lminit(malloc,free,0); init list manager first thing
wninit(0,0,NULL,0,malloc,free); init window manager

wnum1 = wncreate(5,10,30,10,WNBLACK,WNCYAN,WNBLUE,WNRED); create window
.
. The next few lines will allow us to create a window "on top" of wnum1
. without knowing the exact location of wnum1.
.
. wnum1 ÉÍÍÍÍÍÍÍÍÍÍÍ»
. º º
. º º
. º º
. º ÉÍÍÍÍÍÍÍÍÍÍÍ»
. º º º
. º º º
. ÈÍÍÍÍͺ º
. º º
. º º
. º º
. ÈÍÍÍÍÍÍÍÍÍÍͼ wnum2
.
row = wngwheight(wnum1) / 2;
col = wngwwidth(wnum1) / 2;
wnxlatwtos(wnum1,&row,&col); find screen center of wnum1
wnum2 = wncreate(row,col,30,5,WNBLACK,WNCYAN,WNBLUE,WNRED); create window



















4 - 91
























































4 - 92
5 Help Manager

5.1 Introduction

The Help Manager is a collection of library routines which allow your
applications to provide online, context sensitive help. The text file used by
the Help Manager is created a supplied utility program, HFBILDER.EXE.

5.2 Help File Builder

Before online help can be supplied to your users a normal ASCII text file which
contains the help text must be massaged into a format the Help Manager likes to
work with, this is done by the utility program HFBILDER.EXE. The format your
help text file must follow is:

~label_1
text
text
text
~label_2
text
text
text

Where:
~ - is the ASCII tilde character
label_x - a label of up to 32 characters
to identify the help text to
follow.
text - lines of text which make up the
help message (78 chars max).

All text lines following a label (blank lines included) up to the next label or
end of file comprises a help message. When help is activated all lines
comprising a help message will be shown to the user.

To run the help file builder program from DOS just type:

HFBILDER

You will be prompted for your input filename and an output filename. The
program will not allow input and output to have the same name but if the output
file already exists it will be overwritten without warning. The output filename
you specify is the same name that must be used in the hminit function call.

A sample help text file, HELPFILE.TXT, and demo program, HELPDEMO.EXE is
included in this package for your examination.









5 - 1
5.3 Symbolic Constants

The following symbolic constants can be found in the include file .

5.3.1 Error Constants

A successful List Manager function call will return a value greater than or
equal to zero. An error condition will cause one of the following negative
values to be returned:

Constant Value Description
======== ===== ===========
HMMAERROR -1 memory allocation error
HMFOERROR -2 file open error
HMFCERROR -3 file close error
HMFRERROR -4 file read error
HMFWERROR -5 file write error

5.4 Module Initialization

Before the Help Manager can be used it must be initialized. This is done by
calling the hminit function before all other help routines and AFTER
initializing the List Manager via lminit, Keyboard Manager via kminit, and
Window Manager via wninit. Since the Help Manager uses the List, Keyboard, and
Window Manager packages these must be initialized first. Here is a startup
segment you might want to use:

#include standard include file
#include used in lminit and wninit call
#include list manager include file
#include keyboard manager include file
#include help manager include file

main()
{
int kbhit(),getch(); used in kminit call

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
hminit("C:\\GOODHLP.HLP",0,
0,0,WNBLUE,WNCYAN); init the help manager

kmsir(KF1,hmhelp); help routine will be called when F1 pressed
hmscontext("main_help"); set help context
.
. body of code
.
} end of main

5.5 Include Files

The C include file "hm.h" must be #includ'ed at the top of your application
source file in order to use the List Manager package. This gives you
access to symbolic constants used by the packages as well as letting the

5 - 2
compiler do parameter type checking.

5.6 Function Overview


All Help Manager functions return an error code value. Zero or greater
indicates success. The functions are:

code = hminit(file,loadf,row,col,bc,fc); init help manager
code = hmterm() close help file
code = hmscontext(str) set help context
hmhelp() show, wait for key, then unshow
hmpush(newcontext) push context
hmpop() pop context

5.7 Function Definitions

These List Manager function definitions are presented in alphabetical order,
each starting on a new page, to facilitate your search for information.
Function definitions are comprised of the following sections:

- Summary - function and parameter declarations
- Description - detailed description
- Return Value - explanation of return values
- See Also - related functions
- Example - programming example

A negative return value by any function indicates an error.





























5 - 3
hmgcontext

Summary

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

char *hmgcontext();

Description

The hmgcontext function returns the currently active help label.

Return Value

A character pointer pointing to the current help label will be returned. The
string pointed to will have a length of zero (0) if there is no current help
context.

See Also

hmscontext, hmpush, hmpop
































5 - 4
hmhelp

Summary

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

int hmhelp();

Description

The hmhelp function will display the current help text to the user, wait for ESC
to be pressed, and then remove the help window. Here's what you will see when
hmhelp is called:

ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍ[ help_label ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
º º
º If there are more help lines than will º
º fit on the screen, the message "more" º
º will appear on the left window edge. º
º
M If the help file can't be found the user º
O will get the message: º
R "Sorry, could not open help file." º
E º
If help_label has not been defined in yourº
 file the message: º
"Sorry, help context could not be found" º
º º
º will be displayed. º
º º
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍ**[ Press ESC ]**ÍÍÍÍÍÍÍÍÍÍÍÍͼ

Note that your help labels will be used as titles in the help display window.

Return Value

The hmhelp function is meant to be used as an intercept routine via the Keyboard
Manager kmsir function. A value of -1 will be returned to the calling function.
Since a -1 causes the Keyboard Manager to throw away the intercepted key your
calling routine WILL NOT SEE the key which invoked hmhelp.

See Also

hmscontext, hmpush, hmpop









5 - 5
hmhelp

Example

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

main()
{
int kbhit(),getch(); used in kminit call
int c;

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
hminit("C:\\GOODHLP.HLP",0,
0,0,WNBLUE,WNCYAN); init the help manager

kmsir(KF1,hmhelp); help routine will be called when F1 pressed
hmscontext("main_help"); set help context
.
.
c = kmgetch(); get key from user
. if F1 is pressed, hmhelp will be called
. and the help text for "main_help" will be
. displayed to the user. After the user
. ESCapes from hmhelp the keyboard manager
. will still wait for a key. The F1 key
. WILL NOT be passed thru.

























5 - 6
hminit

Summary

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

#include

int hminit(filepath,loadf,row,col,bc,fc);

char *filepath; help file to open and use
int loadf; load flag (1=open now, 0=when help called)
int row,col; center coords of help window
int bc,fc; colors of help window

Description

The hminit function is used to initialize the help manager package and must be
called prior to any other Help Manager routines and AFTER lminit, kminit, and
wninit. The filename pointed to by filepath must have been created with
HFBILDER.EXE, loadf tells the package whether to load the help file immediately
(loadf == 1) or wait until the first time hmhelp is called (loadf == 0). The
CENTER position of the help window is specified by row and col while the window
background and foreground (text) colors are given by bc and fc.

Return Value

A value of 0 will be returned if all went well. A negative value indicates an
error such as out of memory or file open error. Symbolic error codes can be
found in the include file . Note that if loadf is set to 0 indicating
that you want the help file opened at the first call of hmhelp and filepath does
not exist, you will not get an error from this function, instead, hmhelp will
display an error message to the user when it is called.

See Also

hmhelp, hmterm
















5 - 7
hminit

Example

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

main()
{
int kbhit(),getch(); used in kminit call

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
hminit("C:\\GOODHLP.HLP",0,
0,0,WNBLUE,WNCYAN); init the help manager

kmsir(KF1,hmhelp); help routine will be called when F1 pressed
hmscontext("main_help"); set help context



































5 - 8
hmpop

Summary

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

void hmpop();

Description

The hmpop function will restore the last help context saved by hmpush.

Return Value

This function has no return value. If there is no saved help context, your
request will be ignored.

See Also

hmpush, hmscontext

Example

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

main()
{
int kbhit(),getch(); used in kminit call

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
hminit("C:\\GOODHLP.HLP",0,
0,0,WNBLUE,WNCYAN); init the help manager

kmsir(KF1,hmhelp); help routine will be called when F1 pressed
hmscontext("main_help"); set help context
goodsub(); call a subroutine
.
.
}
goodsub()
{
hmpush("goodsub_help"); set new help context for F1 key
.
. do something
.
hmpop(); restore previous help context
}

5 - 9
hmpush

Summary

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

int hmpush(newcontext);
char *newcontext; new help label

Description

The hmpush function pushes the current help context onto an internal stack and
then sets it to newcontext.

Return Value

A value of 0 will be returned if all went well. A negative value indicates an
error, probably memory allocation.

See Also

hmpop, hmscontext































5 - 10
hmpush

Example

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

main()
{
int kbhit(),getch(); used in kminit call

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
hminit("C:\\GOODHLP.HLP",0,
0,0,WNBLUE,WNCYAN); init the help manager

kmsir(KF1,hmhelp); help routine will be called when F1 pressed
hmscontext("main_help"); set help context
goodsub(); call a subroutine
.
.
}
goodsub()
{
hmpush("goodsub_help"); set new help context for F1 key
.
. do something
.
hmpop(); restore previous help context
}























5 - 11
hmscontext

Summary

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

void hmscontext(label);
char *label; current help context label

Description

The hmscontext function sets the current help context such that all text
following label in the current help file will be displayed to the user when
hmhelp is called. The current context label (if any) will be lost.

Note that label must match a label you have entered in your help text file and
it must contain NO spaces.

Return Value

This function has no return value. If label does not exist in your help file,
hmhelp will notify the user.

See Also

hmpush, hmpop

Example

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

main()
{
int kbhit(),getch(); used in kminit call

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
hminit("C:\\GOODHLP.HLP",0,
0,0,WNBLUE,WNCYAN); init the help manager

kmsir(KF1,hmhelp); help routine will be called when F1 pressed
hmscontext("main_help"); set help context







5 - 12
hmterm

Summary

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

int hmterm();

Description

The hmterm function will close the file opened by hminit and free all memory
used by the Help Manager package. It is NOT neccessary to call hmterm prior to
exiting your application since all open files will be closed by the C runtime
routines, however you must call hmterm if you want to open a different help file
via hminit.

Return Value

A return value of 0 indicates all went well. A negative value means an error
occured, probably a file close error.

See Also

hminit

Example

#include "lm.h"
#include "wn.h"
#include "km.h"
#include "hm.h"

main()
{
int kbhit(),getch(); used in kminit call

lminit(malloc,free,0); init the list manager
kminit(kbhit,getch); init the keyboard manager
wninit(0,0,NULL,0,malloc,free); init the window manager
hminit("C:\\GOODHLP.HLP",0,
0,0,WNBLUE,WNCYAN); init the help manager

kmsir(KF1,hmhelp); help routine will be called when F1 pressed
hmscontext("main_help"); set help context
.
.
kmdir(KF1); disconnect the F1 key
hmterm(); close help file
hminit("C"\\DIFFHELP.HLP",0,
0,0,WNRED,WNYELLOW); set up different help environment



5 - 13
























































5 - 14
6 Menu Manager

6.1 Introduction

The Menu package will allow your applications to create and display menus of
various flavors to a user with a minimum of effort. Features include:

- Colors and titles completely definable
- Multiple pages and best fit handled automatically
- User can "mark/unmark" items
- Arrow key or first letter of item moves cursor

6.2 Module Initialization

There is no module initialization for the Menu Package, however, since this
package does use other modules they must be initialized PRIOR to calling any of
the menu functions.

All of the Menu Package routines receive their input (items to display) from a
list that you supply. The following is a complete program that illustrates the
steps needed to initialize the various modules and build and use a menu.

#include standard include file
#include for the list manager
#include list manager include file
#include keyboard manager include file
#include window manager include file
#include help manager include file
#include menu manager include file

main()
{
int kbhit(), getch(); declare for kminit() function
int wnum, lnum;
int mmaction(); will be called by menu function

lminit(malloc,free,0); init the list manager first
kminit(kbhit,getch); now the keyboard manager
wninit(0,0,NULL,0,malloc,free); do the window manager
hminit("GOODHELP.HLP",0,0,0,
WNBLACK,WNGREEN); init help manager

wnum = wncreate(0,0,80,25,WNBLUE,WNCYAN,
WNBLUE,WNCYAN); create our main window
wnttitle(wnum,"**[Good Title]**"); add a top title
kmsir(KF1,hmhelp); make F1 activate help
hmscontext("help_label1"); set help context
.
.
The above startup code would be used in all or most of your applications.
.
.
The following code is specific to building and using a menu.
.
.

6 - 1
lnum = lmcreate(NULL,0,0); create empty list

lmael(lnum,"Print HELLO",0,0); add items to the list
lmael(lnum,"Print GOODBYE",0,0);
lmael(lnum,"Ring the BELL",0,0);
lmael(lnum,"Exit this program",0,0);

pmmenu(lnum,"**[Menu]**","",0,0, the pmmenu routine will call mmaction
WNBLUE,WNCYAN,WNBLACK,WNCYAN, when the user makes a choice
1,mmaction);

lmdestroy(lnum); destroy the list
wndestroy(wnum); remove your main window (if created)
}

mmaction(code) will be called by pmmenu above
int code;
{
switch(code){
case -1: user pressed ESCAPE while in menu
case 4: user selected Exit option
return(0); will cause menu to exit
break;
case 1: user selected "print hello"
printf("hello");
break;
case 2: user selected "print goodbye"
printf("goodbye");
break;
case 3: user selected "ring the bell"
printf("\007");
break;
}
return(-1); will cause user to stay in menu
}

6.3 Include Files

The C include file "mm.h" must be #includ'ed at the top of your application
source file in order to use the Menu Manager package. This gives you
access to symbolic constants used by the packages as well as letting the
compiler do parameter type checking.

6.4 Function Overview

All Menu Manager functions return an error code value. Zero or greater
indicates success. The functions are:

code = pmmenu(lnum,title,row,col,bc,fc,
hbc,hfc,startpick,actionr) get selection from menu

code = pmmenumu(lnum,ttitle,btitle,row,
col,bc,fc,hbc,hfc,mbc,
mfc,mkey,startpick,
actionr) mark items in a list

6 - 2
code = pmlist(lnum,ttitle,btitle,row,col,
bc,fc,usewin) display a list for browse only

code = mmcolorm(ttitle,btitle,row,col,bc,
fc,defcolor,colortype,
defflag,actionr) color selection menu

6.5 Function Definitions

These List Manager function definitions are presented in alphabetical order,
each starting on a new page, to facilitate your search for information.
Function definitions are comprised of the following sections:

- Summary - function and parameter declarations
- Description - detailed description
- Return Value - explanation of return values
- See Also - related functions
- Example - programming example

A negative return value by any function indicates an error.




































6 - 3
mmcolorm

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"
#include "hm.h"
#include "mm.h"

int mmcolorm(ttitle,btitle,row,col,bc,fc,defcolor,colortype,defflag,actionr);

char *ttitle, *btitle; top and bottom menu titles
int row,col; position of CENTER of menu
int bc,fc; colors to display
int defcolor; default color
int colortype; background or foreground
int defflag; determines if "default" is displayed at bottom
int (*actionr)(); function to call with selection

Description

This popup will make its own list of available colors based on the value of
colortype, if colortype==0 then a list of items (each with a different
background color) will be presented to the user. Each item's foreground color
will be the same (the value of fc) and the starting menu item (one current on
entry) will be the background that matches bc. There are 8 possible background
colors. If bc == -1 then the default item will be the starting pick.

If colortype==1 then each item will have a different foreground color on a
background of bc. There are 16 possible foreground colors.

If defflag==true (1) then an additional item will be put on the bottom of the
list, the string "Default". On a background menu this will be item 8, on a
foreground menu this will be item 16. If colortype==0, meaning you're wanting
a background color returned, the background color of the last item will be
defcolor. The opposite is true if colortype == 1, the foreground color will
be defcolor.

The routine pointed to by actionr will be called when the user hits a key. If
you do not want an action routine called, set actionr to the value
(int (*))NULL.

Return Value

The value passed to the action routine will be in the range 0-7 or 0-15
for defflag==0, 0-8 or 0-16 for defflag==1. If your action routine returnes
a non-negative number, it will be returned by this menu function.

A value of -1 will be passed to the action routine if the user presses ESC. If
your action routine returns this value, the user will stay in the menu. If
there is no action routine, -1 will be returned by this function when ESC is
pressed.


6 - 4
mmcolorm

See Also

pmmenu, pmmenumu, pmlist



















































6 - 5
mmcolorm

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"
#include "hm.h"
#include "mm.h"

main()
{
int kbhit(), getch(); declare for kminit() function
int wnum, lnum;


lminit(malloc,free,0); init the list manager first
kminit(kbhit,getch); now the keyboard manager
wninit(0,0,NULL,0,malloc,free); do the window manager
hminit("GOODHELP.HLP",0,0,0,
WNBLACK,WNGREEN); init help manager

wnum = wncreate(0,0,80,25,WNBLUE,WNCYAN,
WNBLUE,WNCYAN); create our main window
wnttitle(wnum,"**[Good Title]**"); add a top title
kmsir(KF1,hmhelp); make F1 activate help
hmscontext("help_label1"); set help context
.
.
mmcolorm("[Pick a Foreground Color","",0,0,
WNBLACK,WNRED,WNCYAN,1,1,(int (*)()) );

/*

The above mmcolorm call will cause a menu with 17 items to be displayed.
The first item will be "Black", item 16 will be "White", and item 17 will
be the word "Default".

Since the colorflag is set true (1) we are asking for a foreground color.

The background color for each item will be Black (bc == WNBLACK).

The menu item that will be active on entry to the menu will be Red on Black
(fc = WNRED).

The last menu item, "Default", will be displayed as Cyan on Black (Defcolor =
WNCYAN).

There will be no action routine called.

*/

wndestroy(wnum); remove the window
}

6 - 6
pmlist

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"
#include "hm.h"
#include "mm.h"

int pmlist(lnum,ttitle,btitle,row,col,bc,fc,usewin);

int lnum; list of items to display
char *ttitle,*btitle; top and bottom titles
int row,col; center location of display window
int bc,fc; display colors
int usewin; window number to use

Description

The pmlist function is used to display a list of items lnum, to a user, scroll
thru them via PgUp and PgDn, and leave the list by pressing ESC. The user does
not have the option of marking or selecting an item. The sole purpose of pmlist
is to display a list of items.

Optional titles can be displayed on the menu both top and bottom by supplying
null terminated title strings ttitle and btitle. Make the strings zero length
if you do not desire a title.

Positioning of the menu is somewhat controlled by you by supplying values for
row and col defining where you want the CENTER of the menu to be placed. The
ultimate size and location of the menu will be determined by the length of the
longest menu item and number of selections. A value of 0 supplied for row
and/or col will center the menu on the screen in the respective orientation.

The color of the menu including border, titles, and list items are controlled by
the background/foreground values bc and fc.

The value of usewin that you supply can cause the pmlist function to operate in
1 of 3 modes:

(usewin < 0) - The pmlist function will create a window, display the items,
allow the user to scroll between screens, and wait for ESC. After the user
presses ESC the window will be destroyed.

(usewin = 0) - A window will be created and items will be displayed but, the
function will return immediately without letting the user interact. The return
value will be the window number that was created. Note that because this
function returns immediately it is only possible to show 1 page of items.

(usewin > 0) - The pmlist function will assume that usewin is an existing
window that was created by previously calling it with a value (usewin = 0).
It acts just like (usewin = 0) except for the fact the window creation will
not be done.

6 - 7
pmlist

Return Value

If the parameter usewin is less than 0 the return value will be 0 if all went we l.
If usewin was >= 0, the return value will be the same as usewin if all went
well. A negative return value indicates an error.

See Also

pmmenu, pmmenumu













































6 - 8
pmlist

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"
#include "hm.h"
#include "mm.h"

main()
{
int kbhit(), getch(); declare for kminit() function
int wnum, mnum, lnum;

lminit(malloc,free,0); init the list manager first
kminit(kbhit,getch); now the keyboard manager
wninit(0,0,NULL,0,malloc,free); do the window manager
hminit("GOODHELP.HLP",0,0,0,
WNBLACK,WNGREEN); init help manager

wnum = wncreate(0,0,80,25,WNBLUE,WNCYAN,
WNBLUE,WNCYAN); create our main window
wnttitle(wnum,"**[Good Title]**"); add a top title
kmsir(KF1,hmhelp); make F1 activate help
hmscontext("help_label1"); set help context
.
.
The above startup code would be used in all or most of your applications.
.
.
The following code is specific to building and using a menu.
.
.
lnum = lmcreate(NULL,0,0); create empty list

lmael(lnum,"Gooditem1",0,0); add items to the list
lmael(lnum,"Gooditem2",0,0);
lmael(lnum,"Gooditem3",0,0);
lmael(lnum," ",0,0); leave 2 empty slots for adding
lmael(lnum," ",0,0); items later

mnum = pmlist(lnum,"**[List]**","",0,0,
WNBLUE,WNCYAN,0); create window, show list and return

strcpy(lmgel(lnum,lmglastel(lnum)),"Lastitem5");

mnum = pmlist(lnum,"**[List]**","",0,0,
WNBLUE,WNCYAN,mnum); re-display list with new item added

lmdestroy(lnum); destroy the list
wndestroy(mnum); remove list window
wndestroy(wnum); remove the main window
}

6 - 9
pmmenu

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"
#include "hm.h"
#include "mm.h"

int pmmenu(lnum,ttitle,btitle,row,col,bc,fc,hbc,hfc,startpick,actionr);

int lnum; list of menu items
char *ttitle,*btitle; top and bottom menu titles
int row,col; CENTER menu location
int bc,fc; normal menu text colors
int hbc,hfc; highlighted item color
int startpick; item to be highlighted on entry
int (*actionr)(); function to call with selection

Description

The pmmenu function is used to display a list of items, lnum, to the user, allow
him/her to scroll thru the items until a selection or ESC is pressed, and
finally, call the routine pointed to by actionr. If you do not want an action
routine called, set actionr to the value (int (*))NULL.

Optional titles can be displayed on the menu both top and bottom by supplying
null terminated title strings ttitle and btitle. Make the strings zero length
if you do not desire a title.

Positioning of the menu is somewhat controlled by you by supplying values for
row and col defining where you want the CENTER of the menu to be placed. The
ultimate size and location of the menu will be determined by the length of the
longest menu item and number of selections. A value of 0 supplied for row
and/or col will center the menu on the screen in the respective orientation.

The color of the menu including border, titles, and non-highlighted item are
controlled by the background/foreground values bc and fc. As the user scrolls
thru the menu he/she is reminded of the current item both by a "->" along side
of the current selection as well as color highlighting. The highlight color to
use is supplied by hbc and hfc.

The item highlighted on entry to pmmenu is specified by startpick.

When the user makes a selection or presses ESC, the action routine pointed to by
actionr will be called using the following synopsis:

int (*actionr)(code,list);

int (*actionr)();
int code; selection user made
int lnum; lnum passed to pmmenu


6 - 10
pmmenu

A value of -1 will be passed to the action routine if the user pressed ESC while
in the menu, otherwise the selected item (1 - n) will be passed for code.

The parameter lnum passed to your action routine is the list number which
contains the selections the menu function is displaying. Your action routine
may look at this list but should not alter it by deleting or changing items in
it.

Return Value

The return value from your supplied action routine will be the value returned by
pmmenu. If there is no action routine, the value returned will be what would
have been passed to actionr via code. If actionr returns a value of -1, the
user will stayed locked inside of the menu.

See Also

pmmenumu, pmlist




































6 - 11
pmmenu

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"
#include "hm.h"
#include "mm.h"

main()
{
int kbhit(), getch(); declare for kminit() function
int wnum, lnum;
int mmaction(); will be called by menu function

lminit(malloc,free,0); init the list manager first
kminit(kbhit,getch); now the keyboard manager
wninit(0,0,NULL,0,malloc,free); do the window manager
hminit("GOODHELP.HLP",0,0,0,
WNBLACK,WNGREEN); init help manager

wnum = wncreate(0,0,80,25,WNBLUE,WNCYAN,
WNBLUE,WNCYAN); create our main window
wnttitle(wnum,"**[Good Title]**"); add a top title
kmsir(KF1,hmhelp); make F1 activate help
hmscontext("help_label1"); set help context
.
.
The above startup code would be used in all or most of your applications.
.
.
The following code is specific to building and using a menu.
.
.
lnum = lmcreate(NULL,0,0); create empty list

lmael(lnum,"Print HELLO",0,0); add items to the list
lmael(lnum,"Print GOODBYE",0,0);
lmael(lnum,"Ring the BELL",0,0);
lmael(lnum,"Exit this program",0,0);

pmmenu(lnum,"**[Menu]**","",0,0, the pmmmenu routine will call mmaction
WNBLUE,WNCYAN,WNBLACK,WNCYAN, when the user makes a choice
1,mmaction);

lmdestroy(lnum); destroy the list of menu items
wndestroy(wnum); remove the window
}

mmaction(code) will be called by pmmenu above
int code;
{
switch(code){

6 - 12
pmmenu

case -1: user pressed ESCAPE while in menu
case 4: user selected Exit option
return(0); will cause menu to exit
break;
case 1: user selected "print hello"
printf("hello");
break;
case 2: user selected "print goodbye"
printf("goodbye");
break;
case 3: user selected "ring the bell"
printf("\007");
break;
}
return(-1); will cause user to stay in menu
}






































6 - 13
pmmenumu

Summary

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"
#include "hm.h"
#include "mm.h"

#include

int pmmenumu(lnum,ttitle,btitle,row,col,bc,fc,hbc,hfc,mbc,mfc,
mkey,startpick,actionr);

int lnum; list of menu items
char *ttitle,*btitle; top and bottom menu titles
int row,col; CENTER menu location
int bc,fc; normal menu text colors
int hbc,hfc; highlighted item color
int mbc,mfc; "marked" item color
int mkey; keycode which marks/unmarks item
int startpick; item to be highlighted on entry
int (*actionr)(); function to call with selection

Description

The pmmenumu function is used to display a list of items, lnum, to the user,
allow him/her to scroll thru the items until a selection or ESC is pressed, and
finally, call the routine pointed to by actionr. If you do not want an action
routine called, set actionr to the value (int (*))NULL.

While in the menu, the user can "mark" and "unmark" items using the key mkey.
When a user marks an item it will have an "*" placed at the left margin and its
color will be changed to mbc and mfc. If items in list lnum are already marked
when pmmenumu is called, they will be displayed as being marked. How this
"mark/unmark" status is used is up to you, it serves no purpose to the menu
function.

Optional titles can be displayed on the menu both top and bottom by supplying
null terminated title strings ttitle and btitle. Make the strings zero length
if you do not desire a title.

Positioning of the menu is somewhat controlled by you by supplying values for
row and col defining where you want the CENTER of the menu to be placed. The
ultimate size and location of the menu will be determined by the length of the
longest menu item and number of selections. A value of 0 supplied for row
and/or col will center the menu on the screen in the respective orientation.

The color of the menu including border, titles, and non-highlighted item are
controlled by the background/foreground values bc and fc. As the user scrolls
thru the menu he/she is reminded of the current item both by a "->" along side
of the current selection as well as color highlighting. The highlight color to
use is supplied by hbc and hfc.

6 - 14
pmmenumu

The item highlighted on entry to pmmenumu is specified by startpick.

When the user makes a selection or presses ESC, the action routine pointed to by
actionr will be called using the following synopsis:

int (*actionr)(code,list);

int (*actionr)();
int code; selection user made
int list; lnum that was passed to pmmenumu

A value of -1 will be passed to the action routine if the user pressed ESC while
in the menu, otherwise the selected item (1 - n) will be passed for code.

The parameter lnum passed to your action routine is the list number which
contains the selections the menu function is displaying. Your action routine
may look at this list but should not alter it by deleting or changing items in
it.

Return Value

The return value from your supplied action routine will be the value returned by
pmmenumu. If there is no action routine, the value returned will be what would
have been passed to actionr via code. If actionr returns a value of -1, the
user will stayed locked inside of the menu.

See Also

pmmenu, pmlist, wnsnmatt, wnshmatt, lmelstat

























6 - 15
pmmenumu

Example

#include "malloc.h"
#include "lm.h"
#include "km.h"
#include "wn.h"
#include "hm.h"
#include "mm.h"

main()
{
int kbhit(), getch(); declare for kminit() function
int wnum, lnum;
int mmaction(); will be called by menu function

lminit(malloc,free,0); init the list manager first
kminit(kbhit,getch); now the keyboard manager
wninit(0,0,NULL,0,malloc,free); do the window manager
hminit("GOODHELP.HLP",0,0,0,
WNBLACK,WNGREEN); init help manager

wnum = wncreate(0,0,80,25,WNBLUE,WNCYAN,
WNBLUE,WNCYAN); create our main window
wnttitle(wnum,"**[Good Title]**"); add a top title
kmsir(KF1,hmhelp); make F1 activate help
hmscontext("help_label1"); set help context
.
.
The above startup code would be used in all or most of your applications.
.
.
The following code is specific to building and using a menu.
.
.
lnum = lmcreate(NULL,0,0); create empty list

lmael(lnum,"Print HELLO",0,0); add items to the list
lmael(lnum,"Print GOODBYE",0,0);
lmael(lnum,"Ring the BELL",0,0);
lmael(lnum,"Exit this program",0,0);

pmmenumu(lnum,"**[Menu]**","",0,0, the pmmmenumu routine will call mmaction
WNBLUE,WNCYAN,WNBLACK,WNCYAN, when the user makes a choice
WNBLACK,WNYELLOW,KF10,1, Function key 10 is the mark/unmark key
mmaction);

lmdestroy(lnum); destroy the list of menu items
wndestroy(wnum); remove the window
}

mmaction(code) will be called by pmmenumu above
int code;
{

6 - 16
pmmenumu

switch(code){
case -1: user pressed ESCAPE while in menu
case 4: user selected Exit option
return(0); will cause menu to exit
break;
case 1: user selected "print hello"
printf("hello");
break;
case 2: user selected "print goodbye"
printf("goodbye");
break;
case 3: user selected "ring the bell"
printf("\007");
break;
}
return(-1); will cause user to stay in menu
}





































6 - 17
























































6 - 18
7 Forms Manager

7.1 Introduction

The Forms Manager is a collection of library routines which allow you to
create, modify, and delete screen oriented data entry forms. Through use of
the Forms Library you can eliminate 99% of the boring, tedious coding
neccessary for validating user input to make sure bad data does not get into
your application. In most instances the validation routines supplied by this
package will be enough to insure 100% checking. In those cases where you have
a special circumstance there is an easy mechanism for inserting your own
validation routine. Here are a few key features:

- Completely definable screen attributes.
- Number of fields/prompts limited only by available memory.
- Validation for all "C" data types. Adding more is a snap!
- Built in functions allow "special" field navigations.
- Fields can be on 1 of 32000 "levels" for hiding/unhiding.
- Extended attributes of any type can be attached to a field for
special processing such as context sensitive help.

7.2 Components

The Forms Processing library is comprised of 4 logical sections:

7.2.1 Kernel

The kernel is a collection of routines which in itself can be broken down into
more or less the following sections:

a. Field editing.
b. Field navigation if processing multiple field on a screen.
c. Routines for getting and changing field/screen characteristics.
d. "Glue" for all of the other routines.

Generally speaking, anything that can't be categorized anywhere else gets
thrown into the kernel.

7.2.2 Special Functions

As will be explained later, you can specify a special function to be called
each time a user enters a keystroke in a field. Depending on what the user
pressed you might want to give online help, a directory entry menu, or
whatever your application calls for.

7.2.3 Character Validation

Each time the user enters a keystroke it will go thru 1 or more character
validation functions. This is so (s)he knows right away they have entered a
character which is illegal for the type of data they're entering.

7.2.4 Field Validation and Display

After the user has entered a field full of digits and hit return it's time
to validate the whole thing. This is the point to find numbers out of range,

7 - 1
a duplicate file key, or 2 decimal points in a floating point number. This is
also the place for the Validation/Display routine to tidy up the field just
entered such as rounding a floating pointer number or justifying text.





















































7 - 2
0. Field Initialization
*
* Yes
1. Abort or Done Flag Set? *****************>**
* *
***<*****************<** *
* * *
2. Get Input Character * *
* * *
3. Special Function * *
* ^ *
* Yes * *
4. Reject Flag Set? *******>** *
* ^ *
* Yes * *
5. Abort or Done Flag Set? *****************>**
* * *
6. Character Validation * *
* ^ *
* Yes * *
7. Reject Flag Set? *******>** *
* ^ *
* Yes * *
8. Abort or Done Flag Set? *****************>**
* ^ *
9. Build Buffer * *
* * *
10. Field Validation * *
* ^ *
* Yes * *
11. Reject Flag Set? *******>** *
* *
* Yes *
12. Abort or Done Flag Set? *****************>**
* *
13. Display Character 14. Special Function (Cleanup)
* *
Goto Step # 2 15. Field Display (Cleanup)
*
16. All Done

Figure FP1. Actions and Decisions for Inputting a Field














7 - 3
7.3 Theory of Operation

Referring to Fig. FP1, the following actions and decisions make up the process
of inputting a field of data from a user:

0. Field Initialization

This step involves blanking the field input area, displaying default data if
present, and finally, highlighting the field area so the user knows where
his/her attention should be focused. The initial display of a field's data is
handle by a field init routine you specify when creating the field.

1. Abort or Done Flag Set?

In some instances you might want to do some fancy data entry tricks like
putting up a menu when a user moves into a certain field via the arrow keys.
If that were the case for step 0. then it would be possible that the user made
a menu choice or decided to abort, which would make further entry unneccessary.

2. Get Input Character

The standard Keyboard Manager library routine KMGETCH() is called to obtain a
keycode from the user. By using certain Keyboard Manager functions it's
possible for you to have input coming from a file, mouse, keyboard, or any
input source specialized to your application. The keycode input at this
point is passed to the remaining validation/display functions in the figure.

3. Special Function

In addition to validation routines you can specify that a field have a special
function routine called each time the user enters a keystroke. This routine
could do something useful like monitor the in-coming keycode for the F1 key
which would mean give online help.

4. Reject Flag Set?

Using our example for item 3, if the user did press the F1 key and your special
function routine did give online help, it would then need to tell the Forms
Manager to ignore the character that just came in, this is done by a call to
the function fpsfbadchar().

5. Abort or Done Flag Set?

See item # 1.

6. Character Validation

When defining a field you will want to pick a character validation routine
which only allows those characters neccessary for the data you want entered.
If the data being entered has to be a positive integer then the character
validation routine to pick will be one that allows digits 0-9 and a plus sign.
All other characters will cause the validation routine to set the reject flag
via fpsfbadchar(). At this point you could also cause a beep to be sent to the
user by calling fpsfbeep().


7 - 4
7. Reject Flag Set?

See item # 4

8. Abort or Done Flag Set?

See item # 1

9. Build Buffer

In order to make life easier on the field validation routines the Forms Manager
kernel builds a character buffer which will be passed to the validation
routines. The contents of this buffer will be what the field data WOULD look
like if the current input keycode were added to the field given the current
state of the insert/overstrike mode.

10. Field Validation

All of the supplied field validation routines wait for the incoming keycode to
be a carriage return before checking the contents of the field buffer. Like the
other validation routines, if something is not right with the data just set the
reject flag via fpsfbadchar() and the user will be put back in edit mode.

11. Reject Flag Set?

See item # 4

12. Abort or Done Flag Set?

See item # 1

13. Display Character

After the input character has passed all validation functions a nice thing to
do would be to show it to the user. For flexibility there are a handful of
functions which any validation routine in the pipeline can call which will
change such things as where the character is placed, what is placed, or if a
character is echoed at all. An example of echoing something other that what
was input is password validation while changing the position of character
output might be neccessary when doing picture or template validation.

14. Special Function (Cleanup)

After the field has been entered or aborted the special function routine used
in step # 3 will be called again, only this time a flag will be set indicating
the field is done and any cleanup such as taking down a help box should be done
now.

15. Field Display (Cleanup)

The same validation routine used in step 10 will be called again here. A flag
will be set telling the validation routine to display data in the field buffer,
not do any validation.

16. All Done

7 - 5
At this point the data entered by the user will be sitting in the variable you
designated when the field was defined. If you didn't designate a variable you
can get the data by calling fpgfdata().


Now, the above 16 steps were used to input ONE field and of course there is a
routine for inputting a screenful of fields. By using kernel functions you
have total control in how fields are navigated as well as which ones are
displayed or processed at all.

7.4 Symbolic Constants

Symbolic constants such as error codes are used extensively in the Forms
Manager package and are defined in the include file . This file should
be #include'd at the top of your application source code.

7.5 Module Initialization

Before any fields can be processed you must call the following functions in
this order; lminit(), kminit(), wninit(), fpinit().

If you are supplying online help in your application then the additional
function hminit() must be called.

Here is a code stub which will define a 2 field input form, display data to
the user, input new data, and finally, take down the screen:

#include "lm.h"
#include "km.h"
#include "wn.h"
#include "fp.h"

int kbhit(), getch(); /* for the kminit() call */
int scnum,fnum1,fnum2,row,col,width,height;
int bc,bc,bbc,bfc,mrow;
float myprice;
char ttitle[81], btitle[81];

lminit(malloc,free,0); /* list manager. Must be first */
wninit(0,0,NULL,0,malloc,free); /* window manager. */
kminit(kbhit,getch); /* keyboard manager */
hminit("good.hlp",0,0,0,hcolors); /* help manager (optional) */
fpinit(); /* forms manager */

scnum = fpcreatescr(5,5,70,10, /* top left at 5,5 70 wide, 10 high */
WNBLUE,WNRED, /* blue background, red text */
WNBLUE,WNCYAN, /* cyan border on blue */
8, /* message row at bottom of screen */
"[ Top ]",""); /* top title, no bottom. */

/* add a prompt field in new screen */

fnum1 = fpafld(scnum,FPOUTPUT,"", /* unnamed prompt field */
1,1,1, /* at upper left corner of scnum */
-1,-1,-1,-1, /* colors, use screen defaults */

7 - 6
0,0,0,0,0L, /* no routines needed, output field */
"Price: ", /* data for this field */
0, /* non-local, string is global */
0, /* order not important, output field */
0,FPCHAR,0,0); /* let function compute size */

myprice = 19.95; /* default data */
fnum2 = fpafld(scnum,FPINPUT,"goodfld", /* named input field */
1,8,1, /* to the right of the prompt */
-1,-1, /* default normal colors */
WNBLACK,WNYELLOW, /* yellow on black for data entry */
FIDEF,SFDEF, /* default init routine */
CVFPDIGIT, /* allow digits 0-9 and dec point */
FVFLOATGEZ, /* float validation >= 0.0 */
0L, /* no attributes */
&myprice,1,1,0, /* copy data local to field */
FPFLOAT,0,2); /* 2 decimal places */

fpproscr(scnum,FPDON,INULL); /* display output fields norm colors */
fpproscr(scnum,FPDDN,INULL); /* display input default data */
fpproscr(scnum,FPPROCESS,INULL); /* get field from user */
fpproscr(scnum,FPDESTROY,INULL); /* take down screen */

7.6 Function Overview

All Forms Manager functions return an error code value. Zero or greater
indicates success. The functions are:

** Initialization, creation, and modification of data entry screens/fields. **

code = fpinit() init field processing package
scnum = fpcreatescr(row,col,width,height,
bc,fc,bbc,bfc,mrow,
ttitle,btitle) create empty screen of fields
code = fpdestroyscr(scnum) destroy field list
code = fpmsg(scnum,bc,fc,str) put string at screen's mrow
str=NULL will take down any prompt
fnum = fpafld(scnum,type,name,
row,col,level,
bc,fc,hbc,hfc,
fi,sf,cv,fv,ab,dptr,
locf,order,size,dtype,
dsize,precision) add a field to field list scnum
code = fpsscrparms(scnum,row,col,
width,height,bc,fc,
bbc,bfc,mrow,
ttitle,btitle); change parms of existing screen
code = fpgscrparms(scnum,&row,&col,
&width,&height,&bc,&fc,
&bbc,&bfc,&mrow,
&ttitle,&btitle); get parms of existing screen
code = fpdfld(scnum,fnum) delete field num from field list

** Individual get screen info routine **


7 - 7
num = fpgnumflds(scnum) return number of fields in list
wnum = fpgswnum(scnum) return window number of screen if up
num = fpgfldfirst(scnum) get first field in field list (screen)
num = fpgfldnext(scnum) get next field in field list (screen)
num = fpgfldprev(scnum) get prev field in field list (screen)
num = fpgfldlast(scnum) get last field in field list (screen)
lo = fpgslevello(scnum) get lowest level that can be processed
hi = fpgslevelhi(scnum) get highest level that can be processed

** Individual set screen info routines **

code = fpsslevello(scnum,lo) set lowest level that can be processed
code = fpsslevelhi(scnum,hi) set highest level
code = fpssorder(scnum,order) set screen field processing order

** Get field info into structure defined in fp.h **

code = fpgfinfo(scnum,fnum,fparms) get total field info into structure
fnum = fpgfnum(scnum,nptr) get num if field name known

** Set field info from structure defined in fp.h **

code = fpsfinfo(scnum,fnum,fparms) set total field info from structure

** Functions for obtaining pointer to data area of a field **

dptr = fpgfdata(scnum,fnum) get pointer to field data area

** Get field validation info **

finum = fpgffifirst(scnum,fnum) get first field init routine number
finum = fpgffinext(scnum,fnum) get next field init routine number
sfnum = fpgfsffirst(scnum,fnum) get first field special function
sfnum = fpgfsfnext(scnum,fnum) get next field special function
cvnum = fpgfcvfirst(scnum,fnum) get first char validation routine
cvnum = fpgfcvnext(scnum,fnum) get next char validation routine
fvnum = fpgffvfirst(scnum,fnum) get first field validation routine
fvnum = fpgffvnext(scnum,fnum) get next field validation routine

** Set field validation info **

code = fpsfafi(scnum,fnum,finum) add field init routine
code = fpsfdfi(scnum,fnum,finum) delete a field init routine
code = fpsfasf(scnum,fnum,sfnum) add special function routine
code = fpsfdsf(scnum,fnum,sfnum) delete a special function routine
code = fpsfacv(scnum,fnum,cvnum) add character validation routine
code = fpsfdcv(scnum,fnum,cvnum) delete a character validation routine
code = fpsfafv(scnum,fnum,fvnum) add field validation routine
code = fpsfdfv(scnum,fnum,fvnum) delete a field validation routine

** Get extended attribute info **

ftype = fpgxafilter(scnum,fnum) get xa filter number
xanum = fpgfxafirst(scnum,fnum) get number of first extended att
xanum = fpgfxanext(scnum,fnum) get number of next extended att

7 - 8
xatype= fpgfxatype(scnum,fnum,xanum) get type of extended attribute xanum
size = fpgfxasize(scnum,fnum,xanum) get size of extended attribute xanum
xaptr = fpgfxaptr(scnum,fnum,xanum) get ptr to extended attribute data

** Set extended attribute info **

code = fpsxafilter(scnum,fnum,type) set xa filter for first & next calls
xanum = fpsfaxa(scnum,fnum,xatype,
xaptr,len,locf) attach extended attribute to field
code = fpsfdxa(scnum,fnum,xanum) delete an extended attribute of field

** Field processing routines **

code = fpsetfirstfld(scnum,fnum) set first field to be processed
code = fpprofld(scnum,func,wnum,fnum) perform function on field in window
code = fpproscr(scnum,func,fnextr) perform function on all fields in screen

Func values:

FPDBN /* display blank field normal */
FPDBH /* display blank field highlighted */
FPDDN /* display data for field normal */
FPDDH /* display data for field highlighted */
FPBFWD /* blank fill data area w/display normal */
FPBFWOD /* blank fill data area wo/display */
FPUFWD /* fill data DISPLAY area with '_' and show */
FPBP /* blank pad data area */
FPBTRM /* blank trim data area */
FPCF /* clear field from window */
FPNF /* color field using normal field colors */
FPHF /* color field using hightlight field colors*/
FPDON /* display output only field normal */
FPDOH /* display output only field highlighted */
FPINITWD /* init fields to default according to type */
FPINITWOD /* same as above but no display */
FPDESTROY /* wipe screen and all fields on it */
FPPROCESS /* process field(s) from user */

** Routines for use by validation or special function routines **

lcode = fpgpcode() get last code obtained by fpproscr()
icode = fpgicode() get current input code
crow = fpgccrow() get current cursor row
ccol = fpgcccol() get current cursor col
cdrow = fpgcdrow() get current row for character display
cdcol = fpgcdcol() get current col for character display
disc = fpgdischar() get display char for current field
data = fpgdatachar() get data char for current field
flag = fpgcchanged() get cursor changed flag

code = fpsnextfld(fnum) set next field for processing
code = fpsicode(icode) set current input code
code = fpsccrow(row) set current cursor row
code = fpscccol(col) set current cursor col
code = fpscdrow(drow) set current row for character display

7 - 9
code = fpscdcol(dcol) set current col for character display
code = fpsdischar(dischar) set display char for current field
code = fpsdatachar(datachar) set data char for current field
code = fpsfabort() set abort flag for field processing
code = fpsfbeep() set beep flag for current input
code = fpsfbadchar() set bad char flag
code = fpsfnodis() set no display char flag
code = fpsfnodata() set no data flag
code = fpsfdchanged() set data changed flag
code = fpsfcchanged() set cursor changed flag
code = fpsfdone() set field done flag
code = fpleavecode(inputcode) true if inputcode is exit key

7.7 Function Definitions


Available with purchase of Forms Manager library.







































7 - 10

11-26 integer greater than or equal to 0 field validation
11-27 integer less than 0 field validation
11-28 integer less than or equal to 0 field validation
11-5 long integer greater than 0 field validation
11-6 integer greater than or equal to 0 field validation long
11-7 long integer less than 0 field validation
11-8 long integer less than or equal to 0 field validation
11-30 unsigned integer greater than 0 field validation
11-31 integer greater than or equal to 0 field validation unsigned
11-33 unsigned long integer greater than 0 field validation
11-34 integer greater than or equal to 0 field validation unsigned long
10-3 digits 0-9 character validation
10-6 digits 0-9, +, and - character validation
11-15 double floating point greater than 0.0 field validation
11-16 point greater than or equal to 0.0 field validation double floating
11-17 double floating point less than 0.0 field validation
11-18 point less than or equal to 0.0 field validation double floating
11-10 float greater than 0.0 field validation routine
11-11 float greater than or equal to 0.0 field validation routine
11-12 float less than 0.0 field validation routine
11-13 float less than or equal to 0.0 field validation routine
7-95 setting the field abort flag
7-15 adding a field to a screen
2-4 adding an element to an existing list
7-110 field adding an extended attribute to a
7-101 adding validation routines to a field
7-104 adding validation routines to a field
7-107 adding validation routines to a field
7-98 adding validation routines to a field
10-9 alpha and space character validation
10-4 alpha character validation
10-10 validation alphanumeric and space character
10-5 alphanumeric character validation
11-14 validation any double floating point field
11-9 any float field validation routine
11-24 any integer field validation
11-4 any long integer field validation
11-29 any unsigned integer field validation
11-32 validation any unsigned long integer field
4-40 test if coordinates are in a window
2-12 a pointer to a list element's data area getting
2-14 to existing list header data area obtaining pointer
7-31 obtaining pointer to field data area
2-25 resizing a list element's data area
7-92 to be put in a field's data area. translating the character
4-8 setting a title at the bottom of a window
4-50 setting a title at the left side of a window
4-69 setting a title at the right side of a window
4-89 setting a title at the top of a window
7-120 deleting an extended attribute
7-139 setting an extended attribute filter value
7-74 setting an extended attribute filter value
7-53 obtaining extended attribute information
7-56 obtaining extended attribute information
7-59 obtaining extended attribute information
7-47 obtaining an extended attribute number
7-50 obtaining an extended attribute number
7-110 adding an extended attribute to a field
4-75 setting highlight color attribute to use if in mono mode
4-77 setting highlight color attribute to use if in mono mode
4-19 obtaining highlight color attribute used if in mono mode
4-20 obtaining normal color attribute used if in mono mode
3-25 testing for available keycode
4-22 obtain window background color
4-21 obtain window border background color
4-33 obtain window titles background color
3-10 delete registered background routine
3-17 get pointer to registered background routine
3-36 resuming the background routine
3-57 suspending the background routine
3-44 waiting for key input register background routine to run while
4-6 backspacing in a window
7-112 ignoring a bad input character
7-114 ignoring a bad input character
7-125 setting the next field to be processed in a validation routine
7-92 translating the character to be put in a field's data area.
4-9 clearing a window with blanks
4-21 obtain window border background color
4-81 setting a window's border colors
4-79 setting a window's border drawing character set
4-23 obtain border drawing characters for window
4-24 obtain window border foreground color
4-8 setting a title at the bottom of a window
7-130 obtaining and setting level boundries
7-133 obtaining and setting level boundries
7-67 obtaining and setting level boundries
7-70 obtaining and setting level boundries
3-18 code btaining the current filter escape
6-17 a pop-up menu with mark/unmark capability displaying
7-23 obtaining cursor change status
7-127 changing existing screen parameters
7-116 changing the field cursor position
7-87 changing the field cursor position
7-89 changing the field cursor position
4-76 changing the size of a window
4-16 filling a window with a character
7-112 ignoring a bad input character
7-114 ignoring a bad input character
7-27 obtaining field display and data character
7-28 obtaining field display and data character
4-45 setting highlight character colors in a window
4-64 setting highlight character colors in a window
4-47 setting normal character colors in a window
4-66 setting normal character colors in a window
7-90 setting the character display position
7-91 setting the character display position
7-25 processing a screeobtaining current character display position while
7-26 processing a screeobtaining current character display position while
7-93 setting character echoed to the user
4-17 obtaining a character from an existing window
4-38 inserting a character in a window
4-43 locate and print a character in a window
4-52 moving a character in a window
4-62 printing a character in a window
10-12 character list validation
4-79 setting a window's border drawing character set
7-92 area. translating the character to be put in a field's data
10-4 alpha character validation
10-9 alpha and space character validation
10-10 alphanumeric and space character validation
10-2 default character validation
10-3 digits 0-9 character validation
10-6 digits 0-9, +, and - character validation
10-7 floating point character validation
10-8 signed floating point character validation
10-5 alphanumeric character validation
4-23 obtain border drawing characters for window
11-46 double float range checking
11-44 float range checking
11-36 integer range checking
11-38 long integer range checking
11-40 unsigned integer range checking
11-42 unsigned long integer range checking
6-6 display color choice menu
4-9 clearing a window with blanks
3-7 close keyboard manager input file
3-8 close keyboard manager output file
5-13 closing an open help file
3-18 btaining the current filter escape code
3-45 setting the current filter escape code
7-124 translating the user input code while processing a field
4-22 obtain window background color
4-21 obtain window border background color
4-24 obtain window border foreground color
4-29 obtain window foreground color
4-33 obtain window titles background color
4-34 obtain window titles foreground color
4-75 mode setting highlight color attribute to use if in mono
4-77 mode setting highlight color attribute to use if in mono
4-19 obtaining highlight color attribute used if in mono mode
4-20 obtaining normal color attribute used if in mono mode
6-6 display color choice menu
4-81 setting a window's border colors
4-84 setting a window's text colors
4-87 setting a window's titles colors
4-45 setting highlight character colors in a window
4-64 setting highlight character colors in a window
4-47 setting normal character colors in a window
4-66 setting normal character colors in a window
4-27 obtain window column location
4-25 obtain cursor column position in window
5-6 displaying help context
5-4 get a pointer to current help context
3-31 restoring a saved keyboard manager context
5-9 restoring saved help context
5-11 saving current help context
3-34 the current keyboard manager context saving
5-12 setting the current help context
4-91 window coordinates to screen coordinates translate
4-40 test if coordinates are in a window
4-91 translate window coordinates to screen coordinates
7-17 creating a new field screen
4-11 creating a window
2-6 header information creating an empty list with optional
4-18 obtaining default window creation parameters
4-72 setting default creation parameters for new windows
4-26 obtain curren cursor mode in window
7-25 while processing a screen obtaining current character display position
7-26 while processing a screen obtaining current character display position
7-22 processing a screen obtaining current cursor position while
7-24 processing a screen obtaining current cursor position while
3-18 btaining the current filter escape code
3-45 setting the current filter escape code
5-4 get a pointer to current help context
5-11 saving current help context
5-12 setting the current help context
7-60 obtaining current insert/overstrike mode
3-34 saving the current keyboard manager context
7-23 obtaining cursor change status
4-25 obtain cursor column position in window
4-41 locate cursor in a window
4-26 obtain curren cursor mode in window
7-116 changing the field cursor position
7-87 changing the field cursor position
7-89 changing the field cursor position
7-22 screen obtaining current cursor position while processing a
7-24 screen obtaining current cursor position while processing a
4-28 obtain cursor row position in window
4-82 setting a window's cursor style
2-12 a pointer to a list element's data area getting
2-14 pointer to existing list header data area obtaining
7-31 obtaining pointer to field data area
2-25 resizing a list element's data area
7-92 character to be put in a field's data area. translating the
7-27 obtaining field display and data character
7-28 obtaining field display and data character
11-22 month/day date validation
11-23 month/day/year date validation
3-13 de-register a user input routine
3-15 de-register a user output routine
3-12 de-register an intercept routine
10-2 default character validation
4-72 windows setting default creation parameters for new
8-4 default field init routine
11-3 default field validation
9-3 default special function routine.
4-18 obtaining default window creation parameters
3-10 delete registered background routine
7-21 deleting a field
4-15 deleting a line in a window
2-7 list deleting an element from an existing
7-120 deleting an extended attribute
4-12 deleting to end of line in a window
4-13 deleting to end of window
7-19 destroying a screen
4-14 destroying a window
2-8 destroying an existing list
10-3 digits 0-9 character validation
10-6 validation digits 0-9, +, and - character
7-27 obtaining field display and data character
7-28 obtaining field display and data character
6-6 display color choice menu
7-90 setting the character display position
7-91 setting the character display position
7-25 screen obtaining current character display position while processing a
7-26 screen obtaining current character display position while processing a
7-77 displaying a message to a screen
6-9 displaying a pop-up list
6-13 displaying a pop-up menu
6-17 mark/unmark capability displaying a pop-up menu with
5-6 displaying help context
7-117 setting the field done flag
11-46 double float range checking
11-14 validation any double floating point field
11-15 0.0 field validation double floating point greater than
11-16 equal to 0.0 field validation double floating point greater than or
11-17 field validation double floating point less than 0.0
11-18 equal to 0.0 field validation double floating point less than or
4-79 setting a window's border drawing character set
4-23 obtain border drawing characters for window
7-93 setting character echoed to the user
2-7 deleting an element from an existing list
2-21 marking an element in a list
2-15 obtaining number of last element in a list
2-16 obtaining number of next element in a list
2-18 obtaining number of previous element in a list
2-11 searching for an element in a list
2-26 unmark an element in a list
2-13 obtaining number of first element in an existing list
2-9 testing if list element is marked or unmarked
2-4 adding an element to an existing list
2-12 getting a pointer to a list element's data area
2-25 resizing a list element's data area
2-17 obtaining number of elements in a list
2-23 reordering elements in a list
2-6 information creating an empty list with optional header
4-12 deleting to end of line in a window
4-13 deleting to end of window
11-26 integer greater than or equal to 0 field validation
11-28 integer less than or equal to 0 field validation
11-6 long integer greater than or equal to 0 field validation
11-8 long integer less than or equal to 0 field validation
11-31 unsigned integer greater than or equal to 0 field validation
11-34 long integer greater than or equal to 0 field validation unsigned
11-16 floating point greater than or equal to 0.0 field validation double
11-18 double floating point less than or equal to 0.0 field validation
11-11 float greater than or equal to 0.0 field validation routine
11-13 float less than or equal to 0.0 field validation routine
3-18 btaining the current filter escape code
3-45 setting the current filter escape code
2-4 adding an element to an existing list
2-7 deleting an element from an existing list
2-8 destroying an existing list
2-13 number of first element in an existing list obtaining
2-14 obtaining pointer to existing list header data area
7-127 changing existing screen parameters
7-64 obtaining existing screen parameters
4-17 obtaining a character from an existing window
7-120 deleting an extended attribute
7-139 setting an extended attribute filter value
7-74 setting an extended attribute filter value
7-53 obtaining extended attribute information
7-56 obtaining extended attribute information
7-59 obtaining extended attribute information
7-47 obtaining an extended attribute number
7-50 obtaining an extended attribute number
7-110 adding an extended attribute to a field
7-110 adding an extended attribute to a field
7-101 adding validation routines to a field
7-104 adding validation routines to a field
7-107 adding validation routines to a field
7-98 adding validation routines to a field
7-21 deleting a field
7-82 process a field
9-5 special function to wipe field
7-124 user input code while processing a field translating the
7-95 setting the field abort flag
7-116 changing the field cursor position
7-87 changing the field cursor position
7-89 changing the field cursor position
7-31 obtaining pointer to field data area
7-27 obtaining field display and data character
7-28 obtaining field display and data character
7-117 setting the field done flag
7-94 setting the first field for screen processing
7-34 obtaining field information
7-123 setting field information
8-4 default field init routine
8-6 menu list field init routine
7-36 traversing a field list
7-38 traversing a field list
7-40 traversing a field list
7-42 traversing a field list
8-10 marking/unmarking items in a field menu
7-44 obtaining field number if name is known
7-17 creating a new field screen
7-15 adding a field to a screen
7-125 routine setting the next field to be processed in a validation
11-14 any double floating point field validation
11-24 any integer field validation
11-4 any long integer field validation
11-29 any unsigned integer field validation
11-32 any unsigned long integer field validation
11-3 default field validation
11-15 floating point greater than 0.0 field validation double
11-16 point greater than or equal to 0.0 field validation double floating
11-17 floating point less than 0.0 field validation double
11-18 point less than or equal to 0.0 field validation double floating
11-19 hh:mm time field validation
11-20 hh:mm:ss time field validation
11-26 integer greater than or equal to 0 field validation
11-25 integer greater than zero field validation
11-27 integer less than 0 field validation
11-28 integer less than or equal to 0 field validation
11-5 long integer greater than 0 field validation
11-6 integer greater than or equal to 0 field validation long
11-7 long integer less than 0 field validation
11-8 integer less than or equal to 0 field validation long
11-21 password field validation
11-30 unsigned integer greater than 0 field validation
11-31 integer greater than or equal to 0 field validation unsigned
11-33 long integer greater than 0 field validation unsigned
11-34 integer greater than or equal to 0 field validation unsigned long
11-9 any float field validation routine
11-10 float greater than 0.0 field validation routine
11-11 float greater than or equal to 0.0 field validation routine
11-12 float less than 0.0 field validation routine
11-13 float less than or equal to 0.0 field validation routine
7-92 the character to be put in a field's data area. translating
7-62 obtaining number of fields in a screen

3-7 close keyboard manager input file
3-8 close keyboard manager output file
5-13 closing an open help file
3-27 opening a keycode input file
3-28 opening a keycode output file
3-37 input from a suspended input file resuming
3-40 output to a suspended output file resuming
3-58 input from an open input file suspending
3-61 output to an open output file suspending
9-4 list of files special function routine
4-16 filling a window with a character
3-18 btaining the current filter escape code
3-45 setting the current filter escape code
7-139 setting an extended attribute filter value
7-74 setting an extended attribute filter value
2-13 obtaining number of first element in an existing list
7-94 setting the first field for screen processing
7-95 setting the field abort flag
7-117 setting the field done flag
11-9 any float field validation routine
11-10 validation routine float greater than 0.0 field
11-11 field validation routine float greater than or equal to 0.0
11-12 routine float less than 0.0 field validation
11-13 validation routine float less than or equal to 0.0 field
11-44 float range checking
11-46 double float range checking
10-7 floating point character validation
10-8 signed floating point character validation
11-14 any double floating point field validation
11-15 validation double floating point greater than 0.0 field
11-16 to 0.0 field validation double floating point greater than or equal
11-17 validation double floating point less than 0.0 field
11-18 0.0 field validation double floating point less than or equal to
4-29 obtain window foreground color
4-24 obtain window border foreground color
4-34 obtain window titles foreground color
7-75 initializing the forms manager package
4-60 printf function for windows
9-4 list of files special function routine
9-3 default special function routine.
9-5 special function to wipe field
3-22 input routine get a pointer to a registered user
5-4 get a pointer to current help context
3-19 get keycode from keyboard manager
3-21 get pointer to intercept routine
3-17 routine get pointer to registered background
3-23 routine get pointer to registered user output
2-12 data area getting a pointer to a list element's
11-5 long integer greater than 0 field validation
11-30 unsigned integer greater than 0 field validation
11-33 unsigned long integer greater than 0 field validation
11-15 double floating point greater than 0.0 field validation
11-10 routine float greater than 0.0 field validation
11-26 validation integer greater than or equal to 0 field
11-6 validation long integer greater than or equal to 0 field
11-31 validation unsigned integer greater than or equal to 0 field
11-34 validation unsigned long integer greater than or equal to 0 field
11-16 validation double floating point greater than or equal to 0.0 field
11-11 validation routine float greater than or equal to 0.0 field
11-25 integer greater than zero field validation
2-14 obtaining pointer to existing list header data area
2-6 an empty list with optional header information creating
4-30 obtain window height
5-6 displaying help context
5-4 get a pointer to current help context
5-9 restoring saved help context
5-11 saving current help context
5-12 setting the current help context
5-13 closing an open help file
5-8 initialization of help manager
11-19 hh:mm time field validation
11-20 hh:mm:ss time field validation
4-45 window setting highlight character colors in a
4-64 window setting highlight character colors in a
4-75 in mono mode setting highlight color attribute to use if
4-77 in mono mode setting highlight color attribute to use if
4-19 mono mode obtaining highlight color attribute used if in
4-40 test if coordinates are in a window
4-19 highlight color attribute used if in mono mode obtaining
4-20 normal color attribute used if in mono mode obtaining
4-75 highlight color attribute to use if in mono mode setting
4-77 highlight color attribute to use if in mono mode setting
2-9 testing if list element is marked or unmarked
7-44 obtaining field number if name is known
7-112 ignoring a bad input character
7-114 ignoring a bad input character
2-6 an empty list with optional header information creating
7-53 obtaining extended attribute information
7-56 obtaining extended attribute information
7-59 obtaining extended attribute information
7-34 obtaining field information
7-123 setting field information
8-4 default field init routine
8-6 menu list field init routine
2-20 list manager initialization
5-8 initialization of help manager
3-24 initialization of keyboard manager
7-75 package initializing the forms manager
4-37 initializing window manager package
3-44 to run while waiting for key input register background routine
7-112 ignoring a bad input character
7-114 ignoring a bad input character
7-124 translating the user input code while processing a field
3-7 close keyboard manager input file
3-27 opening a keycode input file
3-37 resuming input from a suspended input file
3-58 suspending input from an open input file
3-37 resuming input from a suspended input file
3-41 routine resuming input from a suspended user input
3-58 suspending input from an open input file
3-13 de-register a user input routine
3-22 get a pointer to a registered user input routine
3-53 register a user input routine
3-41 input from a suspended user input routine resuming
3-62 suspending a user input routine
7-60 obtaining current insert/overstrike mode
7-121 setting insert/overstrike mode
4-38 inserting a character in a window
4-39 inserting a line in a window
11-24 any integer field validation
11-4 any long integer field validation
11-29 any unsigned integer field validation
11-32 any unsigned long integer field validation
11-5 validation long integer greater than 0 field
11-30 validation unsigned integer greater than 0 field
11-33 validation unsigned long integer greater than 0 field
11-26 field validation integer greater than or equal to 0
11-6 field validation long integer greater than or equal to 0
11-31 field validation unsigned integer greater than or equal to 0
11-34 field validation unsigned long integer greater than or equal to 0
11-25 validation integer greater than zero field
11-27 integer less than 0 field validation
11-7 long integer less than 0 field validation
11-28 validation integer less than or equal to 0 field
11-8 validation long integer less than or equal to 0 field
11-36 integer range checking
11-38 long integer range checking
11-40 unsigned integer range checking
11-42 unsigned long integer range checking
3-12 de-register an intercept routine
3-21 get pointer to intercept routine
3-47 register intercept routine
3-39 resuming a suspended intercept routine
3-60 suspending interception of a keycode
7-44 obtaining field number if name is known
2-9 testing if list element is marked or unmarked
8-10 marking/unmarking items in a field menu
3-44 routine to run while waiting for key input register background
3-19 get keycode from keyboard manager
3-24 initialization of keyboard manager
3-31 restoring a saved keyboard manager context
3-34 saving the current keyboard manager context
3-7 close keyboard manager input file
3-8 close keyboard manager output file
3-60 suspending interception of a keycode
3-25 testing for available keycode
3-19 get keycode from keyboard manager
3-27 opening a keycode input file
3-28 opening a keycode output file
7-44 obtaining field number if name is known
2-15 obtaining number of last element in a list
4-50 setting a title at the left side of a window
11-27 integer less than 0 field validation
11-7 long integer less than 0 field validation
11-17 double floating point less than 0.0 field validation
11-12 routine float less than 0.0 field validation
11-28 validation integer less than or equal to 0 field
11-8 validation long integer less than or equal to 0 field
11-18 validation double floating point less than or equal to 0.0 field
11-13 validation routine float less than or equal to 0.0 field
7-130 obtaining and setting level boundries
7-133 obtaining and setting level boundries
7-67 obtaining and setting level boundries
7-70 obtaining and setting level boundries
4-15 deleting a line in a window
4-12 deleting to end of line in a window
4-39 inserting a line in a window
2-4 adding an element to an existing list
2-7 an element from an existing list deleting
2-8 destroying an existing list
6-9 displaying a pop-up list
2-21 marking an element in a list
2-17 obtaining number of elements in a list
2-13 of first element in an existing list obtaining number
2-15 number of last element in a list obtaining
2-16 number of next element in a list obtaining
2-18 number of previous element in a list obtaining
2-23 reordering elements in a list
2-11 searching for an element in a list
7-36 traversing a field list
7-38 traversing a field list
7-40 traversing a field list
7-42 traversing a field list
2-26 unmark an element in a list
2-9 testing if list element is marked or unmarked
2-12 getting a pointer to a list element's data area
2-25 resizing a list element's data area
8-6 menu list field init routine
2-14 obtaining pointer to existing list header data area
2-20 list manager initialization
9-4 routine list of files special function
10-12 character list validation
2-6 creating an empty list with optional header information
4-43 window locate and print a character in a
4-48 locate and print a string in a window
4-41 locate cursor in a window
4-27 obtain window column location
4-31 obtain window row location
11-4 any long integer field validation
11-32 any unsigned long integer field validation
11-5 validation long integer greater than 0 field
11-33 validation unsigned long integer greater than 0 field
11-6 0 field validation long integer greater than or equal to
11-34 0 field validation unsigned long integer greater than or equal to
11-7 validation long integer less than 0 field
11-8 field validation long integer less than or equal to 0
11-38 long integer range checking
11-42 unsigned long integer range checking
3-19 get keycode from keyboard manager
5-8 initialization of help manager
3-24 initialization of keyboard manager
3-31 restoring a saved keyboard manager context
3-34 saving the current keyboard manager context
2-20 list manager initialization
3-7 close keyboard manager input file
3-8 close keyboard manager output file
7-75 initializing the forms manager package
4-37 initializing window manager package
6-17 displaying a pop-up menu with mark/unmark capability
2-9 testing if list element is marked or unmarked
2-21 marking an element in a list
8-10 menu marking/unmarking items in a field
6-6 display color choice menu
6-13 displaying a pop-up menu
8-10 marking/unmarking items in a field menu
8-6 menu list field init routine
6-17 displaying a pop-up menu with mark/unmark capability
7-77 displaying a message to a screen
7-60 current insert/overstrike mode obtaining
4-19 color attribute used if in mono mode obtaining highlight
4-20 color attribute used if in mono mode obtaining normal
4-75 color attribute to use if in mono mode setting highlight
4-77 color attribute to use if in mono mode setting highlight
7-121 setting insert/overstrike mode
4-26 obtain curren cursor mode in window
4-19 color attribute used if in mono mode obtaining highlight
4-20 normal color attribute used if in mono mode obtaining
4-75 color attribute to use if in mono mode setting highlight
4-77 color attribute to use if in mono mode setting highlight
11-22 month/day date validation
11-23 month/day/year date validation
4-52 moving a character in a window
4-53 moving a string in a window
4-51 moving a window on the screen
7-44 obtaining field number if name is known
7-17 creating a new field screen
4-72 default creation parameters for new windows setting
2-16 obtaining number of next element in a list
7-125 validation routine setting the next field to be processed in a
4-47 setting normal character colors in a window
4-66 setting normal character colors in a window
4-20 mono mode obtaining normal color attribute used if in
7-47 obtaining an extended attribute number
7-50 obtaining an extended attribute number
7-44 obtaining field number if name is known
7-72 obtaining window number of a screen
2-17 obtaining number of elements in a list
7-62 obtaining number of fields in a screen
2-13 existing list obtaining number of first element in an
2-15 obtaining number of last element in a list
2-16 obtaining number of next element in a list
2-18 obtaining number of previous element in a list
4-23 window obtain border drawing characters for
4-26 obtain curren cursor mode in window
4-25 window obtain cursor column position in
4-28 obtain cursor row position in window
4-32 obtain scroll status for window
4-22 obtain window background color
4-21 obtain window border background color
4-24 obtain window border foreground color
4-27 obtain window column location
4-29 obtain window foreground color
4-30 obtain window height
4-31 obtain window row location
4-33 obtain window titles background color
4-34 obtain window titles foreground color
4-35 obtain window width
4-17 existing window obtaining a character from an
7-47 number obtaining an extended attribute
7-50 number obtaining an extended attribute
7-130 obtaining and setting level boundries
7-133 obtaining and setting level boundries
7-67 obtaining and setting level boundries
7-70 obtaining and setting level boundries
7-25 position while processing a screen obtaining current character display
7-26 position while processing a screen obtaining current character display
7-22 while processing a screen obtaining current cursor position
7-24 while processing a screen obtaining current cursor position
7-60 mode obtaining current insert/overstrike
7-23 obtaining cursor change status
4-18 parameters obtaining default window creation
7-64 obtaining existing screen parameters
7-53 information obtaining extended attribute
7-56 information obtaining extended attribute
7-59 information obtaining extended attribute
7-27 character obtaining field display and data
7-28 character obtaining field display and data
7-34 obtaining field information
7-44 known obtaining field number if name is
4-19 used if in mono mode obtaining highlight color attribute
4-20 if in mono mode obtaining normal color attribute used
2-17 list obtaining number of elements in a
7-62 screen obtaining number of fields in a
2-13 an existing list obtaining number of first element in
2-15 list obtaining number of last element in a
2-16 list obtaining number of next element in a
2-18 in a list obtaining number of previous element
2-14 header data area obtaining pointer to existing list
7-31 obtaining pointer to field data area
7-72 obtaining window number of a screen
5-13 closing an open help file
3-58 suspending input from an open input file
3-61 suspending output to an open output file
3-27 opening a keycode input file
3-28 opening a keycode output file
2-6 creating an empty list with optional header information
11-26 integer greater than or equal to 0 field validation
11-28 integer less than or equal to 0 field validation
11-6 long integer greater than or equal to 0 field validation
11-8 long integer less than or equal to 0 field validation
11-31 unsigned integer greater than or equal to 0 field validation
11-34 unsigned long integer greater than or equal to 0 field validation
11-16 double floating point greater than or equal to 0.0 field validation
11-18 double floating point less than or equal to 0.0 field validation
11-11 routine float greater than or equal to 0.0 field validation
11-13 routine float less than or equal to 0.0 field validation
2-9 testing if list element is marked or unmarked
7-137 setting process order for a screen
3-8 close keyboard manager output file
3-28 opening a keycode output file
3-40 resuming output to a suspended output file
3-61 suspending output to an open output file
3-15 de-register a user output routine
3-23 get pointer to registered user output routine
3-55 register user output routine
3-42 resuming a suspended user output routine
3-63 suspending a user output routine
3-40 resuming output to a suspended output file
3-61 suspending output to an open output file
7-75 initializing the forms manager package
4-37 initializing window manager package
7-127 changing existing screen parameters
4-18 obtaining default window creation parameters
7-64 obtaining existing screen parameters
4-72 setting default creation parameters for new windows
11-21 password field validation
10-7 floating point character validation
10-8 signed floating point character validation
11-14 any double floating point field validation
11-15 validation double floating point greater than 0.0 field
11-16 field validation double floating point greater than or equal to 0.0
11-17 double floating point less than 0.0 field validation
11-18 validation double floating point less than or equal to 0.0 field
2-12 getting a pointer to a list element's data area
3-22 routine get a pointer to a registered user input
5-4 get a pointer to current help context
2-14 area obtaining pointer to existing list header data
7-31 obtaining pointer to field data area
3-21 get pointer to intercept routine
3-17 routine get pointer to registered background
3-23 routine get pointer to registered user output
6-9 displaying a pop-up list
6-13 displaying a pop-up menu
6-17 capability displaying a pop-up menu with mark/unmark
7-116 changing the field cursor position
7-87 changing the field cursor position
7-89 changing the field cursor position
7-90 setting the character display position
7-91 setting the character display position
4-25 obtain cursor column position in window
4-28 obtain cursor row position in window
7-25 current character display position while processing a sobtaining
7-26 current character display position while processing a sobtaining
7-22 obtaining current cursor position while processing a screen
7-24 obtaining current cursor position while processing a screen
2-18 obtaining number of previous element in a list
4-43 locate and print a character in a window
4-48 locate and print a string in a window
4-60 printf function for windows
4-62 printing a character in a window
4-67 printing a string in a window
7-82 process a field
7-137 setting process order for a screen
7-125 setting the next field to be processed in a validation routine
7-94 setting the first field for screen processing
7-124 the user input code while processing a field translating
7-85 processing a screen
7-25 character display position while processing a screen obtaining current
7-26 character display position while processing a screen obtaining current
7-22 current cursor position while processing a screen obtaining
7-24 current cursor position while processing a screen obtaining
7-92 translating the character to be put in a field's data area.
11-46 double float range checking
11-44 float range checking
11-36 integer range checking
11-38 long integer range checking
11-40 unsigned integer range checking
11-42 unsigned long integer range checking
3-53 register a user input routine
3-44 while waiting for key input register background routine to run
3-47 register intercept routine
3-55 register user output routine
3-10 delete registered background routine
3-17 get pointer to registered background routine
3-22 get a pointer to a registered user input routine
3-23 get pointer to registered user output routine
2-23 reordering elements in a list
2-25 resizing a list element's data area
3-31 context restoring a saved keyboard manager
5-9 restoring saved help context
3-39 routine resuming a suspended intercept
3-42 routine resuming a suspended user output
3-37 file resuming input from a suspended input
3-41 input routine resuming input from a suspended user
3-40 file resuming output to a suspended output
3-36 resuming the background routine
4-69 setting a title at the right side of a window
11-9 any float field validation routine
3-13 de-register a user input routine
3-15 de-register a user output routine
3-12 de-register an intercept routine
8-4 default field init routine
3-10 delete registered background routine
11-10 greater than 0.0 field validation routine float
11-11 or equal to 0.0 field validation routine float greater than
11-12 less than 0.0 field validation routine float
11-13 or equal to 0.0 field validation routine float less than
3-22 pointer to a registered user input routine get a
3-21 get pointer to intercept routine
3-17 pointer to registered background routine get
3-23 pointer to registered user output routine get
9-4 list of files special function routine
8-6 menu list field init routine
3-53 register a user input routine
3-47 register intercept routine
3-55 register user output routine
3-39 resuming a suspended intercept routine
3-42 resuming a suspended user output routine
3-41 input from a suspended user input routine resuming
3-36 resuming the background routine
7-125 to be processed in a validation routine setting the next field
3-62 suspending a user input routine
3-63 suspending a user output routine
3-57 suspending the background routine
3-44 input register background routine to run while waiting for key
9-3 default special function routine.
7-101 adding validation routines to a field
7-104 adding validation routines to a field
7-107 adding validation routines to a field
7-98 adding validation routines to a field
4-31 obtain window row location
4-28 obtain cursor row position in window
3-44 register background routine to run while waiting for key input
5-9 restoring saved help context
3-31 restoring a saved keyboard manager context
5-11 saving current help context
3-34 context saving the current keyboard manager
7-15 adding a field to a screen
7-17 creating a new field screen
7-19 destroying a screen
7-77 displaying a message to a screen
4-51 moving a window on the screen
7-25 position while processing a scrobtaining current character display
7-26 position while processing a scrobtaining current character display
7-22 cursor position while processing a screen obtaining current
7-24 cursor position while processing a screen obtaining current
7-62 obtaining number of fields in a screen
7-72 obtaining window number of a screen
7-85 processing a screen
7-137 setting process order for a screen
4-91 translate window coordinates to screen coordinates
7-127 changing existing screen parameters
7-64 obtaining existing screen parameters
7-94 setting the first field for screen processing
4-85 setting a window's scroll status
4-32 obtain scroll status for window
4-74 scrolling text in a window
2-11 searching for an element in a list
4-79 window's border drawing character set setting a
4-8 window setting a title at the bottom of a
4-50 window setting a title at the left side of a
4-69 a window setting a title at the right side of
4-89 window setting a title at the top of a
4-81 setting a window's border colors
4-79 character set setting a window's border drawing
4-82 setting a window's cursor style
4-85 setting a window's scroll status
4-84 setting a window's text colors
4-87 setting a window's titles colors
7-139 value setting an extended attribute filter
7-74 value setting an extended attribute filter
7-93 setting character echoed to the user
4-72 for new windows setting default creation parameters
7-123 setting field information
4-45 a window setting highlight character colors in
4-64 a window setting highlight character colors in
4-75 use if in mono mode setting highlight color attribute to
4-77 use if in mono mode setting highlight color attribute to
7-121 setting insert/overstrike mode
7-130 obtaining and setting level boundries
7-133 obtaining and setting level boundries
7-67 obtaining and setting level boundries
7-70 obtaining and setting level boundries
4-47 window setting normal character colors in a
4-66 window setting normal character colors in a
7-137 setting process order for a screen
7-90 position setting the character display
7-91 position setting the character display
3-45 code setting the current filter escape
5-12 setting the current help context
7-95 setting the field abort flag
7-117 setting the field done flag
7-94 processing setting the first field for screen
7-125 processed in a validation routine setting the next field to be
4-50 setting a title at the left side of a window
4-69 setting a title at the right side of a window
10-8 validation signed floating point character
4-76 changing the size of a window
10-9 alpha and space character validation
10-10 alphanumeric and space character validation
9-4 list of files special function routine
9-3 default special function routine.
9-5 special function to wipe field
7-23 obtaining cursor change status
4-85 setting a window's scroll status
4-32 obtain scroll status for window
4-48 locate and print a string in a window
4-53 moving a string in a window
4-67 printing a string in a window
4-82 setting a window's cursor style
3-37 resuming input from a suspended input file
3-39 resuming a suspended intercept routine
3-40 resuming output to a suspended output file
3-41 resuming input from a suspended user input routine
3-42 resuming a suspended user output routine
3-62 suspending a user input routine
3-63 suspending a user output routine
3-58 file suspending input from an open input
3-60 suspending interception of a keycode
3-61 file suspending output to an open output
3-57 suspending the background routine
4-40 test if coordinates are in a window
3-25 testing for available keycode
2-9 unmarked testing if list element is marked or
4-84 setting a window's text colors
4-74 scrolling text in a window
11-27 integer less than 0 field validation
11-5 long integer greater than 0 field validation
11-7 long integer less than 0 field validation
11-30 unsigned integer greater than 0 field validation
11-33 unsigned long integer greater than 0 field validation
11-15 double floating point greater than 0.0 field validation
11-17 double floating point less than 0.0 field validation
11-10 float greater than 0.0 field validation routine
11-12 float less than 0.0 field validation routine
11-26 integer greater than or equal to 0 field validation
11-28 integer less than or equal to 0 field validation
11-6 long integer greater than or equal to 0 field validation
11-8 long integer less than or equal to 0 field validation
11-31 unsigned integer greater than or equal to 0 field validation
11-34 unsigned long integer greater than or equal to 0 field validation
11-16 double floating point greater than or equal to 0.0 field validation
11-18 double floating point less than or equal to 0.0 field validation
11-11 routine float greater than or equal to 0.0 field validation
11-13 routine float less than or equal to 0.0 field validation
11-25 integer greater than zero field validation
11-19 hh:mm time field validation
11-20 hh:mm:ss time field validation
4-8 setting a title at the bottom of a window
4-50 setting a title at the left side of a window
4-69 setting a title at the right side of a window
4-89 setting a title at the top of a window
4-33 obtain window titles background color
4-87 setting a window's titles colors
4-34 obtain window titles foreground color
4-89 setting a title at the top of a window
4-91 screen coordinates translate window coordinates to
7-92 in a field's data area. translating the character to be put
7-124 processing a field translating the user input code while
7-36 traversing a field list
7-38 traversing a field list
7-40 traversing a field list
7-42 traversing a field list
2-26 unmark an element in a list
2-9 if list element is marked or unmarked testing
11-29 any unsigned integer field validation
11-30 validation unsigned integer greater than 0 field
11-31 equal to 0 field validation unsigned integer greater than or
11-40 unsigned integer range checking
11-32 validation any unsigned long integer field
11-33 field validation unsigned long integer greater than 0
11-34 equal to 0 field validation unsigned long integer greater than or
11-42 unsigned long integer range checking
4-75 highlight color attribute to use if in mono mode setting
4-77 highlight color attribute to use if in mono mode setting
4-19 highlight color attribute used if in mono mode obtaining
4-20 obtaining normal color attribute used if in mono mode
7-93 setting character echoed to the user
7-124 field translating the user input code while processing a
3-13 de-register a user input routine
3-22 get a pointer to a registered user input routine
3-53 register a user input routine
3-41 resuming input from a suspended user input routine
3-62 suspending a user input routine
3-15 de-register a user output routine
3-23 get pointer to registered user output routine
3-55 register user output routine
3-42 resuming a suspended user output routine
3-63 suspending a user output routine
10-9 alpha and space character validation
10-4 alpha character validation
10-10 alphanumeric and space character validation
11-14 any double floating point field validation
11-24 any integer field validation
11-4 any long integer field validation
11-29 any unsigned integer field validation
11-32 any unsigned long integer field validation
10-12 character list validation
10-2 default character validation
11-3 default field validation
10-3 digits 0-9 character validation
10-6 digits 0-9, +, and - character validation
11-15 point greater than 0.0 field validation double floating
11-16 greater than or equal to 0.0 field validation double floating point
11-17 floating point less than 0.0 field validation double
11-18 less than or equal to 0.0 field validation double floating point
10-7 floating point character validation
11-19 hh:mm time field validation
11-20 hh:mm:ss time field validation
11-26 greater than or equal to 0 field validation integer
11-25 integer greater than zero field validation
11-27 integer less than 0 field validation
11-28 less than or equal to 0 field validation integer
11-5 long integer greater than 0 field validation
11-6 greater than or equal to 0 field validation long integer
11-7 long integer less than 0 field validation
11-8 less than or equal to 0 field validation long integer
11-22 month/day date validation
11-23 month/day/year date validation
11-21 password field validation
10-8 signed floating point character validation
11-30 integer greater than 0 field validation unsigned
11-31 greater than or equal to 0 field validation unsigned integer
11-33 long integer greater than 0 field validation unsigned
11-34 greater than or equal to 0 field validation unsigned long integer
10-5 alphanumeric character validation
11-9 any float field validation routine
11-10 float greater than 0.0 field validation routine
11-11 greater than or equal to 0.0 field validation routine float
11-12 float less than 0.0 field validation routine
11-13 less than or equal to 0.0 field validation routine float
7-125 next field to be processed in a validation routine setting the
7-101 adding validation routines to a field
7-104 adding validation routines to a field
7-107 adding validation routines to a field
7-98 adding validation routines to a field
7-139 an extended attribute filter value setting
7-74 an extended attribute filter value setting
3-44 background routine to run while waiting for key input register
7-124 translating the user input code while processing a field
7-25 current character display position while processing a screen obtaining
7-26 current character display position while processing a screen obtaining
7-22 obtaining current cursor position while processing a screen
7-24 obtaining current cursor position while processing a screen
3-44 register background routine to run while waiting for key input
4-35 obtain window width
4-6 backspacing in a window
4-76 changing the size of a window
4-11 creating a window
4-15 deleting a line in a window
4-13 deleting to end of window
4-12 deleting to end of line in a window
4-14 destroying a window
4-38 inserting a character in a window
4-39 inserting a line in a window
4-43 locate and print a character in a window
4-48 locate and print a string in a window
4-41 locate cursor in a window
4-52 moving a character in a window
4-53 moving a string in a window
4-23 border drawing characters for window obtain
4-26 obtain curren cursor mode in window
4-25 obtain cursor column position in window
4-28 obtain cursor row position in window
4-32 obtain scroll status for window
4-17 a character from an existing window obtaining
4-62 printing a character in a window
4-67 printing a string in a window
4-74 scrolling text in a window
4-8 setting a title at the bottom of a window
4-50 a title at the left side of a window setting
4-69 a title at the right side of a window setting
4-89 setting a title at the top of a window
4-45 highlight character colors in a window setting
4-64 highlight character colors in a window setting
4-47 normal character colors in a window setting
4-66 normal character colors in a window setting
4-40 test if coordinates are in a window
4-22 obtain window background color
4-21 obtain window border background color
4-24 obtain window border foreground color
4-27 obtain window column location
4-91 coordinates translate window coordinates to screen
4-18 obtaining default window creation parameters
4-29 obtain window foreground color
4-30 obtain window height
4-37 initializing window manager package
7-72 obtaining window number of a screen
4-51 moving a window on the screen
4-31 obtain window row location
4-33 obtain window titles background color
4-34 obtain window titles foreground color
4-35 obtain window width
4-16 filling a window with a character
4-9 clearing a window with blanks
4-81 setting a window's border colors
4-79 setting a window's border drawing character set
4-82 setting a window's cursor style
4-85 setting a window's scroll status
4-84 setting a window's text colors
4-87 setting a window's titles colors
4-60 printf function for windows
4-72 creation parameters for new windows setting default
9-5 special function to wipe field
11-25 integer greater than zero field validation



  3 Responses to “Category : C Source Code
Archive   : HIM100.ZIP
Filename : HIMSWMAN.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/