Category : C Source Code
Archive   : TCHK21.ZIP
Filename : TCHKF.DOC

 
Output of file : TCHKF.DOC contained in archive : TCHK21.ZIP





TCHK 2.1 Page 1


Table of Contents


accum_dep - calculate accumulated depreciation ................ 8
ansi_call - create an ANSI escape sequence .................... 9
ansiback - convert DOS background code to ANSI ................ 11
ansifore - convert DOS foreground code to ANSI ................ 12
atrim - trims leading and trailing blanks ..................... 13
average - calculate the average of a set of reals ............. 14
beep - generate a standard IBM PC beep ........................ 15
bitrevb - bit reverse a byte .................................. 16
bitrevl - bit reverse a long .................................. 17
bitrevw - bit reverse a word .................................. 18
box - draw a box .............................................. 19
boxwindow - draw a 'window' ................................... 20
Cal... - family of Calendar date conversions .................. 22
CapsLock - set the Caps Lock key state ........................ 23
CEDadd - add a CED installable command ........................ 24
CEDremove - remove a CED installable command .................. 25
center - coordinate to center a message on screen ............. 26
changelitebar - set internal litebar menu .................... 27
Checksum_block - calculate checksum for a block ............... 28
clear - clears a portion of the screen ........................ 29
clear_typeahead - clear typeahead buffer ...................... 30
cls - clear screen ............................................ 31
color - make a single attribute ............................... 32
commit - flush disk buffers for to a handle ................... 33
Compaq386GetCpuSpeed - get cpu speed on a ..................... 34
Compaq386KbdType - keyboard type used by a .................... 35
Compaq386SetCpuSpeed - get cpu speed on a ..................... 36
CompaqExternalMonitorType - Get external monitor .............. 37
CompaqGetMasterMode - Get master mode of current .............. 38
CompaqGetMonitor - Get active monitor ......................... 39
CompaqInternalMonitorType - Get internal monitor .............. 40
CompaqModeSwitchDelay - Set mode switch delay ................. 41
CompaqSelectMonitor - Select active monitor ................... 42
CompaqSetMasterMode - Set master mode of current .............. 43
cpu_id - identify the cpu ..................................... 44
CRC16_block - calculate CRC-16 for a block .................... 45
CRC16tupdate - update a CRC-16 value via tables ............... 46
CRC16update - update a CRC-16 value ........................... 47
CRC32tupdate - update a CRC-32 value via tables ............... 48
cursor_blink - set speed of cursor blink ...................... 49
cursor_flip - toggle the cursor type .......................... 50
cursor_off - turn the cursor off .............................. 51
cursor_on - turn the cursor on ................................ 52
date_convert - convert date formats ........................... 53
dayofweek - find the day of the week .......................... 54
dayofyear - calculate the day of the year ..................... 55
daysleft - calculate the days left in the year ................ 56
ddatetofull - convert a date to full string ................... 57
ddatetoshort - convert a date to short string ................. 58
ddatetostr - convert a date to abbrev. string ................. 59
depreciation - calculate depreciation for a ................... 60
DESQapilevel - define minimum API level required .............. 61








TCHK 2.1 Page 2

DESQappnum - DESQview program number .......................... 62
DESQbeginc - begin critical section ........................... 63
DESQcommonmem - returns measure of common memory .............. 64
DESQconvenmem - returns measure of conventional ............... 65
DESQdisperror - popup a DESQview error window ................. 66
DESQendc - end critical section ............................... 67
DESQexit - exit program in DESQview ........................... 68
DESQexpandedmem - returns measure of expanded ................. 69
DESQgetbuf - get DESQview virtual screen info ................. 70
DESQgetmem - allocate DESQview "system" memory ................ 71
DESQiskmouse - is mouse emulated via keyboard ................. 72
DESQjustify - set automatic window justification .............. 73
DESQkmouse_off - disable keyboard mouse emulation ............. 74
DESQkmouse_on - enable keyboard mouse emulation ............... 75
DESQostack - switch to DESQview's internal stack .............. 76
DESQpause - give up CPU time .................................. 77
DESQpoke - displays a char on the status line ................. 78
DESQposttask - awaken DESQview task ........................... 79
DESQpushkey - put key into keyboard input stream .............. 80
DESQputmem - deallocate DESQview "system" memory .............. 81
DESQsound - makes a tone under DESQview ....................... 82
DESQstart - start (unFreeze) a task ........................... 83
DESQstop - stop (Freeze) the current task ..................... 84
DESQustack - switch back to program's stack .................. 85
DESQversion - DESQview version ................................ 86
diffddate - calculate the difference in 2 dates ............... 87
diskchanged - has the disk has been changed ................... 88
disktype - identify disk type ................................. 89
dosday - extract day from file date stamp ..................... 90
doshour - extract hour from file time stamp ................... 91
dosmonth - extract hour from file date stamp .................. 92
dosmin - extract minutes from file time stamp ................. 93
dossec - extract seconds from file time stamp ................. 94
dostimetolong - convert DOS time to 1/100 seconds ............. 95
dosyear - extract year from file date stamp ................... 96
double_decline_bal_dep - calculate double ..................... 97
DoubleDOSfreeCPU - give up CPU time under ..................... 98
DoubleDOSGetVirtual - get DoubleDOS virtual ................... 99
DoubleDOSTaskSwitch - set Double DOS task ..................... 100
EMMversion - version of Expanded Memory Manager ............... 101
EMSGetStatus - get Expanded Memory status ..................... 102
EMSinfo - determines EMM version and EMS pages ................ 103
EMSpages - determines the total and available ................. 104
EMSwarmbootprep - prepares the EMM for warm boot .............. 105
endstri - get offset to last char of a string ................. 106
endstrp - get pointer to last char of a string ................ 107
expandfilespec - expand a filespec into a full ................ 108
Extendedtotal - total Extended memory installed ............... 109
factorial - determines a factorial (n!) ....................... 110
fileexist - does a file exist ................................. 111
fname_match - compare filenames w/wildcards ................... 112
fncmp - compare filenames w/wildcards ......................... 113
frac - round the fractional portion of a real ................. 114
fsgn - sign of a real ......................................... 115










TCHK 2.1 Page 3

fulltoddate - convert a full date to struct ................... 116
FV - calculate the Future Value of a single amount ............ 117
FVa - calculate the Future Value of an annuity ................ 118
getAssignmemseg - get ASSIGN work area segment ................ 119
getBootBlock - get Boot Block ................................. 120
getBootBlock4 - get Boot Block under DOS 4.x .................. 121
getBPB - get Bios Parameter Block ............................. 122
getc_match - get specific input, case dependent ............... 123
getci_match - get specific input, case ........................ 124
getcursor - gets cursor scan lines ............................ 125
getdatehk - inputs a date from the keyboard ................... 126
getdouble - inputs a double from the keyboard ................. 127
getfilespec - get a DIR proper filespec ....................... 128
getfname - get a filename from the keyboard ................... 129
getget - get a string from the keyboard w/editing ............. 130
getint - inputs an integer from the keyboard .................. 133
getk - get a key .............................................. 134
getlogical - get Yes/No ....................................... 135
getpw - inputs a password from the keyboard ................... 136
getreal - inputs a real from the keyboard ..................... 137
getstr - input a string from the keyboard ..................... 138
GetTypePointDevice - Pointing Device BIOS ..................... 139
getVolSerialNum - get Volume Serial Number .................... 140
getyn - get Yes/No ............................................ 141
gotohv - move cursor to absolute coordinates .................. 142
Greg... - family of Gregorian date conversion ................. 143
horiz_line - draw a horizontal line ........................... 144
initkeyvars - setup internal keyboard settings ................ 145
inkey - get a key ............................................. 146
inkeyc - get a key, any alphabetics capitalized ............... 147
inkeycdv - get a key, any alphabetics ......................... 148
inkeydv - get a key, DESQview aware ........................... 149
intlen - calculate length of integer in a string .............. 150
InsLock - set the Insert key state ............................ 151
is2nd8259 - is a 2nd 8259 chip installed ...................... 152
isallalpha - are all characters in string ..................... 153
isallalphanum - are all characters in string .................. 154
isalllower - are all characters in string ..................... 155
isallupper - are all characters in string ..................... 156
isAnarkey - is ANARKEY.COM by Steven Calwas ................... 157
isAppendavail - is APPEND installed ........................... 158
isAssignavail - is ASSIGN installed ........................... 159
isAutoPark - is AUTOPARK.COM by Alan D. Jones ................. 160
isBlogical - is drive B: logical .............................. 161
isBREAKon - check Ctrl-BREAK flag ............................. 162
iscdevicemoderaw - is character device in "raw" ............... 163
isCEDavail - is CED installed ................................. 164
isCGA - is Color Graphics adapter installed ................... 165
isEGA - is Enhanced Graphics adapter installed ................ 165
isHerc - is Hercules Graphics adapter installed ............... 165
isMDA - is Monochrome adapter installed ....................... 165
ismono - is monochrome display ................................ 165
iscolor - is color display .................................... 165
isdate - character classification ............................. 166










TCHK 2.1 Page 4

isdir - is a FAT entry a subdirectory ......................... 167
isDoubleDOS - is DoubleDOS installed .......................... 168
isdrivelocal - is drive local or remote ....................... 169
isDriverSys - is DRIVER.SYS installed ......................... 170
isEMSavail - is EMS available ................................. 171
isEnhanceKbd - is an enhanced keyboard installed .............. 172
iseven - is a number even ..................................... 173
isExtended - is Extended memory installed ..................... 174
isfilename - character classification ......................... 175
isgameport - is a game port installed ......................... 176
isgn - sign of an integer ..................................... 177
ishandlelocal - is handle local or remote ..................... 178
isHiliteable - can a menu command be hilighted ................ 179
isInvisible - is this the invisible program under ............. 180
isleapyear - is a year a leap year ............................ 181
isMCA - is the bus Micro Channel Architecture ................. 182
ismouse - is a mouse installed ................................ 183
isNetwork - is a network installed ............................ 184
isNLSFuncCom - is NLSFUNC.COM installed ....................... 185
isNovellNetavail - is Novell Network installed ................ 186
isodd - is a number odd ....................................... 187
ispathname - character classification ......................... 188
ispcAnywhere - is pcAnywhere installed ........................ 189
isPRINTavail - is PRINT.COM installed ......................... 190
isPM - the the hour AM or PM .................................. 191
isrealtimeclock - is a real time clock installed .............. 192
isRedirectStdin - is stdin redirected ......................... 193
isRedirectStdout - is stdout redirected ....................... 194
isremoveable - is device removeable ........................... 195
isScrnSav2 - is SCRNSAV2.COM by Alan Ballard .................. 196
isShareavail - is SHARE installed ............................. 197
isstate - is string a state abbreviation ...................... 198
isVERIFYon - check VERIFY flag ................................ 199
isVidclock - is VIDCLOCK.COM by Tom Hanlin .................... 200
isWhoa - is WHOA!.COM by Brad Crandall installed .............. 201
iswildcarded - checks a string for DOS wildcards .............. 202
isXMSinstalled - is XMS installed ............................. 203
iszip - is a zip code valid for a state ....................... 204
joystickAx - read joystick input Ax ........................... 205
joystickAy - read joystick input Ay ........................... 206
joystickBx - read joystick input Bx ........................... 207
joystickBy - read joystick input By ........................... 208
joysticksettings - read joystick switch settings .............. 209
Jul... - family of Julian date conversion ..................... 210
keyclick - turn on key click .................................. 211
leftstr - return the left portion of a string ................. 212
litebar_alloc - allocate memory for a litebar ................. 213
litebar_free - frees memory allocated by a .................... 217
litebar_get - get user's choice from a litebar ................ 218
litehilite - hilite a litebar menu command .................... 219
litemessage - change the message for a litebar ................ 220
liteunlite - unhilite a litebar menu command .................. 221
longtodostime - convert 1/100 seconds to DOS time ............. 222
lpow - raise a base to an exponent ............................ 223










TCHK 2.1 Page 5

lsgn - sign of a long integer ................................. 224
ltrim - trims leading blanks .................................. 225
machine_id - determine machine type ........................... 226
MButtonPress - mouse button press data ........................ 227
MButtonRelease - mouse button release data .................... 228
MButtonStatus - mouse position and button status .............. 229
MCursorGraphic - define graphic cursor ........................ 230
MCursorOff - turns off (hide) the mouse cursor ................ 231
MCursorOn - turns on (show) the mouse cursor .................. 232
MCursorRangex - define horizontal cursor range ................ 233
MCursorRangey - define vertical cursor range .................. 234
MCursorText - define text cursor .............................. 235
MDriverSize - get driver storage requirements ................. 236
memory_strategy - get/set memory alloc strategy ............... 237
MEmulateLightpenOff - mouse light pen emulation ............... 238
MEmulateLightpenOn - mouse light pen emulation on ............. 239
menu_litebar - litebar style menu ............................. 240
menu_popup - popup style menu ................................. 241
MGetDisplayPage - get mouse display page number ............... 242
MGetDriver - save mouse driver state .......................... 243
MGetSensitivity - get mouse sensitivity ....................... 244
MGetVerType - get software version and mouse type ............. 245
MGotoxy - position mouse cursor ............................... 246
mid - is a number within a range .............................. 247
midstr - return the middle portion of a string ................ 248
MMickeysMovedx - number of mickeys mouse moved ................ 249
MMickeysMovedy - number of mickeys mouse moved ................ 250
monthexpand - convert a month abbrev to its name .............. 251
MouseReset - reset mouse software only ........................ 252
MPutDriver - restore mouse driver state ....................... 253
MSetDisplayPage - set mouse display page number ............... 254
MSetRatio - set mickey to pixel ratio ......................... 255
MSetSensitivity - set mouse sensitivity ....................... 256
MSetThreshold - set double speed threshold .................... 257
MUpdateScreen - define screen region for updating ............. 258
ndp_id - identify the math coprocessor ........................ 259
nmid - is a number outside a range ............................ 260
NumLock - set the Num Lock key state .......................... 261
parsefilename - parses a filename, supports paths ............. 262
parsefnameext - parses a filename into name and ............... 264
pause - wait for a time or until a keypress ................... 265
PMT - calculate the periodic payment required to .............. 266
popup_alloc - allocate memory for a popup menu ................ 267
popup_free - frees memory allocated by popup menu ............. 271
popup_get - get user's choice from a popup menu ............... 272
popup_restore - restore video from a popup menu ............... 273
popup_setcurrent - set internal popup menu .................... 274
pophilite - hilite a popup menu command ....................... 275
popunlite - unhilite a popup menu command ..................... 276
print_screen - issue a PrintScreen ............................ 277
PRINTadd - add a file to the print queue ...................... 278
PRINThold - hold print queue for status read .................. 279
PRINTpurge - remove all files from print queue ................ 280
PRINTremove - remove a file from print queue .................. 281










TCHK 2.1 Page 6

PRINTresume - resume printing after a PRINThold ............... 282
putk - put a character w/attribute on the screen .............. 283
putsay - put a string with attribute on the ................... 284
putstr - put string with attribute on the screen .............. 285
PV - calculate the Present Value of a single .................. 286
PVa - calculate the Present Value of an annuity ............... 287
radd - add two REAL numbers ................................... 288
rceil - rounds up ............................................. 289
rdiv - divide using REAL math ................................. 290
read_attrib - gets the attribute under the cursor ............. 291
read_char - gets the character under the cursor ............... 292
read_cursor - reads cursor information ........................ 293
read_mode - find screen width, mode and page .................. 294
reboot - reboots the machine .................................. 295
ResetPointDevice - Pointing Device BIOS Interface ............. 296
resolvepath - resolve a path to a fully qualified ............. 297
rfloor - rounds down .......................................... 298
rightstr - return the right portion of a string ............... 299
rnegate - change sign ......................................... 300
rnormalize - fix precision .................................... 301
ROM_date - gets the ROM id date ............................... 302
ROM_id - gets the ROM id byte ................................. 303
round - round a real to a decimal place ....................... 304
rsign - determine the sign of a REAL number ................... 305
rsub - subtract two REAL numbers .............................. 306
rtrim - trims trailing blanks ................................. 307
scrbuff - calculate size of screen buffer ..................... 308
scroll_down - scroll window down .............................. 309
scroll_up - scroll window up .................................. 310
ScrollLock - set the Scroll Lock key state .................... 311
set_color - set the default attribute (color) ................. 312
set_cursor - sets cursor scan lines ........................... 313
set_handles - set handle count ................................ 314
set_mode - set the video mode ................................. 315
setAutoPark - set parking delay for AUTOPARK.COM .............. 316
setBREAK - set Ctrl-BREAK flag ................................ 317
setcdevicemoderaw - set character device mode ................. 318
setcursor - sets cursor scan lines ............................ 319
SetpcAnywhere - enable/disable pcAnywhere ..................... 320
SetPointDevice - Pointing Device BIOS Interface: .............. 321
SetRatePointDevice - Pointing Device BIOS ..................... 322
SetResPointDevice - Pointing Device BIOS ...................... 323
settextinfo - set text mode video information ................. 324
setVERIFY - set VERIFY flag ................................... 325
setWhoa - set delay count for WHOA!.COM by Brad ............... 326
shadow - draw a shadowed box .................................. 327
shorttoddate - convert a short date to struct ................. 329
soundex - convert a string to soundex form .................... 330
sqr - square of a value ....................................... 332
stateindex - get index for a given state ...................... 333
stddev - calculate the standard deviation of a ................ 334
straight_line_dep - calculate straight line ................... 335
strcapital - capitalizes the first letter of each ............. 336
strclean - remove non-printable ASCII codes ................... 337










TCHK 2.1 Page 7

strcomma - convert a string to xx,xxx,xxx format .............. 338
strdel - delete part of a string .............................. 339
strfill - fill a string with a character ...................... 340
strins - insert one string into another ....................... 341
stroccur - count the occurences of a substring ................ 342
strpadleft - pad the left of a string ......................... 343
strpadright - pad the right of a string ....................... 344
strrep - replicate a char ..................................... 345
strshleft - shift string left ................................. 346
strshright - shift string right ............................... 347
strspace2tab - compress spaces to tabs ........................ 348
strtabexpand - expand tabs to spaces .......................... 349
strtocomma - convert a string to xx,xxx format ................ 350
strtoddate - convert a date string to a structure ............. 351
strtodol - converts a string to dollar format ................. 352
strtotime - convert a string to a time structure .............. 353
strwcmp - compares a wild-carded string to .................... 354
strwicmp - compares a wild-carded string to ................... 355
sum_year_digits_dep - calculate sum of the years .............. 356
summation - calculate a summation of integers ................. 357
swap - swap two values ........................................ 358
time_convert - convert time formats ........................... 359
timetostr - convert time structure to a string ................ 360
to24hour - converts hours to 24-hour format ................... 361
tocapkey - convert the key code to uppercase .................. 362
todosdate - make a DOS file date stamp ........................ 363
todostime - make a DOS file time stamp ........................ 364
tohour - converts 24-hour format to 12-hour ................... 365
Tone - play a tone ............................................ 366
uninstallWhoa - uninstall WHOA!.COM by Brad ................... 367
valid_date - check if a date is valid ......................... 368
variance - calculate the variance of a set of ................. 369
vert_line - draw a vertical line .............................. 370
whereh - X-coordinate of cursor .............................. 371
wherev - Y-coordinate of cursor .............................. 372

Index .............................................................. 373



























TCHK 2.1 Page 8


Function accum_dep - calculate accumulated depreciation

Syntax double accum_dep(double cost, double salvage, int
life, int period, int dtype);

Prototype in finance.h

Remarks given the cost, salvage value and life of an item,
accum_dep will calculate the amount of accumulated
depreciation for the given period according to the
depreciation method specified by dtype. The cost and
salvage can be given in any unit (dollars, thousands
of dollars, etc.) but the life should be given in
depreciable periods (if you depreciate an item every
quarter, and the item has a life of 2 years, then
life should be 8).

The cost and salvage values should be in the same
units. The life and period should be given in the
same units.

Types of depreciation supported by the variable
dtype are:

1 - Straight line depreciation
2 - Sum of the years digits depreciation
3 - Double declining balance depreciation

Any other value for dtype will produce unpredictable
results.

No error checking is performed.

This is a generic function to calculate the
accumulated depreciation given all necessary
information. Any unnecessary information is ignored
(i.e. double declining balance does not need a
salvage value.)

Return value returns the amount of depreciation for the given
period in the same units as the cost, as per the
depreciation method specified by dtype.

Note The macros ACC_DDB(c,l,p), ACC_SLD(c,s,l) and
ACC_SYD(c,s,l,p) are defined in finance.h for ease
of use.

See also depreciation(), double_decline_bal_dep(),
straight_line_dep(), sum_year_digits_dep()

Example see demonum.c












TCHK 2.1 Page 9


Function ansi_call - create an ANSI escape sequence

Syntax char *ansi_call(int subfunction, int parm1, int
parm2, char *ansistring);

Prototype in ansihk.h

Remarks ansi_call is a general function that will create an
ANSI escape sequence for the given subfunction:

1: gotoxy(parm1,parm2)
2: cursor_right
3: cursor_left
4: cursor_up
5: cursor_down
6: save_cursor_position
7: restore_cursor_position
8: cls()
9: clear_eol()
10: set_foreground(parm1)
11: set_background(parm1)
12: clear_attributes (plain, normal)
13: bold
14: faint
15: italic
16: blink
17: fast_blink
18: inverse
19: invisible
20: set_mode(parm1)
21: reset_mode(parm1)
22: wherexy()

1: moves cursor to (parm1,parm2)
2-5: move cursor 1 space in direction indicated
6-7: save cursor position for future restoring
8: clear screen
9: clear to the end of current line
10-11: set colors for output
12-15,18-19: set attributes for output
16-17: control cursor blink rate
20-21: change mode (not same as DOS, see ansihk.h)
22: outputs the current cursor location

A value must be passed for parm1 and parm2, even if
they are not going to be used.

The escape sequence ansistring can be outputted
with a simple printf().

Remember, ANSI.SYS, FANSI-CONSOLE, or some similar
ANSI control sequence program must be active for
these codes to take effect.










TCHK 2.1 Page 10


Return value returns ansistring.

Note The color codes needed by ANSI functions are NOT
the same as the color codes used by DOS to set
attributes. Use the ANSI color #defines given in
ansihk.h.

See also ansiback(), ansifore()























































TCHK 2.1 Page 11


Function ansiback - convert DOS background code to ANSI

Syntax int ansiback(char code);

Prototype in ansihk.h

Remarks DOS and ANSI use different values for colors. This
function converts a DOS background color code to
the ANSI color code for the same color.

Return value returns the ANSI background color code

See also ansi_call(), ansifore()


















































TCHK 2.1 Page 12


Function ansifore - convert DOS foreground code to ANSI

Syntax int ansifore(char code);

Prototype in ansihk.h

Remarks DOS and ANSI use different values for colors. This

function converts a DOS foreground color code to
the ANSI color code for the same color.

Return value returns the ANSI foreground color code

See also ansi_call(), ansiback()


















































TCHK 2.1 Page 13


Function atrim - trims leading and trailing blanks

Syntax char *atrim(char *source);

Prototype in stringhk.h

Remarks remove leading and trailing blanks in a string. The
string passed to atrim (source) is modified.

Return value returns a pointer to source.

Example #include
#include /* for the printf */

main()
{
char msg[25] = " Hello everyone ";
printf("String [%s]\n",msg);
printf("atrim [%s]\n",atrim(msg));
}

Program output String [ Hello everyone ]
atrim [Hello everyone]








































TCHK 2.1 Page 14


Function average - calculate the average of a set of reals

Syntax double average(int n, double element[]);

Prototype in mathhk.h

Remarks average calculates the average of a set of n
numbers of type double.

Return value returns the average of a set of n numbers.

See also stddev(), summation(), variance()

Example #include

main()
{
double num[] = { 2.3, 7.1, 6.05 };

printf("Average is %lf\n",average(3,num));
}

Program output Average is 5.15








































TCHK 2.1 Page 15


Function beep - generate a standard IBM PC beep

Syntax void beep(void);

Prototype in sound.h

Remarks makes the speaker beep (just like the beep during
bootup).

See also Tone()

Return value nothing.



















































TCHK 2.1 Page 16


Function bitrevb - bit reverse a byte

Syntax unsigned char bitrevb(unsigned char value);

Prototype in mathhk.h

Remarks bitrevb() will reverse the bits in the byte value.

Return value returns the reversed byte.

See also bitrevl(), bitrevw()

Example #include

main()
{
printf("0x01 reversed => 0x%02X\n",
bitrevb(0x01));
}

Program output 0x01 reversed => 0x80










































TCHK 2.1 Page 17


Function bitrevl - bit reverse a long

Syntax unsigned char bitrevl(unsigned long value);

Prototype in mathhk.h

Remarks bitrevl() will reverse the bits in the double word
(long) value.

Return value returns the reversed long.

See also bitrevb(), bitrevw()

Example #include

main()
{
printf("0x00000001 reversed => 0x%08X\n",
bitrevb(0x00000001));
}

Program output 0x00000001 reversed => 0x80000000









































TCHK 2.1 Page 18


Function bitrevw - bit reverse a word

Syntax unsigned char bitrevw(unsigned int value);

Prototype in mathhk.h

Remarks bitrevw() will reverse the bits in the word value.

Return value returns the reversed word.

See also bitrevb(), bitrevl()

Example #include

main()
{
printf("0x0001 reversed => 0x%04X\n",
bitrevb(0x0001));
}

Program output 0x0001 reversed => 0x8000










































TCHK 2.1 Page 19


Function box - draw a box

Syntax int box(int left, int top, int right, int bottom,
char frame[]);

Prototype in video.h

Remarks draws a box via gotohv(), horiz_line(), putk() and
vert_line() (all use INTerrupts). Also, frame must
be have at least 9 elements (char frame[9]). The
box characters are frame[0] (top left) to frame[7]
(left wall), going clockwise. If frame[8] != '\0'
the box is filled with it.

Return value returns zero upon succesful completion, -1 if the
coordinates given are not large enough for a box.

See also global variables
boxwindow(), gotohv(), horiz_line(), putk(),
vert_line()

Example #include

main()
{
char framebox[9] = "abcdefghi";

box(1,1,7,4,framebox);
}

Program output abbbbbc
hiiiiid
hiiiiid
gfffffe





























TCHK 2.1 Page 20


Function boxwindow - draw a 'window'

Syntax int boxwindow(int left, int top, int right, int
bottom, char frame[], char *title,
int titlejustify, char colborder,
char coltitle, char colnorm, char
*buffer);

Prototype in video.h

Remarks draws a 'window'-like box (similiar to box(), but
with a title) at the coordinates (left,top) to
(right,bottom). The characters in frame[] are used
to generate the frame, with frame[9] and frame[10]
used as pre-/post-title separators if a title is
specified (title justification is not NONE). The
title is aligned as per titlejustify (LEFT, CENTER,
RIGHT or NONE. See HOWARD.H for more details). The
frame uses the colborder attribute, the title, if
any, uses the coltitle attribute and the inner
portions of the box are filled with spaces of
colnorm color. The box is stored in the memory
allocated by buffer and displayed with puttext().

If a title is specified (title justification is not
NONE) the title is separated from the pre-/post-
-title separators by a space.

Sufficient memory must be allocated for buffer to
contain the entire box, with attributes (see
scrbuff()).

Upon completion, buffer contains a copy of the
screen image of the box displayed (usable by
puttext()).

This routine is taken from an older version of the
popup...() and litebar...() creation functions.
This function does virtually no error checking.

Return value returns zero upon succesful completion, -1 if an
error occurs.

See also global variables
box(), horiz_line(), litebar...(), popup...(),
vert_line()

















TCHK 2.1 Page 21

Example #include
#include /* for CENTER */
#include /* for colors */

main()
{
char vidbuff[scrbuff(1,1,15,4)],
framebox[] = "abcdefgh[]";

boxwindow(1,1,15,4,framebox,"Title",CENTER,
CYAN,YELLOW,RED,vidbuff);
}

Program output abb[ Title ]bbc
h d
h d
gfffffffffffffe















































TCHK 2.1 Page 22


Function Cal... - family of Calendar date conversions

Syntax char *CaltoGreg(double cal);
char *CaltoGregEuro(double cal);
char *CaltoGregJap(double cal);
double CaltoJul(double cal);
double CaltoJulA(double cal);
double CaltoJulB(double cal);
double CaltoCalCent(double cal);
double CalCenttoCal(double cal);

Prototype in datehk.h

Remarks CaltoGreg converts Calendar date to Gregorian
(US) date
CaltoGregEuro converts Calendar date to Gregorian
(European) date
CaltoGregJap converts Calendar date to Gregorian
(Japan) date
CaltoJul converts Calendar date to Julian
(Type E) date
CaltoJulA converts Calendar date to Julian
(Type A) date
CaltoJulB converts Calendar date to Julian
(Type B) date
CaltoCalCent converts Calendar date to Calendar
date (w/century)
CalCenttoCal converts Calendar date (w/century)
to Calendar date

Return value CaltoGreg... return the appropriate Gregorian date
CaltoJul... return the appropriate Julian date
CaltoCalCent returns a Calendar date (w/century)
CalCentotCal returns a Calendar date

See also Appendix A
date_convert(), ddatetofull(), ddatetoshort(),
ddatetostr(), fulltoddate(), Greg...(), Jul...(),
monthexpand(), shorttoddate(), strtoddate()

Example see demodate.c






















TCHK 2.1 Page 23


Function CapsLock - set the Caps Lock key state

Syntax void InsLock(boolean on);

Prototype in ibm.h

Remarks sets the Caps Lock key state to the state selected
by the on parameter.

Return value nothing.

See also InsLock(), NumLock(), ScrollLock()



















































TCHK 2.1 Page 24


Function CEDadd - add a CED installable command

Syntax boolean CEDadd(char *command, unsigned char mode,
unsigned segment, unsigned offset);

Prototype in doshk.h

Remarks adds a CED installable command. The mode parameter
is a bit mask with the following settings:

bit 0 = 1 callable from DOS prompt
bit 1 = 1 callable from application

command should be terminated by a CR.

The segment:offset parameters point to a FAR
routine entry point.

Return value returns TRUE if successful, FALSE otherwise. If
unsuccessful, _doserrno will contain the error
code:

0x01 invalid function
0x08 insufficient memory
0x0E bad data

If CED is not installed, _doserrno & 0xFF00 will
return 0xFF00.

See also CEDremove(), isCEDavail()

































TCHK 2.1 Page 25


Function CEDremove - remove a CED installable command

Syntax boolean CEDremove(char *command);

Prototype in doshk.h

Remarks remove a CED installable command. The command
parameter should be terminated by a CR.

Return value returns TRUE if successful, FALSE otherwise. If
unsuccessful, _doserrno will contain the error
code:

0x01 invalid function
0x02 command not found

If CED is not installed, _doserrno & 0xFF00 will
return 0xFF00.

See also CEDadd(), isCEDavail()











































TCHK 2.1 Page 26


Function center - coordinate to center a message on screen

Syntax int center(char *str);

Prototype in video.h

Remarks center() will determine the proper X-coordinate to
display str centered horizontally with the current
window area. See Borland's explanation of window()
and related topics for further details.

Return value returns X coordinate to display str centered
horizontally within the window() corrdinates.

Example #include

main()
{
char msg[] = "This will be centered on line 3"

gotoxy(center(msg),3);
cputs(msg);
}

Program output

This will be centered on line 3




































TCHK 2.1 Page 27


Function changelitebar - set internal litebar menu
information

Syntax void changelitebar(struct litebar_header *lh,
struct litebar_field *lf)

Prototype in menuhk.h

Remarks sets internal variables for a litebar menu
regarding the currently hilited item.

This function is used internally by several
litebar...() menu functions.

Return value nothing.

Note This function is for internal uses only.

See also menuhk.h
isHiliteable(), litebar_alloc(), litebar_free(),
litebar_get(), litehilite(), litemessage(),
liteunhilite(), menu_litebar()
litebarerrno








































TCHK 2.1 Page 28


Function Checksum_block - calculate checksum for a block

Syntax unsigned char Checksum_block(char *b, int size);

Prototype in comm.h

Remarks calculates a checksum value based on the block
given. A checksum value is commonly used by older
transmission protocols such as Xmodem.

Return value returns a checksum value for the block operated on.

See also CRC16_block(), CRC16tupdate(), CRC16update(),
CRC32tupdate()

















































TCHK 2.1 Page 29


Function clear - clears a portion of the screen

Syntax void clear(int left, int top, int right,
int bottom);

Prototype in video.h

Remarks clears a box of the screen via gotohv() and putk().
All screen coordinates are absolute.

Return value nothing.

See also cls(), gotohv(), putk()

Example #include

main()
{
clear(0,0,79,3); /* clear top 4 lines */
}











































TCHK 2.1 Page 30


Function clear_typeahead - clear typeahead buffer

Syntax int clear_typeahead(void);

Prototype in keyboard.h

Remarks clears the typeahead buffer and returns the number
of keystrokes cleared

Return value number of keystrokes emptied from the typeahead
buffer

Example #include
#include

main()
{
printf("# keystrokes emptied = %d",
clear_typeahead());
}











































TCHK 2.1 Page 31


Function cls - clear screen

Syntax #include
cls();

Prototype in video.h

Remarks clears screen by Borland's clrscr(). I hated their
name for it, so I #defined cls().

Return value nothing.

See also clear()

Example #include

main()
{
cls()
}











































TCHK 2.1 Page 32


Function color - make a single attribute

Syntax #include
color(f,b)

Prototype in video.h

Remarks converts a color for a foreground and background
attribute in foreground format (0-15) to a single
byte.

This function is a macro.

Return value returns an attribute byte of foreground ORed with
the background shifted left 4 bits.
















































TCHK 2.1 Page 33


Function commit - flush disk buffers for to a handle

Syntax boolean commit(int handle);

Prototype in doshk.h

Remarks commit will flush all disk buffers associated with
a handle. If DOS 3.3 or later is active, DOS
Function 0x68 is used. Under pre-DOS 3.3 versions,
the handle is duplicated (DOS Function 0x45) and
subsequently closed (DOS Function 0x3E), flushing
all buffers for that handle.

Return value returns TRUE is successful, FALSE otherwise.

















































TCHK 2.1 Page 34


Function Compaq386GetCpuSpeed - get cpu speed on a
Compaq 386

Syntax unsigned char Compaq386GetCpuSpeed(unsigned int
*speedvalue);

Prototype in ibm.h

Remarks determines the cpu speed of a Compaq 386 computer.
The speed is returned and, if type/category 0x09
(dynamic) the parameter speedvalue will point to
the direct speed value.

Return value returns the cpu speed type/category. See
Compaq386SetCpuSpeed() for the list of
types/categories.

Note This function should ONLY be used on Compaq 386
computers or unpredictable results may occur.

See also Compaq386KbdType(), Compaq386SetCpuSpeed()

Example #include

main()
{
unsigned char speed;
unsigned int directvalue;

speed = Compaq386GetCpuSpeed(&directvalue);
printf("cpu speed = %u\n",speed);
if (directvalue == 0x09)
printf("direct value = %u\n",
directvalue);
}




























TCHK 2.1 Page 35


Function Compaq386KbdType - keyboard type used by a
Compaq 386

Syntax unsigned char Compaq386KbdType(void);

Prototype in ibm.h

Remarks determines the type of keyboard in use by a Compaq
386 computer.

Return value returns 0 if the keyboard in use is an 11-bit AT
type keyboard and 1 if the keyboard is a 9-bit PC
type keyboard.

Note This function should ONLY be used on Compaq 386
computers or unpredictable results may occur.

See also Compaq386GetCpuSpeed(), Compaq386SetCpuSpeed()

Example #include

main()
{

printf("Keyboard in use: );
switch (Compaq386KbdType()) {
case 0: printf("11-bit AT style\n");
case 1: printf("9-bit PC style\n");
default: printf("unknown\n");
}
}
































TCHK 2.1 Page 36


Function Compaq386SetCpuSpeed - set cpu speed on a
Compaq 386

Syntax void Compaq386SetCpuSpeed(unsigned char speed,
unsigned int speedvalue);

Prototype in ibm.h

Remarks sets the cpu speed of a Compaq 386 computer, based
on the following chart:

speed: 0 - equivalent to 6 MHz 80286 (COMMON)
1 - equivalent to 8 MHz 80286 (FAST)
2 - full 16 MHz (HIGH)
3 - toggles between 8 MHz-equivalent
and speed set by system board
switch (AUTO or HIGH)
8 - full 16 MHz except 8 MHz-
-equivalent during floppy disk
access
9 - specify speed directly (via
speedvalue parameter, from 1
(slowest) to 50 (full), 3 ~= 8088
running at 4.77 MHz)

Return value nothing.

Note This function should ONLY be used on Compaq 386
computers or unpredictable results may occur.

See also Compaq386GetCpuSpeed(), Compaq386KbdType()
































TCHK 2.1 Page 37


Function CompaqExternalMonitorType - Get external monitor
type

Syntax unsigned char CompaqExternalMonitorType(void);

Prototype in video.h

Remarks determines the external monitor type on a Compaq
Portable.

Return value returns the external monitor type as follows:

0x00 - none
0x01 - dual-mode monitor
0x02 - 5153 RGB monitor
0x03 - Compaq Color monitor
0x04 - 640x400 flat panel

Note This function should ONLY be used on a Compaq
Portable or unpredictable results may occur.

See also CompaqGetMonitor(), CompaqGetMasterMode(),
CompaqInternalMonitorType(),
CompaqModeSwitchDelay(), CompaqSelectMonitor(),
CompaqSetMasterMode()






































TCHK 2.1 Page 38


Function CompaqGetMasterMode - Get master mode of current
controller

Syntax unsigned char CompaqGetMasterMode(void);

Prototype in video.h

Remarks CompaqGetMasterMode() gets the master mode of the
current controller on a Compaq Portable.

Return value returns the master mode of the current controller
as follows:

0x00 - switchable VDU not present
0x04 - CGA
0x05 - EGA
0x07 - MDA

Note This function should ONLY be used on a Compaq
Portable or unpredictable results may occur.

See also CompaqExternalMonitorType(), CompaqGetMonitor(),
CompaqInternalMonitorType(),
CompaqModeSwitchDelay(), CompaqSelectMonitor(),
CompaqSetMasterMode()






































TCHK 2.1 Page 39


Function CompaqGetMonitor - Get active monitor

Syntax unsigned char CompaqGetMonitor(void);

Prototype in video.h

Remarks CompaqGetMonitor() determines the active monitor on
a Compaq Portable.

Return value returns 0 if the external monitor is active and 1
if the internal monitor is active.

Note This function should ONLY be used on a Compaq
Portable or unpredictable results may occur.

See also CompaqExternalMonitorType(), CompaqGetMasterMode(),
CompaqInternalMonitorType(),
CompaqModeSwitchDelay(), CompaqSelectMonitor(),
CompaqSetMasterMode()












































TCHK 2.1 Page 40


Function CompaqInternalMonitorType - Get internal monitor
type

Syntax unsigned char CompaqInternalMonitorType(void);

Prototype in video.h

Remarks determines the internal monitor type on a Compaq
Portable.

Return value returns the internal monitor type as follows:

0x00 - none
0x01 - dual-mode monitor
0x02 - 5153 RGB monitor
0x03 - Compaq Color monitor
0x04 - 640x400 flat panel

Note This function should ONLY be used on a Compaq
Portable or unpredictable results may occur.

See also CompaqExternalMonitorType(), CompaqGetMonitor(),
CompaqGetMasterMode(), CompaqModeSwitchDelay(),
CompaqSelectMonitor(), CompaqSetMasterMode()







































TCHK 2.1 Page 41


Function CompaqModeSwitchDelay - Set mode switch delay

Syntax void CompaqModeSwitchDelay(boolean enable);

Prototype in video.h

Remarks CompaqModeSwitchDelay() sets the mode switch delay
on a Compaq Portable, based on the value of the
parameter enable.

Return value nothing.

Note This function should ONLY be used on a Compaq
Portable or unpredictable results may occur.

See also CompaqExternalMonitorType(), CompaqGetMasterMode(),
CompaqGetMonitor(), CompaqInternalMonitorType(),
CompaqSelectMonitor(), CompaqSetMasterMode()













































TCHK 2.1 Page 42


Function CompaqSelectMonitor - Select active monitor

Syntax void CompaqSelectMonitor(boolean internal);

Prototype in video.h

Remarks CompaqSelectMonitor() sets the active monitor on a
Compaq Portable to be the internal or external
monitor, based on the value of the parameter
internal.

Return value nothing.

Note This function should ONLY be used on a Compaq
Portable or unpredictable results may occur.

See also CompaqExternalMonitorType(), CompaqGetMonitor(),
CompaqGetMasterMode(), CompaqInternalMonitorType(),
CompaqModeSwitchDelay(), CompaqSetMasterMode()












































TCHK 2.1 Page 43


Function CompaqSetMasterMode - Set master mode of current
controller

Syntax void CompaqSetMasterMode(unsigned char mastermode);

Prototype in video.h

Remarks CompaqSetMasterMode() sets the master mode of the
current controller on a Compaq Portable, based on
the value of the parameter mastermode:

0x04 - CGA
0x05 - EGA
0x07 - MDA

Return value nothing.

Note This function should ONLY be used on a Compaq
Portable or unpredictable results may occur.

See also CompaqExternalMonitorType(), CompaqGetMonitor(),
CompaqGetMasterMode(), CompaqInternalMonitorType(),
CompaqModeSwitchDelay(), CompaqSelectMonitor()








































TCHK 2.1 Page 44


Function cpu_id - identify the cpu

Syntax int cpu_id(void);

Prototype in chiphk.h

Remarks cpu_id does some opcode magic to identify the cpu.
Currently identified chips are the 8088/8086,
80286, 80386 and the NEV V20/V30.

Return value returns a value identifying the cpu. See chiphk.h
for further details.

Note Other (not 88/86, 286, 386 or V20/V30) chips will
not be identified correctly, and will probably be
interpreted as an NEC cpu.

See also machine_id(), ndp_id()













































TCHK 2.1 Page 45


Function CRC16_block - calculate CRC-16 for a block

Syntax unsigned CRC16_block(char *b, int size);

Prototype in comm.h

Remarks calculates a CRC-16 value based on the polynomial
X^16 + X^15 + X^2 + 1. The CRC-16 value is commonly
used by transmission protocols such as Xmodem and
Ymodem.

CRC16_block() will calculate the CRC-16 value for a
given block of bytes.

Return value returns a CRC-16 value for the block operated on.

Note There are two common flavors of 16 bit CRCs, the
CRC-16 used by transmission protocols and a
CRC-CCIT based on a different polynomial. The two
are NOT compatible. I believe the CRC used in .ARC
files is of the CRC-16 variety, but will not swear
by it until I have verification. The CRC-16 value
calculated by TCHK is in proper bit order for use
in transfer protocols.

See also Checksum_block(), CRC16tupdate(), CRC16update(),
CRC32tupdate()




































TCHK 2.1 Page 46


Function CRC16tupdate - update a CRC-16 value via tables

Syntax unsigned CRC16tupdate(char c, unsigned crc);

Prototype in comm.h

Remarks updates a CRC-16 value based on the polynomial
X^16 + X^15 + X^2 + 1 given c and the original crc
value. The CRC-16 value is commonly used by
transmission protocols such as Xmodem and Ymodem.

This function is table driven.

Return value returns an updated CRC-16 value.

Note There are two common flavors of 16 bit CRCs, the
CRC-16 used by transmission protocols and a
CRC-CCIT based on a different polynomial. The two
are NOT compatible. I believe the CRC used in .ARC
files is of the CRC-16 variety, but will not swear
by it until I have verification. The CRC-16 value
calculated by TCHK is in proper bit order for use
in transfer protocols.

See also Checksum_block(), CRC16_block(), CRC16update(),
CRC32tupdate()





































TCHK 2.1 Page 47


Function CRC16update - update a CRC-16 value

Syntax unsigned CRC16update(char c, unsigned crc);

Prototype in comm.h

Remarks updates a CRC-16 value based on the polynomial
X^16 + X^15 + X^2 + 1 given c and the original crc
value. The CRC-16 value is commonly used by
transmission protocols such as Xmodem and Ymodem.

This function does all calculations on the fly.

Return value returns an updated CRC-16 value.

Note There are two common flavors of 16 bit CRCs, the
CRC-16 used by transmission protocols and a
CRC-CCIT based on a different polynomial. The two
are NOT compatible. I believe the CRC used in .ARC
files is of the CRC-16 variety, but will not swear
by it until I have verification. The CRC-16 value
calculated by TCHK is in proper bit order for use
in transfer protocols.

See also Checksum_block(), CRC16_block(), CRC16tupdate(),
CRC32tupdate()





































TCHK 2.1 Page 48


Function CRC32tupdate - update a CRC-32 value via tables

Syntax unsigned long CRC32tupdate(char c,
unsigned long crc);

Prototype in comm.h

Remarks updates a CRC-32 value based on the polynomial
X^32 + X^26 + X^23 + X^22 + X^16 + X^12 + X^11 +
X^10 + X^8 + X^7 + X^5 + X^4 + X^2 + X^1 + X^0
given c and the original crc value. This CRC-32
value is commonly used by the transmission protocol
Zmodem.

This function is table driven.

Before the first call to this function, be sure to
initialize crc to 0xFFFFFFFF.

Return value returns an updated CRC-32 value.

Note This function is designed for data communications
and returns the crc bytes in LOW to HIGH order, NOT
byte reversed! To turn the value into a 'normal'
unsigned long, you must reverse the bytes! Here is
a code fragment to reverse the bytes:

int i;
unsigned long normal;

/* get crc value */

for (normal=0lu, i=0; i<4; i++) {
normal << 8;
normal |= (crc & 0x000000FF)
crc >>= 8;
}

ZIP files, designed by Phil Katz, use a CRC-32,
although I believe the CRC-32 used is 'normalized'
and not byte reversed as returned by this function.

See also Checksum_block(), CRC16_block(), CRC16update(),
CRC16tupdate()



















TCHK 2.1 Page 49


Function cursor_blink - set speed of cursor blink

Syntax void cursor_blink(boolean fast);

Prototype in video.h

Remarks this function will make the cursor blink fast if
fast is TRUE, or slow if fast is FALSE.

Return value nothing.

See also cursor_flip(), cursor_off(), cursor_on(),
getcursor(), getcursor(), read_cursor(),
set_cursor(), setcursor()

















































TCHK 2.1 Page 50


Function cursor_flip - toggle the cursor type

Syntax void cursor_flip(unsigned int curs1,
unsigned int curs2);

Prototype in video.h

Remarks toggles the cursor scan lines to whichever set the
cursor is not currently set for.

Return value nothing.

See also cursor_blink(), cursor_off(), cursor_on(),
getcursor(), read_cursor(), set_cursor(),
setcursor()

Example #include

main()
{
cursor_flip(CURSOR_UNDERBAR,CURSOR_HALFBLOCK);
}









































TCHK 2.1 Page 51


Function cursor_off - turn the cursor off

Syntax void cursor_off(void);

Prototype in video.h

Remarks makes the cursor invisible.

Return value nothing.

See also cursor_blink(), cursor_flip(), cursor_on(),
getcursor(), read_cursor(), set_cursor(),
setcursor()


















































TCHK 2.1 Page 52


Function cursor_on - turn the cursor on

Syntax void cursor_on(void);

Prototype in video.h

Remarks makes the cursor visible.

Return value nothing.

See also cursor_blink(), cursor_flip(), cursor_off(),
getcursor(), read_cursor(), set_cursor(),
setcursor()


















































TCHK 2.1 Page 53


Function date_convert - convert date formats

Syntax boolean date_convert(void *source, void *dest,
int stype, int dtype);

Prototype in dateadv.h

Remarks date_convert will convert a date from virtually any
date format to any other. The parameters *source
and *dest must be pointers pointing to a piece of
memory allocated as the proper data type. stype and
dtype determine the format of source and dest.

Due to the great number of formats supported, a
chart of valid date formats is provided in Appendix
B.

Limited error checking is done on passed data. If
an invalid date format is passed, unpredictable
results will occur.

Return value returns TRUE is the conversion was successful and
FALSE if the date could not be converted.

Note This function does NO function calls except for
isleapyear(). I've tried to optimize this function
as much as possible for speed, not size. If you
only need to convert between, say, Calendar and
Julian dates, you may be better off using the
functions listed in datehk.h.

See also Appendix A, B
Cal...(), ddatetofull(), ddatetoshort(),
ddatetostr(), fulltoddate(), Greg...(), Jul...(),
monthexpand(), shorttoddate(), strtoddate()

Example see demoadv.c


























TCHK 2.1 Page 54


Function dayofweek - find the day of the week

Syntax int dayofweek(double jul);

Prototype in datehk.h

Remarks finds the day of the week for a given Julian
(Type E) date

Return value returns 0-6 (Sun...Sat)

See also Appendix A
datehk.h

Example see demodate.c
















































TCHK 2.1 Page 55


Function dayofyear - calculate the day of the year

Syntax int dayofyear(struct ddate *d);

Prototype in datehk.h

Remarks dayofyear calculate the day of the year given a
date. The day of the year will range from 1
(January 1) to 365 (Dec 31, no leap year) or 366
(Dec 31, leap year.)

dayofyear does no error checking on passed
parameters.

Return value returns a number from 1 to 365 (no leap year) or
366 (leap year.)

See also dayofweek(), daysleft(), diffddate()

Example #include

main()
{
struct ddate today;

/* set today to Feb 3, 1987 */
printf("%d/%d = day %d\n", today.dmon,
today.dday, dayofyear(&today));
}

Program output 2/3 = day 34
































TCHK 2.1 Page 56


Function daysleft - calculate the days left in the year

Syntax int daysleft(struct ddate *d);

Prototype in datehk.h

Remarks daysleft calculates how many more days are left in
the year. The days left will range from 0 (Dec 31)
to 364 (Jan 1, no leap year) or 365 (Jan 1, leap
year.)


daysleft does no error checking on passed
parameters.

Return value returns a number from 0 to 364 (no leap year) or
365 (leap year.)

See also dayofyear(), diffddate()

Example #include

main()
{
struct ddate today;

/* set today to Nov 3, 1987 */
printf("%d/%d = %d days left\n", today.dmon,
today.dday, daysleft(&today));
}

Program output 11/3 = 58 days left
































TCHK 2.1 Page 57


Function ddatetofull - convert a date to full string

Syntax char *ddatetofull(struct ddate *source);

Prototype in datehk.h

Remarks ddatetofull converts a date from the structure
format ddate to a string in the form
Month dd, Year where

Month = the name of the month ("November")
dd = the day (5, 12, etc.)
Year = the year + 1900

Return value returns a pointer to the storage location
containing the date in string format, or NULL if
space could not be allocated.

See also Cal...(), date_convert(), ddatetoshort(),
ddatetostr(), fulltoddate(), Greg...(), Jul...(),
monthexpand(), shorttoddate(), strtoddate()

Example #include

main()
{
struct ddate today;
char *strtoday;

/* assign some value to today */
strtoday = ddatetofull(&today);
printf("today is %d-%d-%d\n", today.dmon,
today.dday, today.dyear);
printf("or %s\n", (strtoday==NULL) ?
"no memory" : strtoday);
}



























TCHK 2.1 Page 58


Function ddatetoshort - convert a date to short string

Syntax char *ddatetoshort(struct ddate *source);

Prototype in datehk.h

Remarks ddatetoshort converts a date from the structure
format ddate to a string in the form
Mon dd, Year where

Mon = the abbreviation of the month ("Nov")
dd = the day (5, 12, etc.)
Year = the year + 1900

Return value returns a pointer to the storage location
containing the date in string format, or NULL if
space could not be allocated.

See also Cal...(), date_convert(), ddatetofull(),
ddatetostr(), fulltoddate(), Greg...(), Jul...(),
monthexpand(), shorttoddate(), strtoddate()

Example #include

main()
{
struct ddate today;
char *strtoday;

/* assign some value to today */
strtoday = ddatetoshort(&today);
printf("today is %d-%d-%d\n", today.dmon,
today.dday, today.dyear);
printf("or %s\n", (strtoday==NULL) ?
"no memory" : strtoday);
}



























TCHK 2.1 Page 59


Function ddatetostr - convert a date to abbrev. string

Syntax char *ddatetostr(struct ddate *source);

Prototype in datehk.h

Remarks ddatetostr converts a date from the structure
format ddate to a string in the form mm-dd-y..y
where the month and day are always 2 digits long (a
0 is prefixed to single digit months and days) and
year is not altered.

Return value returns a pointer to the storage location
containing the date in string format, or NULL if
space could not be allocated.

See also Cal...(), date_convert(), ddatetofull(),
ddatetoshort(), ddatetostr(), fulltoddate(),
Greg...(), Jul...(), monthexpand(), shorttoddate(),
strtoddate()

Example #include

main()
{
struct ddate today;
char *strtoday;

/* assign some value to today */
strtoday = ddatetostr(&today);
printf("today is %d-%d-%d\n", today.dmon,
today.dday, today.dyear);
printf("or %s\n", (strtoday==NULL) ?
"no memory" : strtoday);
}




























TCHK 2.1 Page 60


Function depreciation - calculate depreciation for a
period

Syntax double depreciation(double cost, double salvage,
int life, int period, int
dtype);

Prototype in finance.h

Remarks given the cost, salvage value and life of an item,
depreciation will calculate the amount of
deprecitation for the given period according to the
depreciation method specified by dtype. The cost
and salvage can be given in any unit (dollars,
thousands of dollars, etc.) but the life should be
given in depreciable periods (if you depreciate an
item every quarter, and the item has a life of 2
years, then life should be 8).

The cost and salvage values should be in the same
units. The life and period should be given in the
same units.

Types of depreciation supported by the variable
dtype are:

1 - Straight line depreciation
2 - Sum of the years digits depreciation
3 - Double declining balance depreciation

Any other value for dtype will produce
unpredictable results.

No error checking is performed.

This is a generic function to calculate the
depreciation given all necessary information. Any
unnecessary information is ignored (i.e. straight
line depreciation does not need a period.)

Return value returns the amount of depreciation for the given
period in the same units as the cost, as per the
depreciation method specified by dtype.

See also accum_dep(), double_decline_bal_dep(),
straight_line_dep(), sum_year_digits_dep()

Example see demonum.c















TCHK 2.1 Page 61


Function DESQapilevel - define minimum API level required

Syntax unsigned int DESQapilevel(unsigned char major,
unsigned char minor);

Prototype in multihk.h

Remarks defines the minimum API level required. If the
requested API level is greater than the version of
DESQview, a "You need a newer version" error window
is popped up.

Return value returns the maximum API level, with the major
version number in the low order byte and the minor
version number in the high order byte.

See also DESQversion()














































TCHK 2.1 Page 62


Function DESQappnum - DESQview program number

Syntax unsigned DESQappnum(void);

Prototype in multihk.h

Remarks determines the program number as it appears on the
"Switch Windows" menu.

Return value returns the program number as it appears on the
"Switch Windows" menu.




















































TCHK 2.1 Page 63


Function DESQbeginc - begin critical section

Syntax void DESQbeginc(void);

Prototype in multihk.h

Remarks used in conjunction with DESQendc(), this function
signals the beginning of a critical piece of code
that should not be interrupted. DESQview will NOT
multitask during critical sections of code. A
common instance of critical code is an interrupt
handler.

Return value nothing.

Note Make sure that you end all critical sections of
code with DESQendc() or DESQview will not switch to
other tasks.

See also DESQendc()











































TCHK 2.1 Page 64


Function DESQcommonmem - returns measure of common memory
available

Syntax void DESQcommonmem(struct DESQmemory *dm);

Prototype in multihk.h

Remarks determines the amount of available common memory
under DESQview. No error checking is performed.

DESQcommonmem returns the amount of available
common memory in dm. The values returned are in
bytes.

Return value nothing.

See also DESQconvenmem(), DESQexpandedmem()














































TCHK 2.1 Page 65


Function DESQconvenmem - returns measure of conventional
memory available

Syntax void DESQconvenmem(struct DESQmemory *dm);

Prototype in multihk.h

Remarks determines the amount of available conventional
memory under DESQview. No error checking is
performed.

DESQconvenmem returns the amount of available
conventional memory in dm. The values returned are
in Kbytes.

Return value nothing.

See also DESQcommonmem(), DESQexpandedmem()













































TCHK 2.1 Page 66


Function DESQdisperror - popup a DESQview error window

Syntax unsigned DESQdisperror(char *msg,
unsigned char width,
unsigned char height,
unsigned segment,
unsigned flags);

Prototype in multihk.h

Remarks DESQdisperror() will popup an error window under
DESQview, displaying the string msg. The message
must be less than 4K (<4096 bytes) in size. The
window will be of size width by height. If either
or both values are zero, the default values will be
used. The segment is segment of the object handle,
and the flags is a bit field with the following
important values:

bits 13,14: which mouse button will remove
the window
00 or 11 = either
01 = left
10 = right
bit 15: beep when displayed

For your convenience, DVERROR_LEFT, DVERROR_RIGHT,
DVERROR_EITHER and DVERROR_BEEP have been #defined
in multihk.h.

Return value returns 1 if the left mouse button was pressed, 2
if the right mouse button was pressed and 27 if ESC
was pressed.






























TCHK 2.1 Page 67


Function DESQendc - end critical section

Syntax void DESQendc(void);

Prototype in multihk.h

Remarks used in conjunction with DESQbeginc(), this
function signals the end of a critical piece of
code that should not be interrupted. DESQview will
NOT multitask during critical sections of code. A
common instance of critical code is an interrupt
handler.

Return value nothing.

Note Make sure that you end all critical sections of
code with DESQendc() or DESQview will not switch to
other tasks.

See also DESQbeginc()











































TCHK 2.1 Page 68


Function DESQexit - exit program in DESQview

Syntax void DESQexit(void);

Prototype in multihk.h

Remarks exits the current program under DESQview (and
possibly Topview). No error checking is performed.

Return value nothing.





















































TCHK 2.1 Page 69


Function DESQexpandedmem - returns measure of expanded
memory available

Syntax void DESQexpanded(struct DESQmemory *dm);

Prototype in multihk.h

Remarks determines the amount of available expanded memory
under DESQview. No error checking is performed.

DESQexpandedmed returns the amount of available
expanded memory in dm. The values returned are in
Kbytes.

Return value nothing.

See also DESQcommonmem(), DESQconvenmem()














































TCHK 2.1 Page 70


Function DESQgetbuf - get DESQview virtual screen info

Syntax char far *DESQgetbuf(unsigned segment,
unsigned *size);

Prototype in multihk.h

Remarks this function will return a far pointer to the
virtual screen buffer for the window specified by
segment, where segment is the segment of the object
handle for the window. If segment is zero, the
default will be used. The size parameter will be
used to return the size of the virtual screen in
bytes.

Return value returns a far pointer to the virtual screen for the
specified window.














































TCHK 2.1 Page 71


Function DESQgetmem - allocate DESQview "system" memory

Syntax char far *DESQgetmem(size_t size);

Prototype in multihk.h

Remarks allocates a piece of DESQview "system" (common)
memory of size bytes.

Return value returns a far pointer to the memory allocated.

Note When freeing DESQview system memory, be sure to use
DESQputmem() and not free().

See also DESQputmem()
















































TCHK 2.1 Page 72


Function DESQiskmouse - is mouse emulated via keyboard

Syntax boolean DESQiskmouse(void);

Prototype in multihk.h

Remarks determines if the keyboard is being used to emulate
a mouse under DESQview.

Return value returns TRUE if the keyboard is being used to
emulate a mouse, FALSE otherwise.

See also DESQkmouse_off(), DESQkmouse_on()


















































TCHK 2.1 Page 73


Function DESQjustify - set automatic window justification

Syntax void DESQjustify(boolean enable);

Prototype in multihk.h

Remarks sets the automatic window justification for the
current window. If enable is TRUE, the window's
contents will change to keep the cursor visible at
all times. If enable is FALSE, the window's
contents will not change automatically, so the
cursor may disappear from view.

Return value nothing.

















































TCHK 2.1 Page 74


Function DESQkmouse_off - disable keyboard mouse emulation

Syntax void DESQkmouse_off(void);

Prototype in multihk.h

Remarks disables keyboard emulation of a mouse under
DESQview.

Return value nothing.

See also DESQiskmouse(), DESQkmouse_on()



















































TCHK 2.1 Page 75


Function DESQkmouse_on - enable keyboard mouse emulation

Syntax void DESQkmouse_on(void);

Prototype in multihk.h

Remarks enables keyboard emulation of a mouse under
DESQview.

Return value nothing.

See also DESQiskmouse(), DESQkmouse_off()



















































TCHK 2.1 Page 76


Function DESQostack - switch to DESQview's internal stack

Syntax void DESQostack(void);

Prototype in multihk.h

Remarks switches the stack used to DESQview's internal
stack. No error checking is performed.

Return value nothing.

See also DESQustack()



















































TCHK 2.1 Page 77


Function DESQpause - give up CPU time

Syntax void DESQpause(void);

Prototype in multihk.h

Remarks this function will free the remaining CPU cycles
under DESQview, Topview and Taskview. I have tested
this function only under DESQview, where it frees
the program's time slice. If your program will just
sit idle and chew up CPU time, calling this
function frees whatever remains of its cpu share.

No error checking is performed.

Return value nothing.

See also DESQposttask(), DESQstart(), DESQstop()

Example ... /* code fragment */
while (bioskey(1) == 0) /* wait for keypress */
DESQpause(); /* w/o wasting cpu time */
...








































TCHK 2.1 Page 78


Function DESQpoke - displays a char on the status line

Syntax char DESQpoke(char c);

Prototype in multihk.h

Remarks displays a character on the status line. No error
checking is performed.

Return value DESQpoke returns the .

See also DESQdisperror()



















































TCHK 2.1 Page 79


Function DESQposttask - awaken DESQview task

Syntax void DESQposttask(unsigned segment);

Prototype in multihk.h

Remarks awakens a DESQview task given the segment of its
object handle.

Return value nothing.

See also DESQpause(), DESQstart(), DESQstop()



















































TCHK 2.1 Page 80


Function DESQpushkey - put key into keyboard input stream

Syntax void DESQpushkey(unsigned scancode);

Prototype in multihk.h

Remarks puts the scancode given into the keyboard input
stream. The scancode given should be the scan code
as returned by the BIOS.

Return value nothing.




















































TCHK 2.1 Page 81


Function DESQputmem - deallocate DESQview "system" memory

Syntax void DESQputmem(char far *block);

Prototype in multihk.h

Remarks deallocates a piece of DESQview "system" (common)
previously allocated via DESQgetmem().

Return value nothing.

Note When freeing DESQview system memory, be sure to use
DESQputmem() and not free().

See also DESQgetmem()
















































TCHK 2.1 Page 82


Function DESQsound - makes a tone under DESQview

Syntax void DESQsound(int frequency, int duration);

Prototype in multihk.h

Remarks DESQsound will generate a tone of frequency in Hz
for duration clock ticks (approximately 18.2
ticks/sec). No error checking is performed.

Return value nothing.




















































TCHK 2.1 Page 83


Function DESQstart - start (unFreeze) a task

Syntax void DESQstart(unsigned segment);

Prototype in multihk.h

Remarks DESQstart() will continue the task given the
segment of its object handle. This is equivalent to
unFreezing a program.

Return value nothing.

See also DESQpause(), DESQposttask(), DESQstop()


















































TCHK 2.1 Page 84


Function DESQstop - stop (Freeze) the current task

Syntax void DESQstop(unsigned segment);

Prototype in multihk.h

Remarks DESQstop() will stop the task given the segment of
its object handle. This is equivalent to Freezing a
program.

Return value nothing.

Note under DESQview 2.00, this function is ignored
unless the task indicated is the current task
(segment == handle of main window for task)

See also DESQpause(), DESQposttask(), DESQstart()














































TCHK 2.1 Page 85


Function DESQustack - switch back to program's stack

Syntax void DESQustack(void);

Prototype in multihk.h

Remarks switches the stack from DESQview's internal stack
back to the program's stack. No error checking is
performed.

Return value nothing.

See also DESQostack()


















































TCHK 2.1 Page 86


Function DESQversion - DESQview version

Syntax int DESQversion(void);

Prototype in multihk.h

Remarks determines if DESQview is running and gets the
version number

Return value returns zero if DESQview is not running, otherwise
returns the version number with the major version
number in the high order byte and the minor version
number in the low order byte.

Note Now that I've gotten this function to work properly
for DESQview, I do not guarrantee it's accuracy
with regards to Topview or Taskview. If someone out
there with access to either could test it out and
let me know I'd appreciate it.

See also DESQapilevel()

Example #include

main()
{
unsigned int ver;

if ((ver = DESQversion()) == 0)
printf("DESQview is not running\n");
else
printf("DESQview version %d.%2d\n",
(ver&0xFF00)>>8, ver&0x00FF);
}





























TCHK 2.1 Page 87


Function diffddate - calculate the difference in 2 dates

Syntax long int diffddate(struct ddate *start,
struct ddate *fini);

Prototype in datehk.h

Remarks diffdate calculates the difference in days between
start and fini (fini - start).

diffdate does not perform any error checking on the
passed parameters.

Return value returns the number of days from start to fini.

See also dayofyear(), daysleft(), diffddate()

Example #include

main()
{
struct ddate begin, end;
long int days;

/* set begin to Jan 1, 1981 */
/* set end to Feb 5, 1982 */
days = diffdate(&begin,&end);
printf("Feb 5, 1982 - Jan 1, 1981 =
%ld\n",days);
}

Program output Feb 5, 1982 - Jan 1, 1981 = 400































TCHK 2.1 Page 88


Function diskchanged - has the disk has been changed

Syntax boolean diskchanged(int drive);

Prototype in ibm.h

Remarks diskchanged determines if the disk has been changed
since the last access via INT 0x13, Function 0x16.
The drive parameter corresponds to the drive
letter, 0 = A:, 1 = B:, etc.

Return value returns TRUE if the disk has been changd since the
last access and FALSE otherwise.

Note This function valid only on AT, XT2, XT286,
Convertible and PS/2.

See also disktype()













































TCHK 2.1 Page 89


Function disktype - identify disk type

Syntax byte disktype(byte drive);

Prototype in ibm.h

Remarks disktype will determine the type of disk in the
disk drive being tested. drive specifies the drive
to check. Set drive to zero to specify the default
drive, one is A:, two is B:, etc.

Return value returns the drive id byte. See ibm.h for more
details.

See also diskchanged()

Example see demodisk.c














































TCHK 2.1 Page 90


Function dosday - extract day from file date stamp

Syntax #include
(unsigned) dosday(d)

Prototype in doshk.h

Remarks extracts the day from a DOS file date stamp. Refer
to a DOS reference book (Advanced MS-DOS by Ray
Duncan recommended) for further details.

This function is a macro.

Return value returns the day of a DOS file date stamp.

See also doshour(), dosmonth(), dosmin(), dossec(),
dosyear(), todosdate(), todostime()














































TCHK 2.1 Page 91


Function doshour - extract hour from file time stamp

Syntax #include
(unsigned) doshour(h)

Prototype in doshk.h

Remarks extracts the hour from a DOS file time stamp. Refer
to a DOS reference book (Advanced MS-DOS by Ray
Duncan recommended) for further details.

This function is a macro.

Return value returns the hour of a DOS file time stamp.

See also dosday(), dosmonth(), dosmin(), dossec(),
dosyear(), todosdate(), todostime()














































TCHK 2.1 Page 92


Function dosmonth - extract hour from file date stamp

Syntax #include
(unsigned) dosmonth(m)

Prototype in doshk.h

Remarks extracts the month from a DOS file date stamp.
Refer to a DOS reference book (Advanced MS-DOS by
Ray Duncan recommended) for further details.

This function is a macro.

Return value returns the hour of a DOS file date stamp.

See also dosday(), doshour(), dosmin(), dossec(), dosyear(),
todosdate(), todostime()














































TCHK 2.1 Page 93


Function dosmin - extract minutes from file time stamp

Syntax #include
(unsigned) dosmin(m)

Prototype in doshk.h

Remarks extracts the minutes from a DOS file time stamp.
Refer to a DOS reference book (Advanced MS-DOS by
Ray Duncan recommended) for further details.

This function is a macro.

Return value returns the minutes of a DOS file time stamp.

See also dosday(), doshour(), dosmonth(), dossec(),
dosyear(), todosdate(), todostime()














































TCHK 2.1 Page 94


Function dossec - extract seconds from file time stamp

Syntax #include
(unsigned) dossec(s)

Prototype in doshk.h

Remarks extracts the seconds from a DOS file time stamp.
Refer to a DOS reference book (Advanced MS-DOS by
Ray Duncan recommended) for further details.

This function is a macro.

Return value returns the hour of a DOS file time stamp.

See also dosday(), doshour(), dosmonth(), dosmin(),
dosyear(), todosdate(), todostime()














































TCHK 2.1 Page 95


Function dostimetolong - convert DOS time to 1/100 seconds

Syntax long dostimetolong(struct time *t);

Prototype in timehk.h

Remarks this function will convert the time from a DOS time
structure to a long value of the time in 1/100s of
a second.

Return value returns the time as a count of 1/100 secs since
midnight, ranging from 0 (midnight) to 8639999
(11:59:59.99 PM).

See also longtodostime()
















































TCHK 2.1 Page 96


Function dosyear - extract year from file date stamp

Syntax #include
(unsigned) dosyear(y)

Prototype in doshk.h

Remarks extracts the year from a DOS file date stamp. Refer
to a DOS reference book (Advanced MS-DOS by Ray
Duncan recommended) for further details.

This function is a macro.

Return value returns the year of a DOS file date stamp.

See also dosday(), doshour(), dosmonth(), dosmin(),
dossec(), todosdate(), todostime()














































TCHK 2.1 Page 97


Function double_decline_bal_dep - calculate double
declining balance
depreciation

Syntax double double_decline_bal_dep(double cost, int
life, int period);

Prototype in finance.h

Remarks given the cost and life of an item,
double_decline_bal_dep will calculate the amount of
deprecitation for the given period according to the
double declining balance depreciation method. The
cost can be given in any unit (dollars, thousands
of dollars, etc.) but the life should be given in
depreciable periods (if you depreciate an item
every quarter, and the item has a life of 2 years,
then life should be 8).

The life and period should be given in the same
units.

No error checking is performed.

Return value returns the amount of depreciation for the given
period in the same units as the cost, as per the
double declining balance depreciation method.

Note The macro DDB(c,l,p) is defined in finance.h for
ease of use.

See also accum_dep(), depreciation(), straight_line_dep(),
sum_year_digits_dep()

Example see demonum.c




























TCHK 2.1 Page 98


Function DoubleDOSfreeCPU - give up CPU time under
Double DOS

Syntax void DoubleDOSfreeCPU(byte slices);

Prototype in multihk.h

Remarks DoubleDOSfreeCPU frees up CPU time from the current
program. The amount of time freed up is found by
slices * 55ms.

Return value nothing.

See also DoubleDOSGetVirtual(), DoubleDOSTaskSwitch(),
isDoubleDOS(), isInvisible()

Example #include

main()
{
DoubleDOSfreeCPU(1000); /* frees 55 secs */
}









































TCHK 2.1 Page 99


Function DoubleDOSGetVirtual - get DoubleDOS virtual
screen address

Syntax unsigned int DoubleDOSGetVirtual(void);

Prototype in multihk.h

Remarks determines and returns the segment of the virtual
screen address for the current task.

Return value DoubleDOSGetVirtual returns the segment of the
virtual screen address

See also DoubleDOSfreeCPU(), DoubleDOSTaskSwitch(),
isDoubleDOS(), isInvisible()
















































TCHK 2.1 Page 100


Function DoubleDOSTaskSwitch - set Double DOS task
switching on/off

Syntax void DoubleDOSTaskSwitch(boolean on);

Prototype in multihk.h

Remarks sets Double DOS task switching on or off.

Return value nothing.

See also DoubleDOSfreeCPU(), DoubleDOSGetVirtual(),
isDoubleDOS(), isInvisible()

Example #include

#define ENABLE TRUE

main()
{
DoubleDOSTaskSwitch(ENABLE);
}









































TCHK 2.1 Page 101


Function EMMversion - version of Expanded Memory Manager

Syntax boolean EMMversion(byte *version);

Prototype in ibm.h

Remarks determines the version of the Expanded Memory
Manager. No memory is allocated.

Return value returns TRUE if successful (and *version is the
version id,) FALSE if an error occurred (and
*version is the error code.)

Note this function is available under EMM 3.2 specs.

See also ibm.h
EMSGetStatus(), isEMSavail(), ESMinfo(),
EMSpages(), EMSwarmbootprep()

Example #include

main()
{
byte ver;

if (isEMSavail())
if (EMMversion(&ver)) /* success */
printf("EMM version id %X\n",ver);
else /* error */
printf("EMM error code %X\n",ver);
}
































TCHK 2.1 Page 102


Function EMSGetStatus - get Expanded Memory status

Syntax byte EMSGetStatus(void);

Prototype in ibm.h

Remarks EMSGetStatus tests whether the expanded memory
hardware is functional. This function should only
be made after it has been established that EMS is
available and the EMM is ready (via isEMSavail()).
This is not a substitute to determine if EMS is
available.

Return value returns the EMM error code. If zero is returned,
the function is successful. If any other value is
returned, an error has occurred.

Note this function is available under EMM 3.2 specs.

See also ibm.h
EMMversion(), EMSinfo(), EMSpages(),
EMSwarmbootprep(), isEMSavail()









































TCHK 2.1 Page 103


Function EMSinfo - determines EMM version and EMS pages

Syntax boolean EMSinfo(struct EMSrecord *ems);

Prototype in ibm.h

Remarks if EMS is available, EMSinfo() determines the EMM
version number and the total and available pages.
This information is saved in the ems structure
passed to EMSinfo().

This function is similar to isEMSavail() and
EMSpages()

Return value returns TRUE if EMS is available and no errors were
encountered. On an error, FALSE is returned and
ems->emserror will contain the error code.

Note this function is available under EMM 3.2 specs.

See also ibm.h
EMMversion(), EMSGetStatus(), isEMSavail(),
EMSpages(), EMSwarmbootprep()

Example #include

main()
{
struct EMSrecord ems;

if (EMSinfo(&ems)) {
printf("EMM version id: %X\n",
ems.version);
printf("Total pages: %u\n",
ems.totalpages);
printf("Avail pages: %u\n",
ems.availpages);
} else /* error */
printf("EMM error code %X\n",
ems.emserror);
}






















TCHK 2.1 Page 104


Function EMSpages - determines the total and available
amount of pages of EMS memory

Syntax boolean EMSpages(struct EMSrecord *ems);

Prototype in ibm.h

Remarks EMSpages() determines the total and available
amount of pages of EMS memory. This information is
saved in the ems structure passed to EMSpages().

Return value returns TRUE if no errors were encountered. On an
error, FALSE is returned and ems->emserror will
contain the error code.

Note this function is available under EMM 3.2 specs.

See also ibm.h
EMMversion(), EMSGetStatus(), isEMSavail(),
ESMinfo(), EMSwarmbootprep()











































TCHK 2.1 Page 105


Function EMSwarmbootprep - prepares the EMM for warm boot

Syntax int EMSwarmbootprep(void);

Prototype in ibm.h

Remarks EMSwarmbootprep tells the Expanded Memory Manager
to prepare for a warm boot.

Return value returns the EMM error code. If no errors occurred,
zero is returned. See ibm.h for a list of EMM error
codes.

Note this function is available under EMM 4.0 specs.

See also ibm.h
EMMversion(), EMSGetStatus(), isEMSavail(),
ESMinfo(), EMSpages()













































TCHK 2.1 Page 106


Function endstri - get offset to last char of a string

Syntax #include
(int) endstri(s)

Prototype in stringhk.h

Remarks gets an offset to the last character of a string.

This function is a macro. Strings of length 0 will
produce unpredictable results.

Return value returns an int offset to the last character in the
string s.

See also endstri()















































TCHK 2.1 Page 107


Function endstrp - get pointer to last char of a string

Syntax #include
(char *) endstrp(s)

Prototype in stringhk.h

Remarks gets a pointer to the last character of a string.

This function is a macro. Strings of length 0 will
produce unpredictable results.

Return value returns a pointer to the last character in the
string s.

See also endstri()















































TCHK 2.1 Page 108


Function expandfilespec - expand a filespec into a full
DOS filepathname

Syntax char *expandfilespec(char *filespec, char *dest);

Prototype in filehk.h

Remarks expandfilespec will take a DOS filespec (optional
drive, optional path, optional file name) and
expand it into a full filepathname, consisting of
drive, path and file name. Any information needed
to make a fully explicit filepathname
(d:\path\filename.exe) not provided by filespec
will be retrieved as the current drive and path,
with the filename.ext wildcarded appropriately.

dest must be a pointer to an allocated piece of
memory large enough to hold the full filepathname
(d:\path\filename.ext).

expandfilespec() relies on parsefilename() to break
s into its respective parts (drive, path and
filename.) Thus, any restrictions applying to
parsefilename() also apply to getfilespec().

Return value returns dest.

See also getfilespec(), isdir(), parsefilename(),
parsefnameext()


































TCHK 2.1 Page 109


Function Extendedtotal - total Extended memory installed

Syntax int Extendedtotal(void);

Prototype in ibm.h

Remarks detects the total amount of Extended memory
installed.

Return value returns the total Extended memory installed, in
Kbytes.

Note you should check for the presence of Extended
memory with isExtended() before using this
function. Calling Extendedtotal() when no Extended
memory is present can lead to unpredictable
results.

See also isExtended()

Example #include

main()
{
printf("Total Extended Memory is %dK\n",
Extendedtotal());
}




































TCHK 2.1 Page 110


Function factorial - determines a factorial (n!)

Syntax double factorial(int n);

Prototype in mathhk.h

Remarks factorial returns n! (1*2*3*...*n). Traditionally
seen as a recursive function used to illustrate
recursion, factorial is done with a loop, using no
recursion.

Return value returns n factorial (n! = 1*2*3*...*n). If n <= 1,
factorial returns 1. If the result of n! is larger
than MAXDOUBLE (the largest value a double can
store, defined in Borland's LIMITS.H), factorial
return zero.

See also summation()

Example #include

main()
{
double f;

if ((f = factorial(13)) == 0)
printf("Error computing 13!\n");
else
printf("13! = %15.0lf\n",factorial(13));
}

Program output 13! = 6227020800































TCHK 2.1 Page 111


Function fileexist - does a file exist

Syntax boolean fileexist(char *filename);

Prototype in filehk.h

Remarks checks if a file entry exists. The string filename
should be a standard DOS filename, with optional
drive and/or path. Files with hidden or system
attributes will not be found (searches are done via
findfirst() with 0 as an attribute byte).

Wildcards (*,?) are supported.

This function does not harm the dta. The dta is
modified by this function, but restored before
returning.

Return value returns TRUE if filename exists, FALSE if filename
does not exist. If an error occurs, FALSE will be
returned and Borland's variable errno will contain
the error code.

See also isdir()

Example #include

main()
{
char fname[] = "a:\tchks.lib";

printf("%s is ",fname);
if (! fileexist(fname))
printf("not ");
printf("found\n");
}



























TCHK 2.1 Page 112


Function fname_match - compare filenames w/wildcards

Syntax int fname_match(char *fname1, char *fname2);

Prototype in filehk.h

Remarks compares filename fname1 to fname2 with wildcard
matching (*,?). Case is irrelevant.

Return value return a value

< 0 if fname1 is less than fname2
= 0 if fname1 is the same as fname2
> 0 if fname1 is greater than fname2

Note fname_match() compares strings just like DOS does
(or at least DOS 3.2, the one I work under.) Thus:

"STR*.*" = "str*.*"
"str.d*" = "StR.DZ"
"str" = "str.c"

Very little error checking is done. If an invalid
filename is passed (i.e. more than 12 characters
long) unpredictable results may occur.

See also fncmp()

Example #include

main()
{
char a[12], b[12];
int cmp;

strcpy(a,"stringhk.c");
strcpy(b,"?TRI*");
printf("%s ",a);
if ((cmp = fname_match(a,b)) == 0)
printf("=");
else if (cmp < 0)
printf("<");
else
printf(">");
printf(" %s\n",b);
}

Program output stringhk.c = ?TRI*















TCHK 2.1 Page 113


Function fncmp - compare filenames w/wildcards

Syntax int fncmp(char *fname1, char *fname2);

Prototype in filehk.h

Remarks compares filename fname1 to fname2 with wildcard
matching (*,?). Case is irrelevant.

Return value return a value

< 0 if fname1 is less than fname2
= 0 if fname1 is the same as fname2
> 0 if fname1 is greater than fname2

In fact, if the value returned is 1 or -1, the
compare failed during the filename portion, and if
2 or -2 is returned, the compare failed during the
extension portion.

Note fncmp() compares strings just like DOS does (or at
least DOS 3.2, the one I work under.) Thus:

"STR*.*" = "str*.*"
"str.d*" = "StR.DZ"
"str" = "str.c"

Very little error checking is done. If an invalid
filename is passed (i.e. more than 12 characters
long) unpredictable results may occur.

See also fname_match()

Example #include

main()
{
char a[12], b[12];
int cmp;

strcpy(a,"stringhk.c");
strcpy(b,"?TRI*.cc");
printf("%s ",a);
cmp = fncmp(a,b);
printf("Compare: %s %s Yields: %d\n",
a,b,cmp);
}

Program output Compare: stringhk.c ?TRI*.cc Yields: -2














TCHK 2.1 Page 114


Function frac - round the fractional portion of a real

Syntax double frac(double x);

Prototype in mathhk.h

Remarks frac will return the fractional portion of x.

Return value returns the fractional portion of x.

See also round()

Example #include

main()
{
printf("frac(%lf) = %lf\n",-2.307,
frac(-2.307));

Program output frac(-2.307) = -0.307

Example see demonum.c









































TCHK 2.1 Page 115


Function fsgn - sign of a real

Syntax #include
(int) fsgn(x)

Prototype in mathhk.h

Remarks fsgn will determine the sign of x. Zero is
considered positive.

This function is a macro.

The macro fsign() is defined as fsgn().

Return value returns -1 if x is negative, otherwise 1.

See also isgn(), lsgn()














































TCHK 2.1 Page 116


Function fulltoddate - convert a full date to struct

Syntax struct ddate *fulltoddate(char *source);

Prototype in datehk.h

Remarks fulltoddate converts a date from a full date format
to the structure ddate format

Return value returns a pointer to the storage location
containing the date structure, or NULL if space
could not be allocated.

See also see Appendix A
Cal...(), date_convert(), ddatetofull(),
ddatetoshort(), ddatetostr(), Greg...(), Jul...(),
monthexpand(), shorttoddate(), strtoddate()

Example see demodate.c












































TCHK 2.1 Page 117


Function FV - calculate the Future Value of a single
amount

Syntax double FV(double payment, double interest, int
periods)

Prototype in finance.h

Remarks FV calculates the Future Value of a single amount
given the present value of the principal, the
interest rate per period and the number of periods.

Return value returns the future value of a single amount.

See also FVa(), PMT(), PV(), PVa()
















































TCHK 2.1 Page 118


Function FVa - calculate the Future Value of an annuity

Syntax double FVa(double payment, double interest, int
periods)

Prototype in finance.h

Remarks FVa calculates the Future Value of an annuity given
the amount of each payment, the interest rate per
period and the number of periods.

Return value returns the future value of an annuity.

See also FV(), PMT(), PV(), PVa()

















































TCHK 2.1 Page 119


Function getAssignmemseg - get ASSIGN work area segment

Syntax unsigned getAssignmemseg(void);

Prototype in doshk.h

Remarks gets the segment of the ASSIGN work are.

Return value returns the segment of the ASSIGN work area.

See also isAssignavail()




















































TCHK 2.1 Page 120


Function getBootBlock - get Boot Block

Syntax boolean getBootBlock(int drive, struct BootBlock
*BB)

Prototype in doshk.h

Remarks gets the Boot Block for the disk determined by
drive, where 0=A, 1=B, etc. BB must be a pointer to
an allocated piece of memory.

Return value returns TRUE if successful, otherwise returns FALSE
with the DOS error code in the global variable
errno.

See also getBootBlock4(), getBPB()

Example #include

main()
{
struct BootBlock BB;

if (getBootBlock(0,&BPB))
printf("Got it");
else
printf("Error");
}



































TCHK 2.1 Page 121


Function getBootBlock4 - get Boot Block under DOS 4.x.

Syntax boolean getBootBlock4(int drive, struct BootBlock4
*BB4)

Prototype in doshk.h

Remarks gets the Boot Block for the disk determined by
drive, where 0=A, 1=B, etc. BB must be a pointer to
an allocated piece of memory. This function only
works for DOS versions 4.x and later.

Return value returns TRUE if successful, otherwise returns FALSE
with the DOS error code in the global variable
errno.

See also getBootBlock(), getBPB(), getVolSerialNum()

Example #include

main()
{
struct BootBlock4 BB4;

if (getBootBlock4(0,&BPB4))
printf("Got it");
else
printf("Error");
}


































TCHK 2.1 Page 122


Function getBPB - get Bios Parameter Block

Syntax boolean getBPB(int drive, struct BIOSParmBlock
*BPB);

Prototype in doshk.h

Remarks gets the Bios Parameter Block for the disk
determined by drive, where 0=A, 1=B, etc. BPB must
be a pointer to an allocated piece of memory.

Return value returns TRUE if successful, otherwise returns FALSE
with the DOS error code in the global variable
errno.

See also getBootBlock(), getBootBlock4()

Example #include

main()
{
struct BIOSParmBlock BPB;

if (getBPB(0,&BPB))
printf("Got it");
else
printf("Error");
}



































TCHK 2.1 Page 123


Function getc_match - get specific input, case dependent

Syntax char getc_match(boolean output, char *match);

Prototype in keyboard.h

Remarks getc_match accepts character input (via getk())
until one of the characters in the string match in
entered, case dependent ('a' != 'A'). Extended keys
never match (F10 will never be a match.) If output
= TRUE, the character is echoed to the screen via
putk().

Return value returns the key pressed.

See also getc_match(), getk(), getlogical(), getyn()

Example #include

main()
{
printf("Enter your choice (abcdHJ): ");
getc_match(1,"abcdHJ");
}

Program output Enter your choice (abcdHJ): H





































TCHK 2.1 Page 124


Function getci_match - get specific input, case
independent

Syntax char getci_match(boolean output, char *match);

Prototype in keyboard.h

Remarks getci_match accepts character input (via getk())
until one of the characters in the string match in
entered, case independent ('a' == 'A'). Extended
keys never match (F10 will never be a match.) If
output = TRUE, the character is echoed to the
screen via putch().

Return value returns the key pressed.

See also getc_match(), getk(), getlogical(), getyn()

Example #include

main()
{
printf("Enter your choice (Q, X, F, D): ");
getci_match(1,"QXFD");
}

Program output Enter your choice (Q, X, F, D): f




































TCHK 2.1 Page 125


Function getcursor - gets cursor scan lines

Syntax unsigned int getcursor(void);

Prototype in video.h

Remarks gets the cursor scan lines via INT 0x10, Function
3.

Return value returns the scan lines of the cursor, with the
starting scan line in the high order byte and the
ending scan line in the low order byte.

See also cursor_blink(), cursor_flip(), cursor_off(),
cursor_on(), read_cursor(), set_cursor(),
setcursor()















































TCHK 2.1 Page 126


Function getdatehk - inputs a date from the keyboard

Syntax char *getdatehk(void);

Prototype in keyboard.h

Remarks getdatehk inputs a date from the keyboard in the
form xx-xx-xx. Only digits, space and backspace are
valid input. Input is terminated when the ENTER key
is pressed. Video output is via Borland's console
i/o.

Return value if a valid date is entered, getdatehk returns a
string in the form xx-xx-xx, otherwise NULL is
returned.

Example #include
#include
main()
{
char *c;

printf("What is today's date: ");
if ((c = getdatehk()) != NULL)
printf("Today is %s\n",c);
}

Program output What is today's date: 11-10-87
Today is 11-10-87


































TCHK 2.1 Page 127


Function getdouble - inputs a double from the keyboard

Syntax char *getdouble(void);

Prototype in keyboard.h

Remarks getdouble inputs a double from the keyboard. Only
digits, decimal point, leading sign and backspace
are valid input. Input is terminated when the ENTER
key is pressed. Video output is via Borland's
console i/o.

The maximum length of input is 25.

Return value returns a string of the format [sn] [ddd] [.]
[ddd] where

[sn] = optional sign (+ or -)
[ddd] = optional digits
[.] = optional decimal point

See also getint(), getreal()

Example #include
#include
main()
{
char *c;

printf("Give me a double: ");
c = getdouble();
printf("Your input is %s\n",c);
}

Program output Give me a double: -1289.12003
Your input is -1289.12003



























TCHK 2.1 Page 128


Function getfilespec - get a DIR proper filespec

Syntax char *getfilespec(char *s);

Prototype in filehk.h

Remarks getfilespec parses a string pointed to by s for a
file name. Any drive and path information is
stripped from the string and the filename.ext is
expanded with wildcards, as DIR does internally
(i.e. c:tchk.lib has a filename.ext of tchk.lib amd
c:tchk. has a filenameext of tchk., but c:tchk has
a filename.ext of tchk.*). The original string s is
modified.

getfilespec() relies on parsefilename() to strip
any drive and path information from s. Thus, any
restrictions applying to parsefilename() also apply
to getfilespec().

Return value returns a pointer to s.

See also parsefilename(), parsefnameext(), resolvepath()

Example see demopars.c






































TCHK 2.1 Page 129


Function getfname - get a filename from the keyboard

Syntax int getfname(byte row, byte col, char *returnstr,
char *pattern, int argn, int argk[],
char flags);

Prototype in video.h

Remarks getfname calls getget() asking for input of a
length 12 string, at the coordinates (col,row),
including pattern formatting and optional input
exit keys listed in argk. If memory was allocated
for returnstr, the string pointed to by returnstr
is checked to see if it is a valid DOS filename. A
valid filename must be of the form
[filename] [.] [ext] and does not contain
any of the following:

[ ] ; , . / ? * : " + = - < > \ |

If memory could not be allocated for the string,
returnstr will be set to NULL.

For more info on pattern and argk requirements,
check the stats for getget().

Return value if memory could not be allocated for returnstr or
the string pointed to by returnstr is not a valid
filename, -1 is returned, otherwise the key used to
exit the input is returned.

See also getget()

Example #include
#include

main()
{
char *fname;
int keys[2]={ESC,F10}; /* ESC & F10 exit
input */

gotoxy(0,0);
printf("Enter file: ");
if (getfname(0,13,fname,"!",2,keys) == -1)
printf(" BAD FILENAME");
else
printf(" valid filename");
}

Program output












TCHK 2.1 Page 130


Function getget - get a string from the keyboard w/editing

Syntax int getget(int col, int row, char *returnstr,
int size, char *pattern, int argn,
int argk[], unsigned flags);

Prototype in keyboard.h

Remarks getget inputs a string at coordinates (col,row), of
maximum length size, formatted according to
pattern. Input ends when ENTER or one of the scan
codes specified in argk[] in inputted. There are
argn number of elements in argk[]. The string is
returned in returnstr and the function returns the
key code of the exiting key.

Full feature editing of the string includes:

Enter Ends input, exits function
Backspace normal backspace
Insert toggle inset/overwrite mode
Delete delete character under cursor
Left Arrow move cursor back 1 character
Right Arrow move cursor forward 1 character
Home move cursor to beginning of
string
End move cursor to end of string
Ctrl-Y delete entire string
Alt-Y delete string from cursor to
end
Ctrl-Right move cursor to beginning of
next word
Ctrl-Left move cursor to beginning of
previous word
Alt-U undo editing - restore initial
string

Here are the valid patterns:

pattern format
------- ------
Types a Alphabetic
A Alphabetic and capitalized
D or d Date
f DOS Filename
F DOS Filename and capitalized
h Hexadecimal
H Hexadecimal and capitalized
n Alphanumeric
N Alphanumeric and capitalized
p DOS Pathname
P DOS Pathname and capitalized
X Ascii (default)










TCHK 2.1 Page 131

9 Numeric
# Numeric and punctuation

Modifiers ! convert to upper case
. punctuation

The flags modifier is a bit field of flags, as
follows:

xxxxxxxx UDJJBLRI where

U = call _idle_get() after keyboard input
D = free time slices under DESQview
JJ = Justify (left, right, center)
B = Bell
L = trim Left side on exit
R = trim Right side on exit
I = start edit in Insert mode (as opposed
to Overwrite mode)

Input is done via the inkeydv() function if the
DESQview free time slices flag is set, otherwise
inkey().

After input is polled, if the user defined function
flag is set (UDFIDLE) the function _idle_get is
called. Currently, the definition of _idle_get is:

int _idle_get(void)

Possible uses for such a function is an onscreen
clock, printing, or some other background task. In
the future _idle_get() will receive releveant
parameters from getget(). To define _idle_get as
the user defined function int myfunction(void),
try:

_idle_get = (far *)myfunction;

The full definition for _idle_get() is:

int (far *_idle_get)(void);

You should declare myfunction() as type int, with
void parameters, and you should typecast the
function as a far pointer when you assign it to
_idle_get.

Cursor sizes are determined via the global
variables _cursorinsert and _cursoroverwrite.

Video output is via Borland's console i/o.












TCHK 2.1 Page 132

Return value returns the key code of the key causing the exit

See also getstr(), inkey(), inkeydv()





























































TCHK 2.1 Page 133


Function getint - inputs an integer from the keyboard

Syntax char *getint(void);

Prototype in keyboard.h

Remarks getint inputs an integer from the keyboard. Only
digits, leading sign and backspace are valid input.
Input is terminated when the ENTER key is pressed.

the maximum length of input is 25.

Video output is via Borland's console i/o.

Return value returns a string of the format [sn] [ddd] where

[sn] = optional sign (+ or -)
[ddd] = optional digits

See also getdouble(), getreal()

Example #include
#include
main()
{
char *c;

printf("Give me an integer: ");
c = getint();
printf("Your input is %s\n",c);
}

Program output Give me an integer: -1289
Your input is -1289





























TCHK 2.1 Page 134


Function getk - get a key

Syntax byte getk(boolean wait);

Prototype in keyboard.h

Remarks getk returns the ascii code of the key pressed. If
no key was pressed (WAIT = FALSE) zero is returned.
This function is similar to getchar() except input
is not echoed to the screen and getk will detect
any key press (any standard keypress. It cannot
distinguish between the grey '+' key and the white
'+'. This function is interrupt driven. It will
detect ALT combinations, Del, PgUp, function keys,
etc., any keyboard INTerrupt accepted keys.)

Return value returns the ascii code for the key pressed, from 1
to 255. If WAIT = FALSE, and no key is pressed,
zero is returned. Check the global variables
key_status and key_extended to determine the shift
key status and if the key is an extended one.

See also keycode.h
getc_match(), getc_match(), getlogical(), getyn(),
inkey(), inkeyc()

Example #include
#include

main()
{
extern boolean key_extended;
byte c;

c = getk(WAIT);
printf("Key code # in keycode.h: %d\n",
key_extended ? c+256 : c);
}

























TCHK 2.1 Page 135


Function getlogical - get Yes/No

Syntax char getlogical(int output);

Prototype in keyboard.h

Remarks getlogical waits for a True/False key (TtFfYyNn) to
be pressed and then displays a message via putstr()
according to output:

output Message displayed
------ -----------------
0 no message
1 T or F or Y or N
2 True or False or Yes or No

getlogical is case independent.

Video output is via Borland's console i/o.

Return value returns 'Y' or 'N'

See also getc_match(), getci_match(), getk(), getyn(),
inkey(), inkeyc()

Example #include

main()
{
printf("This is good? ");
getlogical(2);
}































TCHK 2.1 Page 136


Function getpw - inputs a password from the keyboard

Syntax boolean getpw(int size, char *pw, char c);

Prototype in keyboard.h

Remarks inputs a string of maximum length size. Instead of
displaying the character input the character c is
displayed. The string input is stored in the memory
pointed to by pw. Make sure pw points to an
allocated piece of memory large enough to hold the
input string or unpredictable results may occur.

This function is useful for inputting passwords.
Only printable characters (those passing the
isprint() test), ENTER, ESC and Backspace are
acceptable input. All other input is ignored.

Video output is via Borland's console i/o.

Return value returns TRUE if ENTER terminated the input, FALSE
if ESC terminated the input.

See also getget()







































TCHK 2.1 Page 137


Function getreal - inputs a real from the keyboard

Syntax char *getreal(int size, int decimal);

Prototype in keyboard.h

Remarks getreal inputs a real (double) from the keyboard.
Only digits, decimal place, leading sign and
backspace are valid input. Input is terminated when
the ENTER key is pressed.

the maximum length of input is size and the maximum
number of decimal places is decimal. When
calculating size, you must leave enough room for
decimal, plus the number of places of the leading
integer, one for the decimal point and one for the
leading sign.

Video output is via Borland's console i/o.

Return value returns a string of the format [sn] [ddd] [.]
[ddd] where

[sn] = optional sign (+ or -)
[ddd] = optional digits
[.] = optional decimal point

See also getdouble(), getint()

Example #include
#include
main()
{
char *c;

printf("Give me a real: ");
c = getreal(8,2);
printf("Your input is %s\n",c);
}

Program output Give me a real: -1012.30
Your input is -1012.30





















TCHK 2.1 Page 138


Function getstr - input a string from the keyboard

Syntax char *getstr(int size, char *pattern);

Prototype in keyboard.h

Remarks getstr inputs a string from the keyboard, of
maximum length size, given a format pattern. See
getget() for a list of format modifiers.
The only other valid keys are backspace and ENTER.

Video output is via Borland's console i/o.

Return value returns a pointer to the storage location
containing the formatted string, or NULL if space
could not be allocated.

See also getget()

Example #include
#include

main()
{
char *f, *l, *s, *c;

printf("First name: ");
f = getget(10,"A");
printf("Last name: ");
l = getget(20,"a");
printf("SS#: ");
s = getget(8,"9");
printf("Comments: ");
c = getget(60,"");
}

Program output First name: HOWARD
Last name: kapustein
SS#: 123456789
Comments: The empty quotes defaults to X.























TCHK 2.1 Page 139


Function GetTypePointDevice - Pointing Device BIOS
Interface: Get Device Id

Syntax int GetTypePointDevice(void);

Prototype in ibm.h

Remarks GetTypePointDevice() will get the device id of the
pointing device.

Return value returns the device id on success and -1 on failure.
The success code is stored in Borland's global
variable errno. Here are the possible error values:

0x00 Success
0x01 Invalid function
0x02 Invalid input
0x03 Interface error
0x04 Need to resend
0x05 No device handler installed

Because the device id is returned, you should cross
check any returned value of -1 with errno to insure
the function did fail. Only if -1 is returned AND
errno != 0 did the function fail.

Note This function is only available on PS/2 machines or
under DESQview 2.x.

See also ResetPointDevice(), SetPointDevice(),
SetRatePointDevice(), SetResPointDevice()
































TCHK 2.1 Page 140


Function getVolSerialNum - get Volume Serial Number
(DOS 4.x)

Syntax boolean getVolSerialNum(int drive, unsigned long
*serialnum);

Prototype in doshk.h

Remarks gets the Volume Serial Number for a disk determined
by drive, where 0=A, 1=B, etc. serialnum must be a
pointer to an allocated piece of memory. This
function only works for DOS versions 4.x and later.

Return value returns TRUE if successful, otherwise returns FALSE
with the DOS error code in the global variable
errno.

See also getBootBlock(), getBootBlock4(), getBPB()

Example #include

main()
{
unsigned long serialnum;

if (getVolSerialNum(&serialnum))
printf("Got it: %lu",serialnum);
else
printf("Error");
}

































TCHK 2.1 Page 141


Function getyn - get Yes/No

Syntax char getyn(int output);

Prototype in keyboard.h

Remarks getyn waits for a Y or N to be pressed and then
displays a message via putstr() according to
output:

output Message displayed
------ -----------------
0 no message
1 Y or N
2 Yes or No

getyn is case independent.

Video output is via Borland's console i/o.

Return value returns 'Y' or 'N'

See also getc_match(), getk(), getc_match(), getlogical(),
inkey(), inkeyc()

Example #include

main()
{
printf("Is this OK? ");
getyn(2);
}































TCHK 2.1 Page 142


Function gotohv - move cursor to absolute coordinates

Syntax void gotohv(int h, int v);

Prototype in video.h

Remarks gotoxy puts cursor at absolute screen coordinates
(h,v) via INT 0x10, Service 2. The top left corner
of the screen is referred to by (0,0).

This is NOT the same as Borland's gotoxy().
Borland's function is affected by the window()
settings, whereas gotohv() is not.

Return value nothing.

See also read_cursor(), whereh(), wherev()

Example #include

main()
{
gotohv(0,0);
}







































TCHK 2.1 Page 143


Function Greg... - family of Gregorian date conversion
functions

Syntax double GregtoCal(char *greg);
double GregtoCalCent(char *greg);

double GregEurotoCal(char *greg);
double GregEurotoCalCent(char *greg);

double GregJaptoCal(char *greg);
double GregJaptoCalCent(char *greg);

Prototype in datehk.h

Remarks GregtoCal converts Gregorian (US) dates to
Calendar dates
GregtoCalCent converts Gregorian (US) dates
to Calendar dates (w/century)

GregEurotoCal converts Gregorian (European)
dates to Calendar dates
GregEurotoCalCent converts Gregorian (European)
dates to Calendar dates
(w/century)

GregJaptoCal converts Gregorian (Japan)
dates to Calendar dates
GregJaptoCalCent converts Gregorian (Japan)
dates to Calendar dates
(w/century)

Return value GregtoCal, GregEurotoCal, GregJaptoCal return a
Calendar date
GregtoCalCent, GregEurotoCalCent, GregJaptoCalCent
return a Calendar date (w/century)

See also Appendix A
Cal...(), date_convert(), ddatetofull(),
ddatetoshort(), ddatetostr(), fulltoddate(),
Jul...(), monthexpand(), shorttoddate(),
strtoddate()

Example see demodate.c




















TCHK 2.1 Page 144


Function horiz_line - draw a horizontal line

Syntax void horiz_line(byte c, int len, int col, int row);

Prototype in video.h

Remarks draws a horizontal line of characters c of length
len beginning at (col,row) via INTerrupts, using
the current char_attribute setting for color.
Screen coordinates are absolute.

horiz_line does no error checking on the passed
parameters.

Return value nothing.

See also box(), vert_line()

Example #include

main()
{
horiz_line('*',7,4,4); /* draw 7 *'s */
}







































TCHK 2.1 Page 145


Function initkeyvars - setup internal keyboard settings

Syntax void initkeyvars(void);

Prototype in keyboard.h

Remarks used to initialize internal variables used by
several keyboard functions. The following variable
assignments are made:

_cursorinsert = CURSOR_HALFBLOCK;
_cursoroverwrite = CURSOR_UNDERBAR;

Return value nothing.

See also getget()















































TCHK 2.1 Page 146


Function inkey - get a key

Syntax int inkey(boolean wait);

Prototype in keyboard.h

Remarks inkey returns the key code of the key pressed. If
no key was pressed (WAIT = FALSE) 0 is returned.
This function is similar to getchar() except input
is not echoed to the screen and inkey will detect
any key press (any standard keypress. It cannot
distinguish between the grey '+' key and the white
'+'. This function is interrupt driven. It will
detect ALT combinations, Del, PgUp, function keys,
etc., any keyboard INTerrupt accepted keys.)

Return value returns the key code of the key pressed, from 1 to
511. If WAIT = FALSE, and no key is pressed, zero
is returned.

See also keycode.h
getc_match(), getk(), getc_match(), getlogical(),
getyn(), inkeyc(), inkeycdv(), inkeydv(),
tocapkey()

Example #include
#include

main()
{
int c;

c = inkey(WAIT);
printf("Key code # in keycode.h: %d\n", c);
}




























TCHK 2.1 Page 147


Function inkeyc - get a key, any alphabetics capitalized

Syntax int inkeyc(boolean wait);

Prototype in keyboard.h

Remarks inkeyc returns the key code of the key pressed. If
no key was pressed (WAIT = FALSE) 0 is returned.
Any letters detected are capitalized before being
returned. This function is similar to getchar()
except input is not echoed to the screen and inkeyc
will detect any key press (any standard keypress.
It cannot distinguish between the grey '+' key and
the white '+'. This function is interrupt driven.
It will detect ALT combinations, Del, PgUp,
function keys, etc., any keyboard INTerrupt
accepted keys.)

Return value returns the key code of the key pressed, from 1 to
511, all letters are capitalized. If WAIT = FALSE,
and no key is pressed, zero is returned.

See also keycode.h
getc_match(), getk(), getc_match(), getlogical(),
getyn(), inkey(), inkeycdv(), inkeydv(), tocapkey()

Example #include
#include

main()
{
int c;

c = inkeyc(WAIT);
printf("Key code # in keycode.h: %d\n", c);
}



























TCHK 2.1 Page 148


Function inkeycdv - get a key, any alphabetics
capitalized, DESQview aware

Syntax int inkeycdv(boolean wait);

Prototype in keyboard.h

Remarks inkeycdv returns the key code of the key pressed.
If no key was pressed (WAIT = FALSE) 0 is returned.
Any letters detected are capitalized before being
returned. This function is similar to getchar()
except input is not echoed to the screen and inkeyc
will detect any key press (any standard keypress.
It cannot distinguish between the grey '+' key and
the white '+'. This function is interrupt driven.
It will detect ALT combinations, Del, PgUp,
function keys, etc., any keyboard INTerrupt
accepted keys.)

When running under DESQview, inkeydv() will free up
time slices while waiting for a keypress. DESQview
is detected by the variable _dvmajor not equal to
zero. DESQversion() should be invoked sometime
before using inkeydv().

Return value returns the key code of the key pressed, from 1 to
511, all letters are capitalized. If WAIT = FALSE,
and no key is pressed, zero is returned.

See also keycode.h
DESQversion(), getc_match(), getk(), getc_match(),
getlogical(), getyn(), inkey(), inkeyc(),
inkeydv(), tocapkey()

Example #include
#include
#include

main()
{
int c;

DESQversion();
c = inkeycdv(WAIT);
printf("Key code # in keycode.h: %d\n", c);
}

















TCHK 2.1 Page 149


Function inkeydv - get a key, DESQview aware

Syntax int inkeydv(boolean wait);

Prototype in keyboard.h

Remarks inkeydv returns the key code of the key pressed. If
no key was pressed (WAIT = FALSE) 0 is returned.
This function is similar to getchar() except input
is not echoed to the screen and inkeydv will detect
any key press (any standard keypress. It cannot
distinguish between the grey '+' key and the white
'+'. This function is interrupt driven. It will
detect ALT combinations, Del, PgUp, function keys,
etc., any keyboard INTerrupt accepted keys.)

When running under DESQview, inkeydv() will free up
time slices while waiting for a keypress. DESQview
is detected by the variable _dvmajor not equal to
zero. DESQversion() should be invoked sometime
before using inkeydv().

Return value returns the key code of the key pressed, from 1 to
511. If WAIT = FALSE, and no key is pressed, zero
is returned.

See also keycode.h
DESQversion(), getc_match(), getk(), getc_match(),
getlogical(), getyn(), inkey(), inkeyc(),
inkeycdv(), tocapkey()

Example #include
#include
#include

main()
{
int c;

DESQversion();
c = inkeydv(WAIT);
printf("Key code # in keycode.h: %d\n", c);
}




















TCHK 2.1 Page 150


Function intlen - calculate length of integer in a string

Syntax int intlen(char *number);

Prototype in stringhk.h

Remarks intlen calculates the length of an integer in the
string number. The integer is terminated by a
non-digit (any character other than 0-9.) This
function is used internally by strcomma.

Return value the length of the integer pointed to by number.

Example #include
#include /* for the printf */
#include /* for the calloc */

main()
{
char *sint[15];
int len;

strcpy(sint,"1839.44");
printf("String: %s Length of integer: %d\n"
, sint, intlen(sint));
strcpy(sint,"19,848");
printf("String: %s Length of integer: %d\n"
, sint, intlen(sint));
strcpy(sint,"44x993");
printf("String: %s Length of integer: %d\n"
, sint, intlen(sint));
}

Program output String: 1839.44 Length of integer: 4
String: 19,848 Length of integer: 2
String: 44x993 Length of integer: 2



























TCHK 2.1 Page 151


Function InsLock - set the Insert key state

Syntax void InsLock(boolean on);

Prototype in ibm.h

Remarks sets the Insert key state to the state selected by
the on parameter.

Return value nothing.

See also CapsLock(), NumLock(), SrollLock()



















































TCHK 2.1 Page 152


Function is2nd8259 - is a 2nd 8259 chip installed

Syntax int is2nd8259(void)

Prototype in ibm.h

Remarks is2nd8259() detects if a 2nd 8259 chip is
installed.

Return value returns 1 if a 2nd 8259 chip is installed, 0 if it
is not, and -1 if this function is not supported.

Note the 1/10/86 XT BIOS returns an incorrect value for
this function, so if the machine is an IBM XT or
compatible with a BIOS date of 1/10/86, do not use
this function.

Example #include

main()
{
printf("2nd 8259 chip: ");
switch (is2nd8259()) {
case -1: printf("Error"); break;
case 0: printf("No"); break;
case 1: printf("Yes"); break;
}




































TCHK 2.1 Page 153


Function isallalpha - are all characters in string
alphabetic

Syntax boolean isallalpha(char *str);

Prototype in stringhk.h

Remarks checks if all characters in str are alphabetic.

Return value returns TRUE if all characters in str are
alphabetic, FALSE otherwise.

See also isallalphanum(), isalllower(), isallupper()


















































TCHK 2.1 Page 154


Function isallalphanum - are all characters in string
alphanumeric

Syntax boolean isallalphanum(char *str);

Prototype in stringhk.h

Remarks checks if all characters in str are alphanumeric.

Return value returns TRUE if all characters in str are
alphanumeric, FALSE otherwise.

See also isallalpha(), isalllower(), isallupper()


















































TCHK 2.1 Page 155


Function isalllower - are all characters in string
lower case

Syntax boolean isalllower(char *str);

Prototype in stringhk.h

Remarks checks if all characters in str are lower case.

Return value returns TRUE if all characters in str are lower
case, FALSE otherwise.

See also isallalpha(), isallalphanum(), isallupper()


















































TCHK 2.1 Page 156


Function isallupper - are all characters in string
upper case

Syntax boolean isallupper(char *str);

Prototype in stringhk.h

Remarks checks if all characters in str are upper case.

Return value returns TRUE if all characters in str are upper
case, FALSE otherwise.

See also isallalpha(), isallalphanum(), isalllower()


















































TCHK 2.1 Page 157


Function isAnarkey - is ANARKEY.COM by Steven Calwas
installed

Syntax boolean isAnarkey(void);

Prototype in doshk.h

Remarks checks if ANARKEY.COM is installed (command line
recall programm by Steven Calwas)

Return value returns TRUE if Anarkey is installed, FALSE
otherwise.

Note The default function number used by Anarkey is
0xE3. However, the function number used by Anarkey
can be changed by the Anarkey user at runtime. This
function assumes that the function number used by
Anarkey is 0xE3. If Anarkey is using a different
function number, isAnarkey() will not perform
reliably. Refer to the Anarkey documentation for
further details.

Example #include

main()
{
printf("Anarkey is ");
if (! isAnarkey())
printf("not ");
printf("installed\n");
}
































TCHK 2.1 Page 158


Function isAppendavail - is APPEND installed

Syntax boolean isAppendavail(void);

Prototype in doshk.h

Remarks checks if APPEND is installed.

Return value returns TRUE if APPEND is installed, FALSE
otherwise.

See also isAssignavail(), isShareAvail()

Example #include

main()
{
printf("APPEND is ");
if (! isAppendavail())
printf("not ");
printf("installed\n");
}









































TCHK 2.1 Page 159


Function isAssignavail - is ASSIGN installed

Syntax boolean isAssignavail(void);

Prototype in doshk.h

Remarks checks if ASSIGN is installed.

Return value returns TRUE if ASSIGN is installed, FALSE
otherwise.

See also getAssignmemseg(), isAppendavail(), isShareAvail()

Example #include

main()
{
printf("ASSIGN is ");
if (! isAssignavail())
printf("not ");
printf("installed\n");
}









































TCHK 2.1 Page 160


Function isAutoPark - is AUTOPARK.COM by Alan D. Jones
installed

Syntax boolean isAutoPark(void);

Prototype in doshk.h

Remarks checks if AutoPark.COM installed (resident hard
disk parker by Alan D. Jones)

Return value returns TRUE if is installed, FALSE otherwise.

See also setAutoPark()

Example #include

main()
{
printf("AutoPark is ");
if (! isAutoPark())
printf("not ");
printf("installed\n");
}








































TCHK 2.1 Page 161


Function isBlogical - is drive B: logical

Syntax boolean isBlogical(void);

Prototype in ibm.h

Remarks checks if drive B: is logical or physical

Return value returns TRUE if drive B: is logical, FALSE
otherwise.

Example #include

main()
{
printf("Drive B: is ");
if (isBlogical())
printf("logical\n");
else
printf("physical\n");
}










































TCHK 2.1 Page 162


Function isBREAKon - check Ctrl-BREAK flag

Syntax #include
isBREAKon();

Prototype in ibm.h

Remarks checks the state of the Ctrl-BREAK flag. The BREAK
status flag can be set from DOS by BREAK ON or
BREAK OFF.

This function is a macro.

Return value returns TRUE if the break flag is on, FALSE if the
flag is off.

See also isVERIFYon(), setBREAK(), setVERIFY()

Example #include

main()
{
printf("BREAK flag is ");
if (! isBREAKon())
printf("not ");
printf("on\n");
}




































TCHK 2.1 Page 163


Function iscdevicemoderaw - is character device in "raw"
mode

Syntax int iscdevicemoderaw(int handle);

Prototype in doshhk.h

Remarks iscdevicemoderaw() detects if character device
associated with handle is in "cooked" or "raw"
mode. In cooked mode, DOS performs some translation
of characters, while in raw mode no translation is
performed.


Return value iscdevicemoderaw returns:

1: raw mode
0: cooked mode
-1: error

If there was an error, Borland's variable errno
will contain the error code as follows:

1 function number invalid
4 no handle available
5 access denied
6 handle invalid or not open
13 data invalid

See also isdrivelocal(), ishandlelocal(), isRedirectStdin(),
isRedirectStdout(), isremoveable(),
setcdevicemode()
































TCHK 2.1 Page 164


Function isCEDavail - is CED installed

Syntax boolean isCEDavail(void);

Prototype in doshk.h

Remarks checks if CED installed

Return value returns TRUE if is installed, FALSE otherwise.

See also CEDadd(), CEDremove()

Example #include

main()
{
printf("CED is ");
if (! isCEDavail())
printf("not ");
printf("installed\n");
}










































TCHK 2.1 Page 165


Function isCGA - is Color Graphics adapter installed
isEGA - is Enhanced Graphics adapter installed
isHerc - is Hercules Graphics adapter installed
isMDA - is Monochrome adapter installed

ismono - is monochrome display
iscolor - is color display

Syntax boolean isMDA(void);
boolean isCGA(void);
boolean isEGA(void);
boolean isHerc(void);

#include
ismono()
iscolor()

Prototype in video.h

Remarks is...() check if a video adapter is present.
ismono() checks if the display is mono.
iscolor() checks if the display is color.

The ismono() and iscolor() are macros. Use them if
you wish to check what attributes to use (underline
or red?) and use the adapter functions (isEGA,
etc.) for adapter specific tests.

Return value these functions return TRUE if the video adapter or
type, as the case may be, is present. Otherwise
they return FALSE.

See also video.h

Example #include

main()
{
if (ismono()) /* monochrome */
if (isHerc())
printf("Hercules");
else
printf("MDA");
else /* color */
if (isEGA())
printf("EGA");
else
printf("CGA");
}














TCHK 2.1 Page 166


Function isdate - character classification

Syntax boolean isdate(int c);

Prototype in keyboard.h

Remarks determines if a character is valid for a date. Only
the following characters are allowed:

0 1 2 3 4 5 6 7 8 9 - /

Return value returns true if c is a valid date character, FALSE
otherwise.


















































TCHK 2.1 Page 167


Function isdir - is a FAT entry a subdirectory

Syntax boolean isdir(char *fspec);

Prototype in filehk.h

Remarks checks if a FAT entry is a valid subdirectory. The
string fspec should be in the following format:

[d:][path]filename.ext[\]

where

d: = optional drive letter
path = optional path
filename.ext = the name of the FAT entry you
want to check
fspec may optionally have a \ at the end

Wildcards (*,?) are NOT supported and always cause
isdir to return FALSE.

This function does not harm the dta. The dta is
modified by this function, but restored before
returning.

Return value returns TRUE if fspec is a subdirectory, FALSE if
fspec does not exist or is not a subdirectory.

See also fileexist()

Example #include

main()
{
char dirname[] = "a:\util\";

printf("%s is ",dirname);
if (! isdir())
printf("not ");
printf("a subdirectory\n");
}





















TCHK 2.1 Page 168


Function isDoubleDOS - is DoubleDOS installed

Syntax boolean isDoubleDOS(void);

Prototype in multihk.h

Remarks detects if Double DOS is running.

Return value returns TRUE if Double DOS is running, FALSE
otherwise.

See also DoubleDOSfreeCPU(), DoubleDOSGetVirtual(),
DoubleDOSTaskSwitch(), isInvisible()

Example #include

main()
{
printf("Double DOS is ");
if (! isDoubleDOS())
printf("not ");
printf("installed");
}








































TCHK 2.1 Page 169


Function isdrivelocal - is drive local or remote

Syntax int isdrivelocal(int drive);

Prototype in doshhk.h

Remarks isdrivelocal() detects if a drive determined by
drive, where 0=default, 1=A, 2=B, etc. is local
(Microsoft Networks) or remote (redirected to
server).

isdrivelocal requires DOS 3.x+

Return value isdrivelocal returns:

0: remote
1: local
-1: error

If there was an error, Borland's variable errno
will contain the error code as follows:

1 function number invalid
4 no handle available
5 access denied
13 data invalid
15 drive number invalid

See also iscdevicemoderaw(), ishandlelocal(),
isRedirectStdin(), isRedirectStdout(),
isremoveable(), setcdevicemode()
































TCHK 2.1 Page 170


Function isDriverSys - is DRIVER.SYS installed

Syntax unsigned char isDriverSys(void);

Prototype in doshk.h

Remarks checks if DRIVER.SYS is installed.

Return value returns one of the following values:

0x00 - not installed, OK to install
0x01 - not installed, not OK to install
0xFF - installed

Example #include

main()
{
printf("DRIVER.SYS is ");
if (isDriverSys() != 0xFF)
printf("not ");
printf("installed\n");
}








































TCHK 2.1 Page 171


Function isEMSavail - is EMS available

Syntax boolean isEMSavail(void);

Prototype in ibm.h

Remarks checks if EMS is installed.

Return value returns TRUE if EMS is present, otherwise FALSE.

See also ibm.h
EMSGetStatus(), EMSinfo(), EMSpages(),
EMMversion(), EMSwarmbootprep()

Example #include

main()
{
printf("EMS is ");
if (! isEMSavail())
printf("not ");
printf("available\n");
}








































TCHK 2.1 Page 172


Function isEnhanceKbd - is an enhanced keyboard installed

Syntax boolean isEnhanceKbd(void);

Prototype in ibm.h

Remarks checks if the keyboard is enhanced (102 keys or 101
in Europe). Does your keyboard have F11 and F12? If
so, it's an enhanced keyboard.

Return value returns TRUE if an enhanced keyboard is installed,
FALSE otherwise.

Example #include

main()
{
printf("Keyboard is ");
if (isEnhanceKbd())
printf("enhanced\n");
else
printf("old style (85 keys)\n");
}








































TCHK 2.1 Page 173


Function iseven - is a number even

Syntax #include
(boolean) iseven(x)


Prototype in mathhk.h

Remarks iseven checks if x is even (evenly divisible by 2).

This function is a macro.

Return value returns TRUE if x is even, otherwise FALSE.

See also isodd()

















































TCHK 2.1 Page 174


Function isExtended - is Extended memory installed

Syntax boolean isExtended(void);

Prototype in ibm.h

Remarks checks if Extended memory is installed.

Return value returns TRUE if Extended memory is installed, FALSE
otherwise.

See also Extendedtotal()

Example #include

main()
{
printf("Extended memory is ");
if (! isExtended())
printf("not ");
printf("installed\n");
}









































TCHK 2.1 Page 175


Function isfilename - character classification

Syntax boolean isfilename(int c);

Prototype in keyboard.h

Remarks determines if a character is valid for a DOS
filename. The following characters are NOT allowed:

: ; , = + tab space < > | / \ " [ ]

Return value returns true if c is a valid DOS filename
character, FALSE otherwise.

Note This function checks if a character is legal for a
DOS filename.ext. Use ispathname() to check for a
valid DOS pathname character.

See also ispathname()












































TCHK 2.1 Page 176


Function isgameport - is a game port installed

Syntax boolean isgameport(void);

Prototype in ibm.h

Remarks checks if a game port is installed.

Return value returns TRUE if a game port is installed, FALSE
otherwise.

See also joystickAx(), joystickAy(), joystickBx(),
joystickBy(), joysticksettings()

Example #include

main()
{
printf("Game port is ");
if (! isgameport())
printf("not ");
printf("installed\n");
}








































TCHK 2.1 Page 177


Function isgn - sign of an integer

Syntax #include
(int) isgn(x)

Prototype in mathhk.h

Remarks isgn will determine the sign of x. Zero is
considered positive.

This function is a macro.

The macros sgn() and sign() are defined as isgn().

Return value returns -1 if x is negative, otherwise 1.

See also fsgn(), lsgn()














































TCHK 2.1 Page 178


Function ishandlelocal - is handle local or remote

Syntax int ishandlelocal(int handle);

Prototype in doshhk.h

Remarks ishandlelocal() detects if a handle is local
(Microsoft Networks) or remote (redirected to
server).

ishandlelocal requires DOS 3.x+

Return value ishandlelocal returns:

0: remote
1: local
-1: error

If there was an error, Borland's variable errno
will contain the error code as follows:

1 function number invalid
4 no handle available
5 access denied
6 handle invalid or not open
13 data invalid

See also iscdevicemoderaw(), isdrivelocal(),
isRedirectStdin(), isRedirectStdout(),
isremoveable(), setcdevicemode()

































TCHK 2.1 Page 179


Function isHiliteable - can a menu command be hilighted

Syntax boolean isHiliteable(char cmdtype,
unsigned flagparms);

Prototype in menuhk.h

Remarks determines if a menu command can be hilighted.

This function is used internally by several menu
functions.

Return value TRUE if the menu command can be hilighted, FALSE
otherwise.

Note This function is for internal uses only.

See also menuhk.h













































TCHK 2.1 Page 180


Function isInvisible - is this the invisible program under
Double DOS

Syntax boolean isInvisible(void);

Prototype in multihk.h

Remarks detects if the current program is the invisible
program under Double DOS.

Return value returns TRUE if the current program is the invisble
program under Double DOS, FALSE otherwise.

See also DoubleDOSfreeCPU(), DoubleDOSGetVirtual(),
DoubleDOSTaskSwitch(), isDoubleDOS()

Example #include

main()
{
printf("This program is ");
if (! isInvisible())
printf("not ");
printf("the invisible program");
}






































TCHK 2.1 Page 181


Function isleapyear - is a year a leap year

Syntax boolean isleapyear(int checkyear);

Prototype in datehk.h (isleapyear)

Remarks checks if checkyear is a leap year (29 days in
February.)

Return value returns TRUE if checkyear is a leap year, FALSE
otherwise.

See also valid_date()

Example #include

main()
{
int year;

/* assign some value to year */
printf("year %d is ",year);
if (! isleapyear(year))
printf("not ");
printf("a leap year\n");
}





































TCHK 2.1 Page 182


Function isMCA - is the bus Micro Channel Architecture

Syntax int isMCA(void);

Prototype in ibm.h

Remarks isMCA() detects if the bus is Micro Channel
Architecture.

Return value returns 1 if the bus is Micro Channel Architecture,
0 if it is not, and -1 if this function is not
supported.

Note the 1/10/86 XT BIOS returns an incorrect value for
this function, so if the machine is an IBM XT or
compatible with a BIOS date of 1/10/86, do not use
this function.

See also machine_id(), ROM_date(), ROM_id()

Example #include

main()
{
printf("BUS type: ");
switch (isMCA()) {
case -1: printf("Error"); break;
case 0: printf("PC"); break;
case 1: printf("MCA"); break;
}

































TCHK 2.1 Page 183


Function ismouse - is a mouse installed

Syntax boolean ismouse(void);

Prototype in mousehk.h

Remarks ismouse() detects if a mouse is installed, and if
so, how many buttons it has. If a mouse is
installed, _mouse1 will contain the returned AX
register (is a mouse installed), and _mouse2 will
contain the number of buttons on the mouse (BX
register), as follows:

-1 = 2 buttons
3 = Mouse Systems mouse
0 = other than 2 buttons

Return value returns TRUE if a mouse is installed, FALSE
otherwise.

Note This function will also reset the mouse if one is
installed.

See also MGetVerType(), MouseReset()

Example #include

main()
{
extern int _mouse2;

printf("mouse: ");
if (ismouse())
switch (_mouse2) {
case -1: printf("2 buttons");
case 3: printf("Mouse Systems");
case 0: printf("!= 2 buttons (3?)");
}
else
printf("not installed");
}






















TCHK 2.1 Page 184


Function isNetwork - is a network installed

Syntax boolean isNetwork(void);

Prototype in network.h

Remarks checks if a network is installed.

Return value returns TRUE if a network is installed, FALSE
otherwise.

Note this function requires DOS 3.1+

Example #include

main()
{
printf("A network is ");
if (! isNetwork())
printf("not ");
printf("installed\n");
}









































TCHK 2.1 Page 185


Function isNLSFuncCom - is NLSFUNC.COM installed

Syntax unsigned char isNLSFuncCom(void);

Prototype in doshk.h

Remarks checks if NLSFUNC.COM is installed.

Return value returns one of the following values:

0x00 - not installed, OK to install
0x01 - not installed, not OK to install
0xFF - installed

Example #include

main()
{
printf("NLSFUNC.COM is ");
if (isNLSFuncCom() != 0xFF)
printf("not ");
printf("installed\n");
}








































TCHK 2.1 Page 186


Function isNovellNetavail - is Novell Network installed

Syntax boolean isNovellNetavail(void);

Prototype in network.h

Remarks checks if a Novell network is installed.

Return value returns TRUE if a Novell network is installed,
FALSE otherwise.

Example #include

main()
{
printf("Novell network is ");
if (! isNovellNetavail())
printf("not ");
printf("installed\n");
}











































TCHK 2.1 Page 187


Function isodd - is a number odd

Syntax #include
(boolean) isodd(x)

Prototype in mathhk.h

Remarks isodd checks if x is odd (not evenly divisible by
2).

This function is a macro.

Return value returns TRUE if x is odd, otherwise FALSE.

See also iseven()
















































TCHK 2.1 Page 188


Function ispathname - character classification

Syntax boolean ispathname(int c);

Prototype in keyboard.h

Remarks determines if a character is valid for a DOS
pathname. The following characters are NOT allowed:

; , = + tab space < > | / " [ ]

Return value returns true if c is a valid DOS pathname
character, FALSE otherwise.

Note This function checks if a character is legal for a
DOS pathname. Use isfilename() to check for a valid
DOS filename.ext character.

See also isfilename()












































TCHK 2.1 Page 189


Function ispcAnywhere - is pcAnywhere installed

Syntax boolean ispcAnywhere(void);

Prototype in doshk.h

Remarks determines if pcAnywhere is installed.

Return value returns TRUE if pcAnywhere is installed, FALSE
otherwise.

See also SetpcAnywhere()

Example #include

main()
{
printf("pcAnywhere is ");
if (! ispcAnywhere())
printf("not ");
printf("installed\n");
}









































TCHK 2.1 Page 190


Function isPRINTavail - is PRINT.COM installed

Syntax int isPRINTavail(void);

Prototype in printhk.h

Remarks detects if PRINT.COM is installed.

Return value returns PRINT_ERROR if DOS 3.1 or greater is not
being used, otherwise returns PRINT_OK, PRINT_NOOK
or PRINT_INSTALLED, depending on the current
status.

Note requires DOS 3.1 or greater.

See also PRINTadd(), PRINThold(), PRINTpurge(),
PRINTremove(), PRINTresume














































TCHK 2.1 Page 191


Function isPM - the the hour AM or PM

Syntax #include
(boolean) isPM(hr)

Prototype in timehk.h

Remarks determines if hr in 24-hour army time is AM or PM.

Return value returns TRUE if hr is noon (12) or later or FALSE
if hr is AM.

See also time_convert(), to24hour(), tohour()


















































TCHK 2.1 Page 192


Function isrealtimeclock - is a real time clock installed

Syntax int isrealtimeclock(void);

Prototype in ibm.h

Remarks isrealtimeclock() detects if a real time clock is
installed.

Return value returns 1 if a real time clock is installed, 0 if
it is not, and -1 if this function is not
supported.

Note the 1/10/86 XT BIOS returns an incorrect value for
this function, so if the machine is an IBM XT or
compatible with a BIOS date of 1/10/86, do not use
this function.

Example #include

main()
{
printf("real time clock: ");
switch (isrealtimeclock()) {
case -1: printf("Error"); break;
case 0: printf("No"); break;
case 1: printf("Yes"); break;
}



































TCHK 2.1 Page 193


Function isRedirectStdin - is stdin redirected

Syntax boolean isRedirectStdin(void);

Prototype in doshhk.h

Remarks isRedirectStdin() detects if standard input (stdin)
is redirected.

Return value isRedirectStdin returns TRUE if standard input
(stdin) is redirected, FALSE otherwise.

See also iscdevicemoderaw(), isdrivelocal(),
ishandlelocal(), isRedirectStdout(),
isremoveable(), setcdevicemode()
















































TCHK 2.1 Page 194


Function isRedirectStdout - is stdout redirected

Syntax boolean isRedirectStdout(void);

Prototype in doshhk.h

Remarks isRedirectStdout() detects if standard output
(stdout) is redirected.

Return value isRedirectStdout returns TRUE if standard output
(stdout) is redirected, FALSE otherwise.

See also iscdevicemoderaw(), isdrivelocal(),
ishandlelocal(), isRedirectStdin(), isremoveable(),
setcdevicemode()
















































TCHK 2.1 Page 195


Function isremoveable - is device removeable

Syntax int isremovable(char drive);

Prototype in doshhk.h

Remarks isremoveable() detects if a device determined by
drive, where 0=default, 1=A, 2=B, etc. is
removeable (i.e. Bernouli boxes) or fixed (i.e.
hard drives).

isremoveable requires DOS 3.x+

Return value isremoveable returns:

0: removeable
1: fixed
15: invalid drive
-1: error

If there was an error, Borland's variable errno
will contain the error code.

See also iscdevicemoderaw(), isdrivelocal(),
ishandlelocal(), isRedirectStdin(),
isRedirectStdout(), setcdevicemode()





































TCHK 2.1 Page 196


Function isScrnSav2 - is SCRNSAV2.COM by Alan Ballard
installed

Syntax boolean isScrnSav2(void);

Prototype in doshk.h

Remarks checks if ScrnSav2.COM is installed (screen saver
for PS/2s w/VGA by Alan Ballard)

Return value returns TRUE if SCRNSAV2.COM is installed, FALSE
otherwise.

Example #include

main()
{
printf("ScrnSav2 is ");
if (! isScrnSav2())
printf("not ");
printf("installed\n");
}









































TCHK 2.1 Page 197


Function isShareavail - is SHARE installed

Syntax boolean isShareavail(void);

Prototype in doshk.h

Remarks checks if SHARE is installed.

Return value returns TRUE if SHARE is installed, FALSE
otherwise.

See also isAppendavail(), isAssignAvail()

Example #include

main()
{
printf("SHARE is ");
if (! isShareavail())
printf("not ");
printf("installed\n");
}









































TCHK 2.1 Page 198


Function isstate - is string a state abbreviation

Syntax boolean isstate(char *state);

Prototype in statehk.h

Remarks isstate() looks up the state abbreviation given in
States[]. The search is case independent

Return value returns TRUE if found, otherwise FALSE.

Note in addition to the 50 states, the following are
also recognized:

CZ - Canal Zone
DC - District of Columbia
GU - Guam
PR - Puerto Rico
VI - Virgin Islands

See also statehk.h
iszip(), stateindex()

Example #include

{
printf("AL is ");
if (!isstate("AL"))

printf("NOT ");
printf("a valid state abbreviation\n");
}

Program output AL is a valid state abbreviation






























TCHK 2.1 Page 199


Function isVERIFYon - check VERIFY flag

Syntax #include
isVERIFYon()

Prototype in ibm.h

Remarks checks the state of the verify flag. The VERIFY
status flag can be set from DOS by VERIFY ON or
VERIFY OFF.

This function is a macro.

Return value returns TRUE if the verify flag is on, FALSE if the
flag is off.

See also isBREAKon(), setBREAK(), setVERIFY()

Example #include

main()
{
printf("VERIFY flag is ");
if (! isVERIFYon())
printf("not ");
printf("on\n");
}




































TCHK 2.1 Page 200


Function isVidclock - is VIDCLOCK.COM by Tom Hanlin
installed

Syntax boolean isVidclock(void);

Prototype in doshk.h

Remarks checks if VIDCLOCK.COM by Tom Hanlin is installed.

Return value returns TRUE if VIDCLOCK.COM is installed, FALSE
otherwise.

Example #include

main()
{
printf("VidClock is ");
if (! isVidclock())
printf("not ");
printf("installed\n");
}










































TCHK 2.1 Page 201


Function isWhoa - is WHOA!.COM by Brad Crandall installed

Syntax boolean isWhoa(void);

Prototype in doshk.h

Remarks checks if WHOA!.COM is installed (system slow-down
utility by Brad Crandall).

Return value returns TRUE if WHOA!.COM is installed, FALSE
otherwise.

See also setWhoa(), uninstallWhoa()

Example #include

main()
{
printf("Whoa! is ");
if (! isWhoa())
printf("not ");
printf("installed\n");
}








































TCHK 2.1 Page 202


Function iswildcarded - checks a string for DOS wildcards

Syntax boolean iswildcarded(char *str);

Prototype in stringhk.h

Remarks checks if the DOS wildcard characters *,? are
contained in str.

Return value returns TRUE * or ? is in str, FALSE otherwise.

Example #include

main()
{
char filename[] = "TCHK*.LIB";

printf("%s is ",filename);
if (!iswildcarded(filename))
printf("NOT ");
printf("wildcarded");

}

Program output TCHK*.LIB is wildcarded






































TCHK 2.1 Page 203


Function isXMSinstalled - is XMS installed

Syntax boolean isXMSinstalled(void);

Prototype in doshk.h

Remarks checks if the eXtended Memory Specification driver
HIMEM.SYS or some compatibile is available. At this
time, HIMEM 2.06 is the latest version.

Return value returns TRUE if XMS is available, FALSE otherwise.

Example #include

main()
{
printf("XMS is ");
if (! isXMSinstalled())
printf("not ");
printf("installed\n");
}










































TCHK 2.1 Page 204


Function iszip - is a zip code valid for a state

Syntax boolean iszip(char *state, char *zip);

Prototype in statehk.h

Remarks iszip() checks if a zip code is valid for the state
given by its abbreviation. See isstate for valid
state abbreviations.

Currently, iszip() requires the zip code to be a
string, which is internally converted to a long via
atol(). This was done to provide potential future
expansion to support non-numeric zip codes (i.e.
Canada, etc.) in the future.

Return value returns TRUE if the zip code is valid for the state
given. If the state abbreviation is not valid, or
the zip code is not valid for the state, FALSE is
returned.

Note For Canal Zone (CZ), any zip code will return as
valid. I could not determine the range of valid zip
codes for the Canal Zone.

See also statehk.h
isstate(), stateindex()

Example #include

{
printf("11554 is ");
if (!iszip("NY","11554"))
printf("NOT ");
printf("a valid zip code for NY\n");
}

Program output AL is a valid state abbreviation

























TCHK 2.1 Page 205


Function joystickAx - read joystick input Ax

Syntax unsigned joystickAx(void);

Prototype in ibm.h

Remarks reads the joystick input Ax.

Return value returns the joystick input Ax.

See also isgameport(), joystickAy(), joystickBx(),
joystickBy(), joysticksettings()

Example #include

main()
{
while (inkey(FALSE) == 0) {
printf("Joystick Inputs\n");
printf("A: (%u,%u)\n",joystickAx(),
joystickAy());
printf("B: (%u,%u)\n",joystickBx(),
joystickBy());
}
}

Program output continuously polls joystick inputs and displays
their values until a key is pressed.



































TCHK 2.1 Page 206


Function joystickAy - read joystick input Ay

Syntax unsigned joystickAy(void);

Prototype in ibm.h

Remarks reads the joystick input Ay.

Return value returns the joystick input Ay.

See also isgameport(), joystickAx(), joystickBx(),
joystickBy(), joysticksettings()

Example See joystickAx().

















































TCHK 2.1 Page 207


Function joystickBx - read joystick input Bx

Syntax unsigned joystickBx(void);

Prototype in ibm.h

Remarks reads the joystick input Bx.

Return value returns the joystick input Bx.

See also isgameport(), joystickAx(), joystickAy(),
joystickBy(), joysticksettings()

Example See joystickAx().

















































TCHK 2.1 Page 208


Function joystickBy - read joystick input By

Syntax unsigned joystickBy(void);

Prototype in ibm.h

Remarks reads the joystick input By.

Return value returns the joystick input By.

See also isgameport(), joystickAx(), joystickAy(),
joystickBx(), joysticksettings()

Example See joystickAx().

















































TCHK 2.1 Page 209


Function joysticksettings - read joystick switch settings

Syntax char joysticksettings(void);

Prototype in ibm.h

Remarks reads the joystick switch settings.

Return value returns the joystick switch settings.

See also isgameport(), joystickAx(), joystickAy(),
joystickBx(), joystickBy()



















































TCHK 2.1 Page 210


Function Jul... - family of Julian date conversion
functions

Syntax double JultoCal(double jul);
double JultoCalCent(double jul);
char *JultoGreg(double jul);
char *JultoGregEuro(double jul);
char *JultoGregJap(double jul);
struct ddate *Jultoddate(double jul);

double JulAtoCal(double jul);
double JulAtoCalCent(double jul);
char *JulAtoGreg(double jul);
char *JulAtoGregEuro(double jul);
char *JulAtoGregJap(double jul);
struct ddate *JulAtoddate(double jul);

double JulBtoCal(double jul);
double JulBtoCalCent(double jul);
char *JulBtoGreg(double jul);
char *JulBtoGregEuro(double jul);
char *JulBtoGregJap(double jul);
struct ddate *JulBtoddate(double jul);

Prototype in datehk.h

Remarks Jul.toCal converts a Julian date to Calendar
date
Jul.toCalCent converts a Julian date to Calendar
date (w/century)
Jul.toGreg... converts a Julian date to the
appropraite Gregorian date
Jul.toddate converts a Julian date to struct ddate

Return value Jul.toCal return a Calendar date
Jul.toCalCent return a Calendar date (w/century)
Jul.toGreg.. return the appropriate Gregorian date
Jul.toddate return a struct ddate

See also Appendix A
Cal...(), date_convert(), ddatetofull(),
ddatetoshort(), ddatetostr(), fulltoddate(),
Greg...(), monthexpand(), shorttoddate(),
strtoddate()

Example see demodate.c

















TCHK 2.1 Page 211


Function keyclick - turn on key click

Syntax void keyclick(boolean on);

Prototype in keyboard.h

Remarks keyclick() will enable or disable key clicking
depending on the value of the parameter on.

Return value nothing.

Note This function only works on the PC Convertible and
PCjr.


















































TCHK 2.1 Page 212


Function leftstr - return the left portion of a string

Syntax char *leftstr(char *source, int len);

Prototype in stringhk.h

Remarks leftstr performs just like its BASIC counterpart
LEFT$().

leftstr returns the left part of a string.

Return value leftstr returns the leftmost len characters of
source. If the length of source is less than len,
the entire string is returned.

leftstr returns a pointer to the storage location
containing the new string, or NULL if space could
not be allocated.

See also midstr(), rightstr()

Example #include
#include /* for the printf */

main()
{
char msg[25], *l;

strcpy(msg,"This is another test");
l = leftstr(msg,7);
printf("%s\n",msg);
printf("%s\n",l);
}

Program output This is another test
This an



























TCHK 2.1 Page 213


Function litebar_alloc - allocate memory for a litebar
menu

Syntax struct litebar_header *litebar_alloc(int left, int
top, int right, int bottom, char *frame,
char *title, int titlejustify, int count,
char *command[], int cmdleft[], int
cmdright[], int cmdup[], int cmddown[],
int cmdkey[], char cmdflag[], int cmdx[],
int cmdy[], char *message[], int msgx,
int msgy, int argq, int quitkey[], int
colframe, int coltitle, int colnorm, int
colcmdkey, int colhilite, int coldisable,
int coldishilite, int colnotopt, int
colmessage, int defaultcommand, unsigned
flags);

Prototype in menuhk.h

Remarks litebar_alloc creates a litebar menu with the
following information:

Coordinates of the frame of the litebar menu are
(left,top) to (right,bottom), the border, if any,
is made up of the 9 or 11 chars in frame (0 to 8 or
10) as per boxwindow(), with an optional title on
the top edge of the menu border, justified left,
right or center (see howard.h for more details). If
frame == NULL there will be no border. If
titlejustify = NONE there will be no title, or
pre-/post-title separators.

Unlike the popup menus, a count parameter is
required, specifiying how many commands there are.
The command array is a list of strings or text to
be displayed on the screen.

The cmdleft, cmdright, cmdup and cmddown parameters
are lists of where the respective key will move the
hilite bar. These values should correspond to an
index of the command[], with the exception noted
below. For example, if the hilite bar is on
command[0] and you wish the right arrow to move to
command[10], then cmdright[0] = 10. The exception
is when an arrow is to be disabled. Specifying a -1
as a direction element will disable that direction
for that command (i.e. at command[0] to make the
left arrow do nothing, then cmdleft[0] = -1.)

Each command can have a hotkey associated with it,
denoted by the appropriate cmdkey[]. The 'hotkey'
is actually a one-touch key, instantly moving to
and selecting a choice. The cmdkey value is an










TCHK 2.1 Page 214

offset into the command string. For example, a
command "Edit" with a hotkey of the "E" would have
a cmdkey value of 0 (an offset from the beginning
of the command). A command without a hotkey has a
cmdkey value of -1.

Each command has an appropriate cmdflag field. A
command may be either:

ENABLED - a valid choice
DISABLED - displayed, but not selectable
NOTOPTION - not a command (static text)

These are defined in menuhk.h. Other values may
cause unpredictable results.

The cmdx and cmdy arrays are lists of where the
commands should be displayed, respective to the
box. This is in a 'windowing' sense. If the box
coordinates are (10,10) to (20,20) and you wish
something to appear at the physical coordinates
(12,10) then (cmdx,cmdy) for the proper command
should be (2,0). This is an exception to the normal
coordinate system beginning at (1,1). In a litebar
menu, the 'border' is not excluded from the display
output and can be written over (this is true
regardless of whether or not a frame is displayed.)

TCHK litebar menus can display a message for each
command as it is hilited, much like Lotus style
menus. This message is optional, and if the
appropriate message[] is not NULL, it will be
displayed at (msgx,msgy). If the message[] element
is NULL, no message will be displayed. These
coordinates are relative to the menu coordinates,
just as cmdx and cmdy are.

A list of key codes that cause immediate return of
the user selection of the menu are in the quitkey
list, consisting of argq elements.

The following colors are used:

colframe - frame around menu (if any)
coltitle - title (if any)
colnorm - enabled commands
colcmdkey - hotkey in command
colhilite - currently hilited option
coldisable - disabled options
coldishilite - disabled and currently
hilited
colnotopt - static text (NOTOPTION)
colmessage - message (if any)











TCHK 2.1 Page 215

defaultcommand is the command initially hilited. If
an invalid command is chosen (the command is static
text, or does not exist, etc.) the first valid
command is the default.

flags is a 2-byte bit field of flags

QEFxxxxH UDIRCEDW

where

Q = Quit after selection
E = ESC means quit
F = Free memory on quit
H = Hierarchial menu (not implemented yet)

U = call _idle_menu() after keyboard input
D = free time slices under DESQview
I = cmdkeys are case Independent
R = Restore cursor before returning
C = don't hide Cursor
E = Erase menu on free/cleanup
D = Disabled not hiliteable
W = Wraparound

Briefly, Quit will restore the display to the state
it was in before the litebar menu was called
(settextinfo(), etc.). With E, if ESC is pressed
the menu is removed, for any other selection no
cleanup is done (unless Q is specified). Free
memory on quit calls litebar_free() after a
selection is made. Hierarchial menus are not
implemented yet. Keys are input via inkey(),
inkeyc(), inkeydv() or inkeycdv(), depending on
case Independency and freeeing time slices under
DESQview. When litebar_get() is called, the cursor
is hidden unless C is given. The cursor is unhidden
only if R is given. E will cause the menu to be
erased from the screen if quitting. Disabled
commands are normally selectable, unless D is on.
Wraparound allows the selecting hilite bar to wrap
over the top and under the bottom.

After input is polled, if the user defined function
flag is set (UDFIDLE) the function _idle_menu is
called. Currently, the definition of _idle_menu is:

int _idle_menu(void)

Possible uses for such a function is an onscreen
clock, printing, or some other background task. In
the future _idle_menu() will receive releveant












TCHK 2.1 Page 216

parameters. To define _idle_menu as the user
defined function int myfunction(void), try:

_idle_menu = (far *)myfunction;

The full definition for _idle_menu() is:

int (far *_idle_menu)(void);

You should declare myfunction() as type int, with
void parameters, and you should typecast the
function as a far pointer when you assign it to
_idle_menu.

Return value allocates and returns a pointer to a litebar header
structure if the menu was successfully created,
otherwise returns NULL if an error occurred.
litebarerrno will have the following values:

0 success
1 error, could not allocate litebar header
2 error, could not allocate videosave
3 error, could not allocate menusave
4 error, invalid title justification
5 error, could not allocate popup field
7 error, no menu item enabled (no commands)
8 error, could not allocate quit keylist

Note The litebar_header structure contains important
information about the menu, including pointers to
linked lists for the fields, saved video displays,
etc. I strongly advise that you don't even think of
modifying this information yourself. Let the
litebar...() functions handle it for you. These
functions have been developed and used over a
period of several months, programs and conditions
which proves them to be virtually bug free. If you
really want to mess with them yourself, feel free.
But I certainly wouldn't want to attempt it.
Modifying these functions even with the source code
is a headache.

See also menuhk.h
changelitebar(), isHiliteable(), litebar_free(),
litebar_get(), litehilite(), litemessage(),
liteunlite(), menu_litebar()
litebarerrno

Example see demolite.c















TCHK 2.1 Page 217


Function litebar_free - frees memory allocated by a
litebar menu

Syntax void litebar_free(struct litebar_header *lh);

Prototype in menuhk.h

Remarks frees all memory allocated to a litebar menu.

Return value nothing.

Note see litebar_alloc()

See also menuhk.h
changelitebar(), isHiliteable(), litebar_alloc(),
litebar_get(), litehilite(), litemessage(),
liteunlite(), menu_litebar()
litebarerrno

Example see demolite.c











































TCHK 2.1 Page 218


Function litebar_get - get user's choice from a litebar
menu

Syntax int litebar_get(struct litebar_header *lh);

Prototype in menuhk.h

Remarks litebar_get does the actual prompting the user for
input. The following keys can be used to navigate
in the menu:

Up, Down, Move select bar to another
Left, Right command, as per parms to
litebar_alloc(). See
litebar_alloc() for more
details.
ENTER Select the hilited option
ESC Abort

in addition to any cmdkeys and quitkeys.

Other actions may be taken before returning from
this function, according to the flags for the menu.
See litebar_alloc() for more details.

Return value returns zero if ESC was hit. If an command was
chosen, litebar_get() returns the number of the
command selected. This is not the array index of
the command. If command[] has 3 static text items
and a command, and the command is selected, a 1
will be returned, even though the command is the
fourth command with a command index of three
(command[3]). If a quitkey was hit, the return
value will be the key code for the quitkey, plus
1000 (i.e. Ctrl-Z, key code 26, as a quitkey will
return 1026 when it is hit.)

See also menuhk.h
changelitebar(), isHiliteable(), litebar_alloc(),
litebar_free(), litehilite(), litemessage(),
liteunlite(), menu_litebar()
litebarerrno

Example see demolite.c



















TCHK 2.1 Page 219


Function litehilite - hilite a litebar menu command

Syntax void litehilite(struct litebar_header *lh);

Prototype in menuhk.h

Remarks displays a litebar menu command in the hilited
color via Borland's console i/o.

This function is used internally by several
litebar...() menu functions.

Return value nothing.

Note This function is for internal uses only.

See also menuhk.h
changelitebar(), isHiliteable(), litebar_alloc(),
litebar_free(), litebar_get(), litemessage(),
liteunlite(), menu_litebar()
litebarerrno










































TCHK 2.1 Page 220


Function litemessage - change the message for a litebar
menu

Syntax void litemessage(struct litebar_header *lh,
int len);

Prototype in menuhk.h

Remarks changes the message for a litebar menu.

This function is used internally by several
litebar...() menu functions.

Return value nothing.

Note This function is for internal uses only.

See also menuhk.h
changelitebar(), isHiliteable(), litebar_alloc(),
litebar_free(), litebar_get(), litehilite(),
liteunlite(), menu_litebar()
litebarerrno









































TCHK 2.1 Page 221


Function liteunlite - unhilite a litebar menu command

Syntax void liteunlite(struct litebar_header *lh);

Prototype in menuhk.h

Remarks displays a litebar menu command in its unhilited
color(s).

This function is used internally by several
litebar...() menu functions.

Return value nothing.

Note This function is for internal uses only.

See also menuhk.h
changelitebar(), isHiliteable(), litebar_alloc(),
litebar_free(), litebar_get(), litehilite(),
litemessage(), menu_litebar()
litebarerrno










































TCHK 2.1 Page 222


Function longtodostime - convert 1/100 seconds to DOS time

Syntax struct time longtodostime(long t);

Prototype in timehk.h

Remarks this function will convert the time from a long
value of the time in 1/100s of a second to a DOS
time structure.

Return value returns the time as a DOS time structure.

See also dostimetolong()


















































TCHK 2.1 Page 223


Function lpow - raise a base to an exponent

Syntax long lpow(long base, int exponent);

Prototype in real.h

Remarks lpow() calculates base raised to the exponent
power. If base is zero or exponent is negative
(lpow() does not handle either of these cases), it
is treated as a singularity error (_rmatherror =
RSING). Underflow and overflow are trapped with the
appropriate error value in _rmatherror.

Return value returns zero if an error occurred, with an
appropriate error value in _rmatherror, otherwise
the calculated value (non-zero).

Note This function is called internally by several
simulated FP functions. Refer to the section
SIMULATED FP MATH for further details.

See also real.h
_rmatherror








































TCHK 2.1 Page 224


Function lsgn - sign of a long integer

Syntax #include
(int) lsgn(x)

Prototype in mathhk.h

Remarks lsgn will determine the sign of x. Zero is
considered positive.

This function is a macro.

The macro lsign() is defined as lsgn().

Return value returns -1 if x is negative, otherwise 1.

See also fsgn(), isgn()














































TCHK 2.1 Page 225


Function ltrim - trims leading blanks

Syntax char *ltrim(char *source);

Prototype in stringhk.h

Remarks remove leading blanks in a string. The string
passed to ltrim (source) is modified.

Return value returns a pointer to source.

Example #include
#include /* for the printf */

main()
{
char msg[25] = " Hello everyone ";

printf("String [%s]\n",msg);
printf("ltrim [%s]\n",ltrim(msg));
}

Program output String [ Hello everyone ]
ltrim [Hello everyone ]







































TCHK 2.1 Page 226


Function machine_id - determine machine type

Syntax int machine_id(void);

Prototype in ibm.h

Remarks identifies the machine by use of the ROM byte and
model byte (available through a DOS call.)

Return value returns a code number depending on the machine
type. See ibm.h for more details.

Note This function cannot differentiate between a PS/2
Model 25 and PS/2 Model 30. However, the Model 30
has a hard drive, the Model 25 has none. For now
the Model 30 return code means the presence of a
Model 30 or a Model 25.

The PS/2 Model 70 cannot currently be identified
properly.

Also, the Portable PC cannot be 100% identified
through this function. Aside from the ROM byte
(which is identical to the XT) I don't know of any
distinguishing criteria. Anyone have ideas?

See also ibm.h
cpu_id(), ndp_id(), ROM_date(), ROM_id()

Example #include

main()
{
printf("Machine ID() code = %d\n",
machine_id());
}

Program output Machine ID code = 1 /* on my PC */

























TCHK 2.1 Page 227


Function MButtonPress - mouse button press data

Syntax int MButtonPress(int button);

Prototype in mousehk.h

Remarks determines button press information for the given
button, where the parameter button is 0 for the
left button, 1 for the right button, and 2 for the
middle button (Mouse Systems mouse).

_mouse1 is a bit field

xxxxxxxx xxxxxMRL

where

M = middle button pressed
R = right button pressed
L = left button pressed

_mouse2 contains the number of times the specified
button has been pressed since the last call.

the specified button was last pressed at the
coordinate (_mouse3,_mouse4)

Return value returns the number of times the button has been
pressed since the last call.

See also MButtonRelease(), MButtonStatus()

Example see demomous.c






























TCHK 2.1 Page 228


Function MButtonRelease - mouse button release data

Syntax int MButtonRelease(int button);

Prototype in mousehk.h

Remarks determines button release information for the given
button, where the parameter button is 0 for the
left button, 1 for the right button, and 2 for the
middle button (Mouse Systems mouse).

_mouse1 is a bit field

xxxxxxxx xxxxxMRL

where

M = middle button released
R = right button released
L = left button released

_mouse2 contains the number of times the specified
button has been released since the last call.

the specified button was last released at the
coordinate (_mouse3,_mouse4)

Return value returns the number of times the button has been
released since the last call.

See also MButtonPress(), MButtonStatus()

Example see demomous.c






























TCHK 2.1 Page 229


Function MButtonStatus - mouse position and button status

Syntax int MButtonRelease(void);

Prototype in mousehk.h

Remarks determines mouse position and button status
information.

_mouse2 is a bit field

xxxxxxxx xxxxxMRL

where

M = middle button pressed
R = right button pressed
L = left button pressed

the mouse is at the coordinate (_mouse3,_mouse4)

Return value returns the mouse button status information (see
_mouse2 above).

See also MButtonPress(), MButtonRelease()

Example see demomous.c




































TCHK 2.1 Page 230


Function MCursorGraphic - define graphic cursor

Syntax void MCursorGraphic(int hotx, int hoty,
char *bitmap);

Prototype in mousehk.h

Remarks defines the mouse cursor used in graphic mode. The
hotx and hoty parameters are the x and y
coordinates of the hot spot in the bitmap (-16 to
16).

The parameter bitmap is a pointer to a graphic
cursor bitmap, comprising of a 16 word screen mask
and a 16 word cursor mask (64 bytes in total). See
Appendix E for more details.

Return value nothing.

See also MCursorOff(), MCursorOn(), MCursorRangex(),
MCursorRangey(), MGotoxy(), MCursorText()

Example see Appendix E
see demomous.c







































TCHK 2.1 Page 231


Function MCursorOff - turns off (hide) the mouse cursor

Syntax void MCursorOff(void);

Prototype in mousehk.h

Remarks turns the mouse cursor off (hides the mouse
cursor). This function is nestable, so multiple
calls to MCursorOff() to hide the mouse cursor will
require multiple calls to MCursorOn() to unhide it.

Return value nothing.

See also MCursorOn(), MCursorGraphic(), MCursorRangex(),
MCursorRangey(), MCursorText(), MGotoxy()

Example see demomous.c














































TCHK 2.1 Page 232


Function MCursorOn - turns on (show) the mouse cursor

Syntax void MCursorOn(void);

Prototype in mousehk.h

Remarks turns the mouse cursor on (shows the mouse cursor).

Return value nothing.

See also MCursorOff(), MCursorGraphic(), MCursorRangex(),
MCursorRangey(), MCursorText(), MGotoxy()

Example see demomous.c

















































TCHK 2.1 Page 233


Function MCursorRangex - define horizontal cursor range

Syntax void MCursorRangex(int left, int right);

Prototype in mousehk.h

Remarks defines the minimum and maximum x-coordinates the
mouse may move to.

Return value nothing.

See also MCursorOff(), MCursorOn(), MCursorGraphic(),
MCursorRangey(), MCursorText(), MGotoxy()

Example see demomous.c
















































TCHK 2.1 Page 234


Function MCursorRangey - define vertical cursor range

Syntax void MCursorRangey(int top, int bottom);

Prototype in mousehk.h

Remarks defines the minimum and maximum y-coordinates the
mouse may move to.

Return value nothing.

See also MCursorOff(), MCursorOn(), MCursorGraphic(),
MCursorRangex(), MCursorText(), MGotoxy()

Example see demomous.c
















































TCHK 2.1 Page 235


Function MCursorText - define text cursor

Syntax void MCursorText(boolean usehardware, int parm1,
int parm2);

Prototype in mousehk.h

Remarks defines the mouse cursor used in text mode. If
usehardware is TRUE, parm1 is the screen mask and
parm2 is the cursor mask. Otherwise, parm1 is the
starting scan line and parm2 is the ending scan
line.

If the software cursor is selected, the
character/attribute data at the current screen
position is ANDed with the screen mask and then
XORed with the cursor mask.

Return value nothing.

See also MCursorOff(), MCursorOn(), MCursorGraphic(),
MCursorRangex(), MCursorRangey(), MGotoxy()

Example see demomous.c







































TCHK 2.1 Page 236


Function MDriverSize - get driver storage requirements

Syntax unsigned int MDriverSize(void);

Prototype in mousehk.h

Remarks determines the size of a buffer needed to store the
driver state.

Return value returns the size of a buffer needed to store the
driver state.

See also MGetDriver(), MPutDriver()

Example see demomous.c
















































TCHK 2.1 Page 237


Function memory_strategy - get/set memory alloc strategy

Syntax int memory_strategy(boolean read, int *strategy);

Prototype in ibm.h

Remarks this function will get or set the memory allocation
strategy. The variable read determines whether the
function will read or write (get or set) the
strategy value stored at *strategy.

Return value returns zero if successful (and *strategy is the
strategy being used) or, if an error occurs, the
error code (in which case the value in *strategy is
meaningless.)

Note this function requires DOS 3.xx.

See also ibm.h

Example #include

#define GET TRUE /* read */
#define SET FALSE /* write */

main()
{
int memstrat;

if (memory_strategy(GET,&memstrat) !=
MEM_STRAT_BEST)
memory_strategy(SET,MEM_STRAT_BEST);
}
/* Bad, no error checking done. When you document
100+ functions, you write the best code, don't you? */




























TCHK 2.1 Page 238


Function MEmulateLightpenOff - mouse light pen emulation
off

Syntax void MEmulateLightpenOff(void);

Prototype in mousehk.h

Remarks turns off mouse emulation of a light pen.

Return value nothing.

See also MEmulateLightpenOn()

Example see demomous.c

















































TCHK 2.1 Page 239


Function MEmulateLightpenOn - mouse light pen emulation on

Syntax void MEmulateLightpenOn(void);

Prototype in mousehk.h

Remarks turns on mouse emulation of a light pen.

Return value nothing.

See also MEmulateLightpenOff()

Example see demomous.c


















































TCHK 2.1 Page 240


Function menu_litebar - litebar style menu

Syntax int menu_litebar(int left, int top, int right,
int bottom, char *frame, char
*title, int titlejustify, int count,
char *command[], int cmdleft[], int
cmdright[], int cmdup[], int
cmddown[], int cmdkey[], char
cmdflag[], int cmdx[], int cmdy[],
char *message[], int msgx, int msgy,
int argq, int quitkey[], int
colframe, int coltitle, int colnorm,
int colcmdkey, int colhilite, int
coldisable, int coldishilite, int
colnotopt, int colmessage, int
defaultcommand, unsigned flags);

Prototype in menuhk.h

Remarks an all-in-one function, menu_litebar() is
equivalent to calling litebar_alloc(),
litebar_get() and litebar_free(), with the flags
Quit, Erase menu, case Independent and Wraparound.
See litebar_alloc() and litebar_get for more
details about parameters and menu keys.

Return value returns zero if ESC was hit, otherwise returns the
number of the command selected. This is not the
array index of the command. If command[] has 3
static text items and a command, and the command is
selected, a 1 will be returned, even though the
command is the fourth command with a command index
of three (command[3]).

Note Use litebarpopup() when you want a one-shot menu,
and the litebar...() functions when you plan on
keeping the menu on the screen for multiple choices
(perhaps when overlaying submenus).

See also menuhk.h
changelitebar(), isHiliteable(), litebar_alloc(),
litebar_free(), litebar_get(), litehilite(),
litemessage(), liteunlite()
litebarerrno

Example see demolite.c

















TCHK 2.1 Page 241


Function menu_popup - popup style menu

Syntax int menu_popup(int left, int top, int right, int
bottom, char frame[], char *title,
int titlejustify, char *command[],
int cmdkey[], char cmdflag[], int
colframe, int coltitle, int colnorm,
int colcmdkey, int colhilite, int
coldisable, int coldishilite, int
colnotopt, int defaultcommand,
unsigned flags);

Prototype in menuhk.h

Remarks an all-in-one function, menu_popup() is equivalent
to calling popup_alloc(), popup_get() and
popup_free(), with the flags Quit, Erase menu, case
Independent and Wraparound. See popup_alloc() and
popup_get for more details about parameters and
menu keys.

Return value returns zero if ESC was hit, otherwise returns the
number of the command selected. This is not the
array index of the command. If command[] has 3
static text items and a command, and the command is
selected, a 1 will be returned, even though the
command is the fourth command with a command index
of three (command[3]).

Note Use menu_popup() when you want a one-shot menu, and
the popup...() functions when you plan on keeping
the menu on the screen for multiple choices
(perhaps when overlaying submenus).

See also menuhk.h
isHiliteable(), popup_alloc(), popup_free(),
popup_get(), popup_restore(), popup_setcurrent(),
pophilite(), popunlite()
popuperrno

Example see demopop.c






















TCHK 2.1 Page 242


Function MGetDisplayPage - get mouse display page number

Syntax unsigned MGetDisplayPage(void);

Prototype in mousehk.h

Remarks gets the mouse display page number.

Return value returns the mouse display page number.

See also MSetDisplayPage()

Example see demomous.c


















































TCHK 2.1 Page 243


Function MGetDriver - save mouse driver state

Syntax void MGetDriver(char far *savebuffer);

Prototype in mousehk.h

Remarks saves the driver state in the memory location
pointed to by savebuffer. Make sure savebuffer
points to sufficient allocated memory to save the
entire driver state or unpredictable results may
occur. See MDriverSize() to determine the size
needed to save the driver state.

Return value nothing.


See also MDriverSize(), MPutDriver()

Example see demomous.c













































TCHK 2.1 Page 244


Function MGetSensitivity - get mouse sensitivity

Syntax unsigned MGetSensitivity(void);

Prototype in mousehk.h

Remarks gets the mouse sensitivity.

_mouse2 is the horizontal mickey/pixel ratio, as
used by MSetRatio().

_mouse3 is the vertical mickey/pixel ratio, as used
by MSetRatio().

_mouse4 is the double speed threshold, as used by
MSetThreshold().

Return value returns the double speed threshold.

See also MSetRatio(), MSetSensitivity(), MSetThreshold()

Example see demomous.c









































TCHK 2.1 Page 245


Function MGetVerType - get software version and mouse type

Syntax unsigned int MGetVerType(void);

Prototype in mousehk.h

Remarks determines the mouse software version and the mouse
type.

_mouse1 is the major version number of the mouse
software

_mouse2 is the minor version number of the mouse
software

_mouse3 is the type of mouse, where:

1 = bus
2 = serial
3 = InPort
4 = PS/2
5 = HP

_mouse4 is the interrupt request line used by the
mouse, where:

0 = PS/2
2..7 = IRQ2..IRQ7

Return value returns the version number in the form major/minor
where the high byte is the major version number and
the low byte is the minor version number. If an
error occurred, 0xFFFF is returned and the mouse
variables _mouse# (# = 1 to 4) are all set to 0.

Note The global variables _mouse# do NOT return
registers on a 1-to-1 basis for this function.
Rather, _mouse1/_mouse2 form the BX register and
_mouse3/_mouse4 form the CX register.

Example see demomous.c






















TCHK 2.1 Page 246


Function MGotoxy - position mouse cursor

Syntax void MGotoxy(int x, int y);

Prototype in mousehk.h

Remarks positions the mouse cursor at the coordinate (x,y).

Return value nothing.

See also MCursorOff(), MCursorOn(), MCursorGraphic(),
MCursorRangex(), MCursorRangey(), MCursorText()

Example see demomous.c

















































TCHK 2.1 Page 247


Function mid - is a number within a range

Syntax #include
(boolean) mid(a,x,b)

Prototype in mathhk.h

Remarks mid checks if x is between a and b, inclusive.

This function is a macro.

Return value returns TRUE if x is between a and b, inclusive,
otherwise FALSE.

See also nmid()
















































TCHK 2.1 Page 248


Function midstr - return the middle portion of a string

Syntax char *midstr(char *source, int begin, int len);

Prototype in stringhk.h

Remarks midstr performs just like its BASIC counterpart
MID$().

midstr returns the middle part of a string.

Return value midstr returns the substring of source, using begin
as the offset from the beginning to start the
substring, for len characters.

midstr returns a pointer to the storage location
containing the new string, or NULL if space could
not be allocated.

See also leftstr(), rightstr()

Example #include
#include /* for the printf */

main()
{
char msg[25], *m;

strcpy(msg,"This is another test");

m = midstr(msg,5,7);
printf("%s\n",msg);
printf("%s\n",m);
}

Program output This is another test
is anot



























TCHK 2.1 Page 249


Function MMickeysMovedx - number of mickeys mouse moved
horizontally

Syntax int MMickeysMovedx(void);

Prototype in mousehk.h

Remarks determines the number of mickeys the mouse has
moved horizontally since the last call.

_mouse3 contains the number of mickeys the mouse
has moved horizontally since the last call.

_mouse4 contains the number of mickeys the mouse
has moved vertically since the last call.

Return value returns the number of mickeys the mouse has moved
horizontally since the last call.

Note positive values indicate down/right.

See also MMickeysMovedy()

Example see demomous.c







































TCHK 2.1 Page 250


Function MMickeysMovedy - number of mickeys mouse moved
vertically

Syntax int MMickeysMovedy(void);

Prototype in mousehk.h

Remarks determines the number of mickeys the mouse has
moved vertically since the last call.

_mouse3 contains the number of mickeys the mouse
has moved horizontally since the last call.

_mouse4 contains the number of mickeys the mouse
has moved vertically since the last call.

Return value returns the number of mickeys the mouse has moved
vertically since the last call.

Note positive values indicate down/right.

See also MMickeysMovedx()

Example see demomous.c







































TCHK 2.1 Page 251


Function monthexpand - convert a month abbrev to its name

Syntax char *monthexpand(int month);

Prototype in datehk.h

Remarks monthexpand returns the name of a month given its
numeric abbreviation.

monthexpand returns an element of a static char
array, so you should not make any changes directly
to the returned value, but rather copy the returned
value to a safe piece of memory.

Return value returns a pointer to the storage location
containing the date structure, or NULL if the month
given is invalid.

See also Months[], MonthAbbr[] (global variables)
Cal...(), date_convert(), ddatetofull(),
ddatetoshort(), ddatetostr(), fulltoddate(),
Greg...(), Jul...(), shorttoddate(), strtoddate()

Example #include

main()
{
printf("Month 4 = %s\n",monthexpand(4));
}

Program output Month 4 = April
































TCHK 2.1 Page 252


Function MouseReset - reset mouse software only

Syntax boolean MouseReset(void);

Prototype in mousehk.h

Remarks if a mouse is installed, MouseReset() will reset
the mouse software only, leaving the mouse hardware
alone. Unlike ismouse(), the number of buttons is
not detected via this function, nor is the mouse
itself reset, only the mouse software.

Return value returns TRUE if a mouse is installed, FALSE
otherwise.

See also ismouse(), MGetVerType()

Example see demomous.c













































TCHK 2.1 Page 253


Function MPutDriver - restore mouse driver state

Syntax void MPutDriver(char far *savebuffer);

Prototype in mousehk.h

Remarks restores the driver state from the memory location
pointed to by savebuffer.

Return value nothing.

See also MDriverSize(), MGetDriver()

Example see demomous.c

















































TCHK 2.1 Page 254


Function MSetDisplayPage - set mouse display page number

Syntax void MSetDisplayPage(unsigned page);

Prototype in mousehk.h

Remarks sets the mouse display page number to the value of
the parameter page.

Return value nothing.

See also MGetDisplayPage()

Example see demomous.c

















































TCHK 2.1 Page 255


Function MSetRatio - set mickey to pixel ratio

Syntax void MSetRatio(int mickeyx, int mickeyy);

Prototype in mousehk.h

Remarks sets the mickey to pixel ratio, where mickeyx is
the number of mickeys per 8 pixels horizontally
(default = 8) and mickeyy is the number of mickeys
per 8 pixels vertically (default = 16).

Return value nothing.

See also MGetSensitivity(), MSetSensitivity(),
MSetThreshold()

Example see demomous.c














































TCHK 2.1 Page 256


Function MSetSensitivity - set mouse sensitivity

Syntax void MSetSensitivity(int horiz, int vert,
int dspeedthresh);

Prototype in mousehk.h

Remarks sets the mouse sensitivity. The horiz and vert
parameters set the mickey/pixel ratio, as per
MSetRatio(), and the dspeedthresh parameter sets
the double speed threshold, as per MSetThreshold().

Return value nothing.

See also MGetSensitivity(), MSetRatio(), MSetThreshold()

Example see demomous.c














































TCHK 2.1 Page 257


Function MSetThreshold - set double speed threshold

Syntax void MSetThreshold(int speed);

Prototype in mousehk.h

Remarks sets the double speed threshold in mickeys/second,
according the the paramter speed. If speed == 0 a
default threshold speed of 64 mickeys/second is
used. When the mouse speed exceeds the threshold,
the cursor's on-screen motion is doubled.

Return value nothing.

See also MGetSensitivity(), MSetRatio(), MSetSensitivity()

Example see demomous.c














































TCHK 2.1 Page 258


Function MUpdateScreen - define screen region for updating

Syntax void MUpdateScreen(int left, int top, int right,
int bottom);

Prototype in mousehk.h

Remarks defines a region of the screen to be updated, from
the coordinates (left,top) to (right,bottom).

Return value nothing.

Note The mouse cursor is hidden during updating and must
be explicitly turned on again (via MCursorOn()) to
be visible.

See also MCursorOn()

Example see demomous.c












































TCHK 2.1 Page 259


Function ndp_id - identify the math coprocessor

Syntax int ndp_id(void);

Prototype in chiphk.h

Remarks ndp_id does some opcode magic to identify the
numerical data processor (math coprocessor as it's
commonly called.) If a math coprocessor is present,
ndp_id recognizes the 8087, 80287, and the 80387.

ndp_id does not check dip switches but uses the
recommended method of identifying a math chip by
opcode instructions.

Return value returns a value identifying the math coprocessor.
See chiphk.h for further details.

Note Other (not 8087, 287 or 387) chips will not be
identified correctly.

For some reason this function keeps crashing on my
machine. Consider this function under works, not
necessarily finished. If you figure out what the
problem is, please let me know. I hope to have it
bug free by the next release, but time is at a
premium.

See also cpu_id(), machine_id()


































TCHK 2.1 Page 260


Function nmid - is a number outside a range

Syntax #include
(boolean) nmid(a,x,b)

Prototype in mathhk.h

Remarks nmid checks if x is less than a or greater than b.

This function is a macro.

Return value returns TRUE if x is less than a or greater than b,
otherwise FALSE.

See also mid()
















































TCHK 2.1 Page 261


Function NumLock - set the Num Lock key state

Syntax void NumLock(boolean on);

Prototype in ibm.h

Remarks sets the Num Lock key state to the state selected
by the on parameter.

Return value nothing.

See also CapsLock(), InsLock(), ScrollLock()



















































TCHK 2.1 Page 262


Function parsefilename - parses a filename, supports paths

Syntax struct filespec *parsefilename(char *fspec);

Prototype in filehk.h

Remarks parsefilename parses a string pointed to by fspec
for a file name. The file name is placed in a
struct filespec as a drive, path, and filename.ext.
Wildcards are supported. The struct filespec is
returned as follows:

drive NULL (\0) if not given, else
drive letter
path NULL string ("") if not given,
else the path with a \ added to
the end of the path string
filename.ext NULL string ("") if no file
name given, else a filename.ext
as per standard DOS file names.

The filename.ext is not expanded (i.e. c:tchk.lib
has a filename.ext of tchk.lib, but c:tchk. has a
filename.ext of tchk., and c:tchk has a
filename.ext of tchk.).

parsefilename is intelligent enough to know that
c:. expands out to C:.\*.*, where . is a path.

parsefilename is very similar to Borland's
parsefnm(), except Borland's function does NOT
handle paths, whereas parsefilename will (since
parsefnm() is just a DOS call, and we all know who
writes that wonderful operating system MS-DOS,
don't we?)

Limited error checking is performed, so beware. The
string will be parsed properly, but errors due to
long strings (i.e. strlen(fspec) > 100) and other
miscellania can cause extensive damage due to
pointer manipulations.

Furthermore, an invalid string (i.e. C:\TC\;HK\Z.C)
will not be treated as an error. The string is
parsed from the beginning to look for a drive
letter, and scanned from the right to the left,
stopping at the first \. If a \ is found,
everything to the right of it is considered the
file name, everything to the left is the path
(excluding the drive). You are responsible for
making sure fspec is a valid DOS drive, path and
file name.











TCHK 2.1 Page 263

Return value parsefilename returns the DOS file name fspec
broken down into drive, path and filename.ext.

parsefilename returns a pointer to the storage
location containing the struct filespec, or NULL if
space could not be allocated.

See also getfilespec(), parsefnameext(), resolvepath()

Example see demopars.c






















































TCHK 2.1 Page 264


Function parsefnameext - parses a filename into name and
extension

Syntax struct fnameext *parsefnameext(char *filename);

Prototype in filehk.h

Remarks parsefnameext parses a string pointed to by
filename into its elements, filename and extension.
The struct fnameext is returned with the file name
and extension as fixed length strings, padded with
spaces as necessary.

parsefnameext is useful for separating a DOS
filename into its discrete parts.

Return value parsefnameext returns the DOS file name filename
broken down into the structure fnameext as the name
and extension.

parsefnameext returns a pointer to the storage
location containing the struct fnameext, or NULL if
space could not be allocated.

See also getfilespec(), parsefilename(), resolvepath()

Example see demopars.c




































TCHK 2.1 Page 265


Function pause - wait for a time or until a keypress

Syntax int pause(int wait);

Prototype in timehk.h

Remarks waits for a time, or until a key is pressed.
Similiar to delay(), but can be aborted by a
keypress. wait is given in 1/100s of a second

Return value returns zero if the time elapsed, otherwise the
scan code of the key pressed.



















































TCHK 2.1 Page 266


Function PMT - calculate the periodic payment required to
fully amortize a principal

Syntax double PMT(double principal, double interest, int
periods)

Prototype in finance.h

Remarks PMT calculates the periodic payment required to
fully amortize a principal over some amount of
periods.

Return value returns the periodic payment required to fully
amortize a principal over an amount of periods.

See also FV(), FVa(), PV(), PVa()















































TCHK 2.1 Page 267


Function popup_alloc - allocate memory for a popup menu

Syntax struct popup_header *popup_alloc(int left, int top,
int right, int bottom, char *frame,
char *title, int titlejustify, char
*command[], int cmdkey[], char
cmdflag[], int colframe, int
coltitle, int colnorm, int
colcmdkey, int colhilite, int
coldisable, int coldishilite, int
colnotopt, int defaultcommand,
unsigned flags);

Prototype in menuhk.h

Remarks popup_alloc creates a popup menu with the following
information:

Coordinates of the frame of the popup menu are
(left,top) to (right,bottom), the border is made up
of the 9 or 11 chars in frame (0 to 8 or 10) as per
boxwindow(), with an optional title on the top edge
of the menu border, justified left, right or center
(see howard.h for more details).

The command array is a list of strings or text to
be displayed on the screen. popup_alloc knows how
many commands it needs by the size of the box, one
per line (i.e. coordinates (1,1) to (10,5) would
need 3 commands since there are 3 lines inside the
popup box).

Each command can have a hotkey associated with it,
denoted by the appropriate cmdkey[]. The 'hotkey'
is actually a one-touch key, instantly moving to
and selecting a choice. The cmdkey value is an
offset into the command string. For example, a
command "Edit" with a hotkey of the "E" would have
a cmdkey value of 0 (an offset from the beginning
of the command). A command without a hotkey has a
cmdkey value of -1.

Each command has an appropriate cmdflag field. A
command may be either:

ENABLED - a valid choice
DISABLED - displayed, but not selectable
NOTOPTION - not a command (static text)

These are defined in menuhk.h. Other values may
cause unpredictable results.












TCHK 2.1 Page 268

The following colors are used:

colframe - frame around menu
coltitle - title (if any)
colnorm - enabled commands
colcmdkey - hotkey in command
colhilite - currently hilited option
coldisable - disabled options
coldishilite - disabled and currently
hilited
colnotopt - static text (NOTOPTION)

defaultcommand is the command initially hilited. If
an invalid command is chosen (the command is static
text, or does not exist, etc.) the first valid
command is the default.

flags is a 2-byte bit field of flags

QEFxxxxH UDIRCEDW

where

Q = Quit after selection
E = ESC means quit
F = Free memory on quit
H = Hierarchial menu (not implemented yet)

U = call _idle_menu() after keyboard input
D = free time slices under DESQview
I = cmdkeys are case Independent
R = Restore cursor before returning
C = don't hide Cursor
E = Erase menu on free/cleanup
D = Disabled not hilitable
W = Wraparound

Briefly, Quit will restore the display to the state
it was in before the popup menu was called
(settextinfo(), etc.). With E, if ESC is pressed
the menu is removed, for any other selection no
cleanup is done (unless Q is specified). Free
memory on quit calls popup_free() after a selection
is made. Hierarchial menus are not implemented yet.
Keys are input via inkey(), inkeyc(), inkeydv() or
inkeycdv(), depending on case Independency and
freeeing time slices under DESQview. When
popup_get() is called, the cursor is hidden unless
C is given. The cursor is unhidden only if R is
given. E will cause the menu to be erased from the
screen if quitting. Disbaled commands are normally
selectable, unless D is on. Wraparound allows the
selecting hilite bar to wrap over the top and under
the bottom.










TCHK 2.1 Page 269


After input is polled, if the user defined function
flag is set (UDFIDLE) the function _idle_menu is
called. Currently, the definition of _idle_menu is:

int _idle_menu(void)

Possible uses for such a function is an onscreen
clock, printing, or some other background task. In
the future _idle_menu() will receive releveant
parameters. To define _idle_menu as the user
defined function int myfunction(void), try:

_idle_menu = (far *)myfunction;

The full definition for _idle_menu() is:

int (far *_idle_menu)(void);

You should declare myfunction() as type int, with
void parameters, and you should typecast the
function as a far pointer when you assign it to
_idle_menu.

Return value allocates and returns a pointer to a popup header
structure if the menu was successfully created,
otherwise returns NULL if an error occurred.
popuperrno will have the following values:

0 success
1 error, could not allocate popup header
2 error, could not allocate videosave
3 error, could not allocate menusave
5 error, could not allocate popup field
6 error, could not allocate command string
7 error, no menu item enabled (no commands)

Note The popup_header structure contains important
information about the menu, including pointers to
linked lists for the fields, saved video displays,
etc. I strongly advise that you don't even think of
modifying this information yourself. Let the
popup...() functions handle it for you. These
functions have been developed and used over a
period of several months, programs and conditions
which proves them to be virtually bug free. If you
really want to mess with them yourself, feel free.
But I certainly wouldn't want to attempt it.
Modifying these functions even with the source code
is a headache.

See also menuhk.h
isHiliteable(), menu_popup(), popup_free(),
popup_get(), popup_restore(), popup_setcurrent(),










TCHK 2.1 Page 270

pophilite(), popunlite()
popuperrno

Example see demopop.c




























































TCHK 2.1 Page 271


Function popup_free - frees memory allocated by popup menu

Syntax void popup_free(struct popup_header *ph);

Prototype in menuhk.h

Remarks frees all memory allocated to a popup menu.

Return value nothing.

Note see popup_alloc()

See also menuhk.h
isHiliteable(), menu_popup(), popup_alloc(),
popup_get(), popup_restore(), popup_setcurrent(),
pophilite(), popunlite()
popuperrno

Example see demopop.c












































TCHK 2.1 Page 272


Function popup_get - get user's choice from a popup menu

Syntax int popup_get(struct popup_header *ph);

Prototype in menuhk.h

Remarks popup_get does the actual prompting the user for
input. The following keys can be used to navigate
in the menu:

Up Arrow Move select bar up one option
Down Arrow Move select bar down one option
Home Move select bar to first option
End Move select bar to last option
ENTER Select the hilited option
ESC Abort

in addition to any cmdkeys.

Other actions may be taken before returning from
this function, according to the flags for the menu.
See popup_alloc() for more details.

Return value returns zero if ESC was hit, otherwise returns the
number of the command selected. This is not the
array index of the command. If command[] has 3
static text items and a command, and the command is
selected, a 1 will be returned, even though the
command is the fourth command with a command index
of three (command[3]).

See also menuhk.h
isHiliteable(), menu_popup(), popup_alloc(),
popup_free(), popup_restore(), popup_setcurrent(),
pophilite(), popunlite()
popuperrno

Example see demopop.c

























TCHK 2.1 Page 273


Function popup_restore - restore video from a popup menu

Syntax void popup_restore(struct popup_header *ph);

Prototype in menuhk.h

Remarks restores the display overlaid by a popup menu and
appropriate display information.

This function is used internally by several
popup...() menu functions.

Return value nothing.

Note This function is for internal uses only.

See also menuhk.h
isHiliteable(), menu_popup(), popup_alloc(),
popup_free(), popup_get(), popup_setcurrent(),
pophilite(), popunlite()
popuperrno










































TCHK 2.1 Page 274


Function popup_setcurrent - set internal popup menu
information

Syntax int popup_setcurrent(struct popup_header *ph,
int current);
Prototype in

Remarks sets internal variables for a popup menu regarding
the currently hilited item.

This function is used internally by several
popup...() menu functions.

Return value returns return value for newly hilited command. IF
there are no other selectable commands, returns -1.

Note This function is for internal uses only.

See also menuhk.h
isHiliteable(), menu_popup(), popup_alloc(),
popup_free(), popup_get(), popup_restore(),
pophilite(), popunlite()
popuperrno








































TCHK 2.1 Page 275


Function pophilite - hilite a popup menu command

Syntax void pophilite(struct popup_header *ph);

Prototype in menuhk.h

Remarks displays a popup menu command in the hilited color
via Borland's console i/o.

This function is used internally by several
popup...() menu functions.

Return value nothing.

Note This function is for internal uses only.

See also menuhk.h
isHiliteable(), menu_popup(), popup_alloc(),
popup_free(), popup_get(), popup_restore(),
popup_setcurrent(), popunlite()
popuperrno










































TCHK 2.1 Page 276


Function popunlite - unhilite a popup menu command

Syntax void popunlite(struct popup_header *ph);

Prototype in menuhk.h

Remarks displays a popup menu command in its unhilited
color(s).

This function is used internally by several
popup...() menu functions.

Return value nothing.

Note This function is for internal uses only.

See also menuhk.h
isHiliteable(), menu_popup(), popup_alloc(),
popup_free(), popup_get(), popup_restore(),
popup_setcurrent(), pophilite()
popuperrno










































TCHK 2.1 Page 277


Function print_screen - issue a PrintScreen

Syntax int print_screen(void);

Prototype in printhk.h

Remarks issues a Print Screen command as if PrtSc were
pressed.

Return value returns zero if the PrtSc is done, a one if the
PtrSc is in progress and 0xFF is an error occurred.
See printhk.h for further information.

See also isPRINTavail(), PRINTadd(), PRINThold(),
PRINTpurge(), PRINTremove(), PRINTresume
















































TCHK 2.1 Page 278


Function PRINTadd - add a file to the print queue

Syntax int PRINTadd(char *filename, int level);

Prototype in printhk.h

Remarks adds a file to the print queue. The filename may
NOT have wildcards. The priority level is
determined by level.

Return value returns zero if no error occurred, otherwise
returns the error code. See printhk.h for a full
list of the error return codes.

Note requires DOS 3.1 or greater.

See also isPRINTavail(), PRINThold(), PRINTpurge(),
PRINTremove(), PRINTresume













































TCHK 2.1 Page 279


Function PRINThold - hold print queue for status read

Syntax int PRINThold(char far *queue);

Prototype in printhk.h

Remarks puts the print queue on hold and gets the status of
the print queue. The parameter queue is a far
pointer to a series of filename entries. Each entry
is 64 bytes long and contains a null terminated
string that is a file specification. The first file
specification in the queue is the one currently
being printed. The last slot in the queue is an
empty string (the first byte is '\0').

The print queue will not resume until a
PRINTresume() is issued.

Return value returns zero if no error occurred, otherwise
returns the error code. See printhk.h for a full
list of the error return codes.

Note requires DOS 3.1 or greater.

See also isPRINTavail(), PRINTadd(), PRINTpurge(),
PRINTremove(), PRINTresume





































TCHK 2.1 Page 280


Function PRINTpurge - remove all files from print queue

Syntax int PRINTpurge(void);

Prototype in printhk.h

Remarks removes all files from the print queue.

Return value returns zero if no error occurred, otherwise
returns the error code. See printhk.h for a full
list of the error return codes.

Note requires DOS 3.1 or greater.

See also isPRINTavail(), PRINTadd(), PRINThold(),
PRINTremove(), PRINTresume















































TCHK 2.1 Page 281


Function PRINTremove - remove a file from print queue

Syntax int PRINTremove(char *filename, int level);

Prototype in printhk.h

Remarks removes a file from the print queue. Wildcards are
allowed, so multiple files may be removed from the
queue with one call.

Return value returns zero if no error occurred, otherwise
returns the error code. See printhk.h for a full
list of the error return codes.

Note requires DOS 3.1 or greater.

See also isPRINTavail(), PRINTadd(), PRINThold(),
PRINTpurge(), PRINTresume













































TCHK 2.1 Page 282


Function PRINTresume - resume printing after a PRINThold

Syntax int PRINTresume(void);

Prototype in printhk.h

Remarks resumes printing from the print queue after a
PRINTresume() has been issued. The print queue will
not resume until a PRINTresume() is issued.

Return value returns zero if no error occurred, otherwise
returns the error code. See printhk.h for a full
list of the error return codes.

Note requires DOS 3.1 or greater.

See also isPRINTavail(), PRINTadd(), PRINThold(),
PRINTpurge(), PRINTremove()













































TCHK 2.1 Page 283


Function putk - put a character w/attribute on the screen

Syntax void putk(byte c);

Prototype in video.h

Remarks putk puts character c on the screen at the cursor
via INTerrupts. The cursor does NOT advance. The
attribute is set with the global variable
char_attribute.

Return value nothing.

See also putsay(), putstr(), set_color()

Example #include

main()
{
gotohv(12,40);
putk('*');
}









































TCHK 2.1 Page 284


Function putsay - put a string with attribute on the
screen

Syntax void putsay(int col, int row, byte *c);

Prototype in video.h

Remarks putsay puts string c on the screen at location
(col,row) via direct screen writes. It does retrace
checking to prevent snow on CGA systems. The
attribute is set with the global variable
char_attribute.

Return value nothing.

See also putk(), putstr(), set_color()

Example #include

main()
{
putstr(12,40,(byte *)"Hello");
}








































TCHK 2.1 Page 285


Function putstr - put string with attribute on the screen

Syntax void putstr(byte *c);

Prototype in video.h

Remarks putstr puts string c on the screen at the cursor
via INTerrupts. When finished the cursor will be 1
spot after the string. The attribute is set with
the global variable char_attribute.

Return value nothing.

See also putk(), putsay(), set_color()

Example #include

main()
{
gotohv(12,40);
putstr((byte *)"Hello");
}









































TCHK 2.1 Page 286


Function PV - calculate the Present Value of a single
amount

Syntax double PV(double payment, double interest, int
periods)

Prototype in finance.h

Remarks PV calculates the Present Value of a single amount
given the future value of the principal, the
interest rate per period and the number of periods.

Return value returns the present value of a single amount.

See also FV(), FVa(), PMT(), PVa()
















































TCHK 2.1 Page 287


Function PVa - calculate the Present Value of an annuity

Syntax double PVa(double payment, double interest, int
periods)

Prototype in finance.h

Remarks PVa calculates the Present Value of an annuity
given the amount of each payment, the interest rate
per period and the number of periods.

Return value returns the present value of an annuity.

See also FV(), FVa(), PMT(), PV()

















































TCHK 2.1 Page 288


Function radd - add two REAL numbers

Syntax struct REAL radd(struct REAL val, struct REAL sval,
int precision);

Prototype in real.h

Remarks val and sval are added together. The result will
have precision decimal places. See rsub() for more
details.

Return value returns val plus sval to the specified precision.
See rsub() for further details.

See also _r_minpre, _rmatherr
rceil(), rdiv(), rfloor(), rnegate(), rnormalize(),
rsign(), rsub()














































TCHK 2.1 Page 289


Function rceil - rounds up

Syntax long rceil(struct REAL rx);

Prototype in real.h

Remarks rceil finds the smallest integer not less than rx.

Refer to the section SIMULATED FP MATH for further
details.

Return value rceil returns the integer found (as a long).

See also _r_minpre, _rmatherr
radd(), rdiv(), rfloor(), rnegate(), rnormalize(),
rsign(), rsub()















































TCHK 2.1 Page 290


Function rdiv - divide using REAL math

Syntax struct REAL rdiv(long int numer, long int denom,
int precision);

Prototype in real.h

Remarks rdiv divides numer by denom to precision decimal
places, returning the quotient as a REAL. The
actual value is calculated to precision+1 accuracy
and rounded to precision accuracy.

Errors, such as division by zero and requests for a
quotient with a precision larger than the maximum
precision allowed, are trapped and the returned
structure's rint and rfrac values will be -1. If
division by zero occurs, precision will be -1 and
the error code will be RDIVBYZERO. If the precision
requested is greater than the maximum allowed
precision, precision will be set to MAXPRECISION
and the error code will be RPLOSS.

Refer to the section SIMULATED FP MATH for further
details.

Return value returns numer divided by denom as a REAL with
precision decimal places. If an error occurred, the
returned structure's values will all be -1 (rint,
rfrac and precision) and _rmatherr will contain the
error code.

See also _rmatherr
radd(), rceil(), rfloor(), rnegate(), rnormalize(),
rsign(), rsub()





























TCHK 2.1 Page 291


Function read_attrib - gets the attribute under the cursor

Syntax byte read_attrib(void);

Prototype in video.h

Remarks gets the attribute under the cursor via INT 0x10,
Function 9.

Return value returns the attribute under the cursor.

See also read_char()



















































TCHK 2.1 Page 292


Function read_char - gets the character under the cursor

Syntax byte read_char(void);

Prototype in video.h

Remarks gets the character under the cursor via INT 0x10,
Function 9.

Return value returns the character under the cursor.

See also read_attrib()



















































TCHK 2.1 Page 293


Function read_cursor - reads cursor information

Syntax unsigned int read_cursor(int *row, int *col);

Prototype in video.h

Remarks reads the cursor location and scan lines via
INTerrupts.

Return value returns the scan lines of the cursor as a word, the
high order byte the start and low order byte the
end.

See also cursor_blink(), cursor_flip(), cursor_off(),
cursor_on(), getcursor(), set_cursor(),
setcursor(), whereh(), wherev()

Example #include

main()
{
int x,y;
unsigned int scan;

scan = read_cursor(&x,&y);
printf("Scan start %d and end %d\n",
scan&0xFF00, scan&0xFF);
}

Program output Scan start 6 and end 7 /* on CGA */

































TCHK 2.1 Page 294


Function read_mode - find screen width, mode and page

Syntax void read_mode(byte *width, byte *mode,
byte *page);

Prototype in video.h

Remarks detects the screen width (number of columns,) video
mode and video page via INT 0x10, Service 0x0F.

Return value nothing.

See also video.h
set_mode()

Example #include

main()
{
byte width, mode, page;

read_mode(&width, &mode, &page);
printf("# columns: %d Mode: %d Page: %d\n",
width, mode, page);
}

Program output # columns: 80 Mode: 3 Page: 1




































TCHK 2.1 Page 295


Function reboot - reboots the machine

Syntax void reboot(boolean warmboot);

Prototype in ibm.h

Remarks calling this function will reboot your machine via
the ROM reboot code located at F000:000. You can
specify a warm or cold boot (like hitting

CTRL-ALT-DEL or turning the power on.)

Return value nothing.

Example #include

main()
{
boolean bootstyle;

/* set bootstyle */
reboot(bootstyle);
}









































TCHK 2.1 Page 296


Function ResetPointDevice - Pointing Device BIOS Interface
Reset Interface

Syntax int ResetPointDevice(void);

Prototype in ibm.h

Remarks ResetPointDevice() will reset the pointing device
interface.

Return value returns the device id on success and -1 on failure.
The success code is stored in Borland's global
variable errno. Here are the possible error values:

0x00 Success
0x01 Invalid function
0x02 Invalid input
0x03 Interface error
0x04 Need to resend
0x05 No device handler installed

Because the device id is returned, you should cross
check any returned value of -1 with errno to insure
the function did fail. Only if -1 is returned AND
errno != 0 did the function fail.

Note This function is only available on PS/2 machines or
under DESQview 2.x.

See also GetTypePointDevice(), SetPointDevice(),
SetRatePointDevice(), SetResPointDevice()
































TCHK 2.1 Page 297


Function resolvepath - resolve a path to a fully qualified
path

Syntax char *resolvepath(char *str, char *buffer);

Prototype in filehk.h

Remarks resolvepath uses an internal DOS Function (0x60)
only available under DOS 3.x (and probably later
versions.) The path string is expanded into a fully
qualified path with the results placed in buffer.

Borland provides access to a similar function
parsfnm() which calls a DOS function. However,
parsfnm() can NOT handle paths (drive, filename and
extension only.)

Return value returns a pointer to buffer.

See also getfilespec(), parsefilename(), parsefnameext()











































TCHK 2.1 Page 298


Function rfloor - rounds down

Syntax long rfloor(struct REAL rx);

Prototype in real.h

Remarks rfloor finds the largest integer not greater than
rx.

Refer to the section SIMULATED FP MATH for further
details.

Return value rfloor returns the integer found (as a long).

See also _r_minpre, _rmatherr
radd(), rceil(), rdiv(), rnegate(), rnormalize(),
rsign(), rsub()














































TCHK 2.1 Page 299


Function rightstr - return the right portion of a string

Syntax char *rightstr(char *source, int len);

Prototype in stringhk.h

Remarks rightstr performs just like its BASIC counterpart
MID$().

rightstr returns the middle part of a string.

Return value rightstr returns the rightmost len characters of
source. If the length of source is less than len,
the entire string is returned.

rightstr returns a pointer to the storage location
containing the new string, or NULL if space could
not be allocated.

See also leftstr(), midstr()

Example #include
#include /* for the printf */

main()
{
char msg[25], *r;

strcpy(msg,"This is another test");
r = right(msg,7);
printf("%s\n",msg);
printf("%s\n",r);
}

Program output This is another test
er test



























TCHK 2.1 Page 300


Function rnegate - change sign

Syntax struct REAL *rnegate(struct REAL *rx);

Prototype in real.h

Remarks rnegate changes the sign of rx. Since REALs are
structures and not actual variables, you cannot
simply say rx = -rx;

Refer to the section SIMULATED FP MATH for further
details.

Return value rnegate returns a pointer to the negated real rx.

See also _r_minpre, _rmatherr
radd(), rceil(), rdiv(), rfloor(), rnormalize(),
rsign(), rsub()













































TCHK 2.1 Page 301


Function rnormalize - fix precision

Syntax void rnormalize(struct REAL *r1, struct REAL *r2);

Prototype in real.h

Remarks rnormalize normalizes the precision of the reals r1
and r2, such that both values have equal precision.
Only the precision and fractional portion of the
real adjusted will be modified.

If _r_maximum is TRUE, the number with the smaller
precision has its fractional portion extended to
match the precision of the other real. If
_r_maximum is FALSE, the number with the larger
precision has its fractional portion truncated to
match the precision of the other real.

After returning, the global variables _r_maxpre and
_r_minpre will contain the minimum and maximum
precision of the reals r1 and r2 before any
adjustments were made.

Refer to the section SIMULATED FP MATH for further
details.

Return value nothing.

See also _r_maximum, _r_maxpre, _r_minpre
radd(), rceil(), rdiv(), rfloor(), rnegate(),
rsign(), rsub()
































TCHK 2.1 Page 302


Function ROM_date - gets the ROM id date

Syntax byte ROM_date(void);

Prototype in ibm.h

Remarks finds the ROM id date at F000:FFF5

Return value returns a pointer to the storage location
containing the string, or NULL if space could not
be allocated.

See also ibm.h
machine_id(), ROM_id()

Example #include
#include

main()
{
printf("ROM BIOS date = %s",ROM_date());
}

Program output ROM BIOS date = 06/10/85







































TCHK 2.1 Page 303


Function ROM_id - gets the ROM id byte

Syntax byte ROM_id(void);

Prototype in ibm.h

Remarks finds the ROM id byte at F000:FFFE

Return value returns the ROM id byte

Note on Compaq machines the ROM id byte is found at a
memory location close to, but not at, F000:FFFE.
Not having access to a Compaq, I did not include a
check for this. Maybe a future version...

See also ibm.h
machine_id(), ROM_date()

Example #include
#include

main()
{
printf("ROM id byte = %X",ROM_id());
}

Program output ROM id byte = FF




































TCHK 2.1 Page 304


Function round - round a real to a decimal place

Syntax double round(double x, int n);

Prototype in mathhk.h

Remarks round will round off a double to x amount of
decimal places. Only zero or greater values are
valid for n (non-zegative). No error checking is
done.

Return value returns x rounded to n decimal places.

See also frac()

Example #include

main()
{
printf("Round %lf to %d places = %lf\n",2.307,
2,round(2.307,2));

Program output Round 2.307 to 2 places = 2.31

Example see demonum.c






































TCHK 2.1 Page 305


Function rsign - determine the sign of a REAL number

Syntax int rsign(struct REAL rx);

Prototype in real.h

Remarks rsign will determine the sign of rx. Zero is
considered positive.

Refer to the section SIMULATED FP MATH for further
details.

Return value returns -1 if rx is negative, otherwise 1.

See also _r_minpre, _rmatherr
radd(), rceil(), rdiv(), rfloor(), rnegate(),
rnormalize(), rsub()














































TCHK 2.1 Page 306


Function rsub - subtract two REAL numbers


Syntax struct REAL rsub(struct REAL val, struct REAL sval,
int precision);

Prototype in real.h

Remarks sval is subtracted from val. The result will have
precision decimal places. See rsub() for more
details.

Return value returns sval minus val to the specified precision.
If an error occurred, the returned structure's
values will all be -1 (rint, rfrac and precision)
and _rmatherr will contain the error code.

Refer to the section SIMULATED FP MATH for further
details.

See also _r_minpre, _rmatherr
radd(), rceil(), rdiv(), rfloor(), rnegate(),
rnormalize(), rsign()









































TCHK 2.1 Page 307



Function rtrim - trims trailing blanks

Syntax char *rtrim(char *source);

Prototype in stringhk.h

Remarks removes trailing blanks in a string. The string
passed to rtrim (source) is modified.

Return value returns a pointer to source.

Example #include
#include /* for the printf */

main()
{
char msg[25] = " Hello everyone ";
printf("String [%s]\n",msg);
printf("rtrim [%s]\n",rtrim(msg));
}

Program output String [ Hello everyone ]
rtrim [ Hello everyone]








































TCHK 2.1 Page 308


Function scrbuff - calculate size of screen buffer

Syntax #include
scrbuff(l,t,r,b)

Prototype in video.h

Remarks this is really just a define to calculate the size
of a buffer need by Borland's gettext() and
puttext() functions.

Return value returns the number of bytes needed to store a
segment of screen from (l,t) to (r,b), with
attributes.

See also video.h















































TCHK 2.1 Page 309


Function scroll_down - scroll window down

Syntax void scroll_down(int left, int top, int right,
int bottom);

Prototype in video.h

Remarks scroll a box, delineated by the coordinates, down 1
line. A blank line will be inserted at the top, and
the bottom line will be lost. The scrolling is done
via INT 0x10, Function 7. Coordinates are absolute.

Return value nothing.

See also scroll_up()

Example #include

main()
{
scroll_down(0,0,4,79);
/* scroll bottom 4 lines */
}








































TCHK 2.1 Page 310


Function scroll_up - scroll window up

Syntax void scroll_up(int left, int top, int right,
int bottom);

Prototype in video.h

Remarks scroll a box, delineated by the coordinates, up 1
line. A blank line will be inserted at the bottom,
and the top line will be lost. The scrolling is
done via INT 0x10, Function 6. Coordinates are
absolute.

Return value nothing.

See also scroll_down()

Example #include

main()
{
scroll_up(0,0,4,79); /* scroll top 4 lines */
}








































TCHK 2.1 Page 311


Function ScrollLock - set the Scroll Lock key state

Syntax void ScrollLock(boolean on);

Prototype in ibm.h

Remarks sets the Scroll Lock key state to the state
selected by the on parameter.

Return value nothing.

See also CapsLock(), InsLock(), NumLock()



















































TCHK 2.1 Page 312


Function set_color - set the default attribute (color)

Syntax void set_color(byte colors);

Prototype in video.h

Remarks set_color just sets the global variable
char_attribute to colors. I got tired of declaring
char_attribute as extern in every function that
output to the screen, so I made this function.

Return value nothing.

See also putk(), putstr()

Example #include
#include

main()
{
set_color(RED | B_WHITE | BLINK);
/* red blinking text on white background */
gotoxy(12,40);
putstr((byte *)"Hello");
}






































TCHK 2.1 Page 313


Function set_cursor - sets cursor scan lines

Syntax #include
set_cursor(h,l)

Prototype in video.h

Remarks sets the cursor scan lines via setcursor(), passing
h | l as the cursor scan code.

This function is a macro.

Return value nothing.

See also cursor_blink(), cursor_flip(), cursor_off(),
cursor_on(), getcursor(), read_cursor(),
setcursor()

Example #include

main()
{
set_cursor(0,7);
}







































TCHK 2.1 Page 314


Function set_handles - set handle count

Syntax int set_handles(int handles);

Prototype in filehk.h

Remarks sets the handle count via DOS Function 0x67. If
more than 255 handles are specified (the maximum
allowable) set_handle tries to set the handle count
to 255.

Return value returns zero if execution was successful, a nonzero
error code otherwise.

Note This function requires DOS 3.3+.

Example #include

main()
{
set_handles(127);
}









































TCHK 2.1 Page 315


Function set_mode - set the video mode

Syntax void set_mode(byte mode);

Prototype in video.h

Remarks sets the video mode via INT 0x10, Service 0.

Return value nothing.

See also video.h
read_mode()

Example #include

main()
{
set_mode(3); /* text mode */
printf("# columns: %d Mode: %d Page:
%d\n", width, mode, page);
}

Program output # columns: 80 Mode: 3 Page: 1








































TCHK 2.1 Page 316


Function setAutoPark - set parking delay for AUTOPARK.COM

Syntax void setAutoPark(unsigned long count);

Prototype in doshk.h

Remarks sets the parking delay for AUTOPARK.COM (resident
hard disk parker by Alan D. Jones) as follows:

count * 55ms timer ticks

Return value nothing.

See also isAutoPark()

Example #include

main()
{
if (isAutoPark())
setAutoPark(1000lu);
/* set delay to 55s (1000 * 0.055s = 55s) */
}








































TCHK 2.1 Page 317


Function setBREAK - set Ctrl-BREAK flag

Syntax #include
boolean setBREAK(boolean break_status);

Prototype in ibm.h

Remarks sets the state of the Ctrl-BREAK flag. The BREAK
status flag can be set from DOS by BREAK ON or
BREAK OFF.

This function is a macro.

Return value returns TRUE if the break flag is on, FALSE if the
flag is off.

Note the return value is based on the CURRENT setting.
If you set the break flag, setBREAK will return
what you set the flag to, not what the flag was set
to before.

See also isBREAKon(), isVERIFYon(), setVERIFY()

Example #include

main()
{
printf("BREAK flag was ");
if (! setBREAK(TRUE))
printf("not ");
printf("on\n");
}































TCHK 2.1 Page 318


Function setcdevicemoderaw - set character device mode

Syntax int setcdevicemoderaw(int handle, boolean setraw);

Prototype in doshhk.h

Remarks setcdevicemoderaw() sets the mode for a character
device associated with handle to "cooked" or "raw"
mode. In cooked mode, DOS performs some translation
of characters, while in raw mode no translation is
performed.

Return value setcdevicemoderaw returns the device's original
mode settings as follows:

1: raw mode
0: cooked mode
-1: error

If there was an error, Borland's variable errno
will contain the error code as follows:

1 function number invalid
4 no handle available
5 access denied
6 handle invalid or not open
13 data invalid

See also iscdevicemoderaw(), isdrivelocal(),
ishandlelocal(), isRedirectStdin(),
isRedirectStdout(), isremoveable()
































TCHK 2.1 Page 319


Function setcursor - sets cursor scan lines

Syntax void set_cursor(unsigned int cursor);

Prototype in video.h

Remarks sets the cursor scan lines via INT 0x10, Function
1.

Return value nothing.

See also cursor_blink(), cursor_flip(), cursor_off(),
cursor_on(), getcursor(), read_cursor(),
set_cursor()

Example #include

main()
{
setcursor(7);
}










































TCHK 2.1 Page 320


Function SetpcAnywhere - enable/disable pcAnywhere

Syntax void SetpcAnywhere(boolean enabled);

Prototype in doshk.h

Remarks SetpcAnywhere() is used to enable or disable
pcAnywhere, depending on the parameter passed. This
function assumes pcAnywhere is installed.

Return value nothing.

See also ispcAnywhere()

Example #include
#include /* for TRUE */

main()
{
printf("pcAnywhere is ");
if (ispcAnywhere()) {
SetpcAnywhere(TRUE);
printf("enabled");
} else
printf("not installed");
}





































TCHK 2.1 Page 321


Function SetPointDevice - Pointing Device BIOS Interface:
Enable/Disable Pointing Device

Syntax int SetPointDevice(boolean enable);

Prototype in ibm.h

Remarks SetPointDevice() will enable or disable the
pointing device through the Pointing Device BIOS
Interface, depending on the value of the parameter
enable.

Return value returns 0 on success and -1 on failure, with the
error code stored in Borland's global variable
errno. Here are the possible error values:

0x01 Invalid function
0x02 Invalid input
0x03 Interface error
0x04 Need to resend
0x05 No device handler installed

Note This function is only available on PS/2 machines or
under DESQview 2.x.

See also GetTypePointDevice(), ResetPointDevice(),
SetRatePointDevice(), SetResPointDevice()




































TCHK 2.1 Page 322


Function SetRatePointDevice - Pointing Device BIOS
Interface: Set Sampling Rate

Syntax int SetRatePointDevice(unsigned char samplerate);

Prototype in ibm.h

Remarks SetRatePointDevice() will set the sampling rate
defined by samplerate. The values of samplerate
currently supported are:

0x00 10/second
0x01 20/second
0x02 40/second
0x03 60/second
0x04 80/second
0x05 100/second
0x06 200/second

Return value returns 0 on success and -1 on failure, with the
error code stored in Borland's global variable
errno. Here are the possible error values:

0x01 Invalid function
0x02 Invalid input
0x03 Interface error
0x04 Need to resend
0x05 No device handler installed

Note This function is only available on PS/2 machines or
under DESQview 2.x.

See also GetTypePointDevice(), ResetPointDevice(),
SetPointDevice(), SetResPointDevice()





























TCHK 2.1 Page 323


Function SetResPointDevice - Pointing Device BIOS
Interface: Set Resolution

Syntax int SetResPointDevice(unsigned char countpermm);

Prototype in ibm.h

Remarks SetResPointDevice() will set the resolution based
on the value of countpermm. The values of
countpermm currently supported are:

0x00 1 count per mm
0x01 2 counts per mm
0x02 4 counts per mm
0x03 8 counts per mm

Return value returns 0 on success and -1 on failure, with the
error code stored in Borland's global variable
errno. Here are the possible error values:

0x01 Invalid function
0x02 Invalid input
0x03 Interface error
0x04 Need to resend
0x05 No device handler installed

Note This function is only available on PS/2 machines or
under DESQview 2.x.

See also GetTypePointDevice(), ResetPointDevice(),
SetPointDevice(), SetRatePointDevice()
































TCHK 2.1 Page 324


Function settextinfo - set text mode video information

Syntax void settextinfo(struct text_info *inforec);

Prototype in video.h

Remarks settextinfo sets the Borland internal text mode
settings to the values in the text_info structure
pointed to by inforec, in the following order:

mode (via textmode())
window (via window())
attribute (via textattr())
cursor location (via gotoxy())

Only those settings needed to be modified are
actually changed.

This function does the exact opposite of
gettextinfo(), and was designed to be used in
conjunction with it. Do a gettextinfo() to save the
current settings, do whatever, then restore the
settings via settextinfo().

Return value nothing.






































TCHK 2.1 Page 325


Function setVERIFY - set VERIFY flag

Syntax #include
boolean setVERIFY(boolean verify_status);

Prototype in ibm.h

Remarks sets the state of the verify flag. The VERIFY
status flag can be set from DOS by VERIFY ON or
VERIFY OFF.

This function is a macro.

Return value returns TRUE if the verify flag is on, FALSE if the
flag is off.

Note the return value is based on the CURRENT setting.
If you set the verify flag, setVERIFY will return
what you set the flag to, not what the flag was set
to before.

See also isBREAKon(), isVERIFYon(), setBREAK()

Example #include

main()
{
printf("VERIFY flag was ");
if (! setVERIFY(TRUE))
printf("not ");
printf("on\n");
}































TCHK 2.1 Page 326


Function setWhoa - set delay count for WHOA!.COM by Brad
Crandall

Syntax boolean setWhoa(unsigned int delaycount);

Prototype in doshk.h

Remarks sets the delay count for WHOA!.COM (system
slow-down utility by Brad Crandall). The systems
slows more as values for delaycount get larger.

Return value returns TRUE if WHOA!.COM is successfully slowed,
FALSE otherwise.

See also isWhoa(), uninstallWhoa()

Example #include

main()
{
if (isWhoa()) {
printf("Whoa! is ");
if (! setWhoa(100u))
printf("not ");
printf("successfully slowed\n");
} else
printf("Whoa! is not installed");
}



































TCHK 2.1 Page 327


Function shadow - draw a shadowed box

Syntax void shadow(int left, int top, int right,
int bottom, char frame[]);

Prototype in video.h

Remarks draws a shadowed box at the coordinates (left,top)
to (right,bottom). The coordinates will contain the
box and any shadowing necessary. In the example
below, the smallest value for bottom should be 3,
which would draw:

abbbbbbc
gffffffe+
++++++++


The characters in frame[] are used to generate the
frame. Also, frame must be have at least 9 elements
(char frame[9]). The box characters are frame[0]
(top left) to frame[7] (left wall), going
clockwise. If frame[8] != '\0' the box is filled
with it.

Video output is via Borland's console i/o. All
coordinates are based on the actual screen (1,1 to
width,height) and not the current window() setting.

All shadowing uses _shadowchar and _shadowcolor to
determine the character and color used.

This function does virtually no error checking.

Return value nothing.

See also video.h
_shadowstyle, _shadowchar, _shadowcolor
box(), boxwindow()

Example #include

main()
{
extern int _shadowstyle;
extern char _shadowchar;
char framebox[] = "abcdefgh";

_shadowstyle = SHADOW_R|SHADOW_BR|SHADOW_B;
_shadowchar = '+';
shadow(1,1,9,5,framebox);
}











TCHK 2.1 Page 328

Program output abbbbbbc
h d+
h d+
gffffffe+
++++++++



























































TCHK 2.1 Page 329


Function shorttoddate - convert a short date to struct

Syntax struct ddate *shorttoddate(char *source);

Prototype in datehk.h

Remarks shorttoddate converts a date from a short date
format to the structure ddate format

Return value returns a pointer to the storage location
containing the date structure, or NULL if space
could not be allocated.

See also see Appendix A
Cal...(), date_convert(), ddatetofull(),
ddatetoshort(), ddatetostr(), fulltoddate(),
Greg...(), Jul...(), monthexpand(), strtoddate()

Example see demodate.c












































TCHK 2.1 Page 330


Function soundex - convert a string to soundex form

Syntax char *soundex(char *str, char *soundexstr);

Prototype in stringhk.h

Remarks soundex() will convert a character string to
soundex form (phonetic complement). The soundex
form will always a be null terminated string 5
characters long. The first character of the soundex
form will always be the first character in str
(capitalized). The remaining 4 characters will be
'0' to '5', using the following conventions:

all non-alphabetic characters are ignored

soundex() is case independent

alphabetic characters are converted to a digit
using the following table:

1 = BFPV
2 = CGJKQRSXZ
3 = DT
4 = L
5 = MN
all others are ignored

run lengths of characters are ignored (i.e.
the 2nd 'r' in mirror)

Processing ends when either str is fully processed,
or the soundex string is 5 characters long (not
including the null terminator). If str is fully
processed, the soundex string will be padded with
'0' to give it a length of 5.

This function is based on the soundex algorithm
published by Nicklaus Wirth.

Return value returns soundexstr.

Example #include

main()
{
char *str[] = {"Billy","bill",
"mirror","marred",
"Borland International" };
char temp[30];
int i;












TCHK 2.1 Page 331

for (i=0; i<5; i++)
printf("%s = %s",str[i],
soundex(str,temp);
}

Program output Billy = B4000
bill = B4000
mirror = M2200
marred = M2300
Borland International = B2453






















































TCHK 2.1 Page 332


Function sqr - square of a value

Syntax #include
(type) sqr(x)

Prototype in mathhk.h

Remarks sqr will calculate the square of x.

This function is a macro.

Return value returns the square of x.



















































TCHK 2.1 Page 333


Function stateindex - get index for a given state

Syntax int stateindex(char *state);

Prototype in statehk.h

Remarks stateindex() looks up the state abbreviation given
in States[] and returns the index (array
subscript). The compare is case independent

Return value returns the index (array subscript) for the given
state, if found. If not found, returns -1.

Note see isstate() for the list of valid states

See also statehk.h
isstate(), iszip()

Example #include

{
printf("AL is subscript %d\n",
stateindex("AL"));
}

Program output AL is subscript 0





































TCHK 2.1 Page 334


Function stddev - calculate the standard deviation of a
set of reals

Syntax double stddev(int n, double element[]);

Prototype in mathhk.h

Remarks variance calculates the standard deviation of a set
of n numbers of type double.

Return value returns the standard deviation of a set of n
numbers.

See also average(), summation(), variance()

Example #include

main()
{
double num[] = { 2.3, 7.1, 6.05 };

printf("Std dev is %.9lf\n",stddev(3,num));
}

Program output Std dev is 2.060339778






































TCHK 2.1 Page 335


Function straight_line_dep - calculate straight line
depreciation

Syntax double straight_line_dep(double cost, double
salvage, int life);

Prototype in finance.h

Remarks given the cost, salvage value and life of an item,
straight_line_dep will calculate the periodic
deprecitation according to the straight line method
of depreciation. The cost and salvage can be given
in any unit (dollars, thousands of dollars, etc.)
but the life should be given in depreciable periods
(if you depreciate an item every quarter, and the
item has a life of 2 years, then life should be 8.)

The cost and salvage values should be in the same
units.

No error checking is performed.

Return value returns the periodic depreciation in the same units
as the cost, as per the straight line depreciation
method.

Note The macro SLD(c,s,l) is defined in finance.h for
ease of use.

See also accum_dep(), depreciation(),
double_decline_bal_dep(), sum_year_digits_dep()

Example see demonum.c






























TCHK 2.1 Page 336


Function strcapital - capitalizes the first letter of each
word in a string

Syntax char *strcapital(char *str);

Prototype in stringhk.h

Remarks strcapital capitalizes the first letter of each
word in the string str. A word is defined an an
alphabetic sequence of letters. The string passed
to strcapital is modified.

Return value returns str.


















































TCHK 2.1 Page 337


Function strclean - remove non-printable ASCII codes

Syntax char *strclean(char *str);

Prototype in stringhk.h

Remarks strclean removes any non-printable ASCII characters
from the string str. Non-printable is defined as
per the isprint() function. The string passed to
strclean is modified.

Return value returns str.



















































TCHK 2.1 Page 338


Function strcomma - convert a string to xx,xxx,xxx format

Syntax char *strcomma(char *source);

Prototype in stringhk.h

Remarks strcomma converts a string of numbers into the
comma delimited format (xx,xxx,xxx). The number is
terminated by a non-digit (any character other than
0-9.) A leading sign will be copied before
converting the number.

Return value returns a pointer to the storage location
containing the comma formatted string, or NULL if
space could not be allocated. The returned string
is NOT the same as the string passed to the
function. This function does NOT write over the
string passed to it.

See also strtocomma()

Example #include
#include /* for the printf */

main()
{
char sint[15], *comma;

strcpy(sint,"12839.44");
comma = strcomma(sint);
printf("%s -> %s\n",sint,comma);
}

Program output 12839.44 -> 12,839.44





























TCHK 2.1 Page 339


Function strdel - delete part of a string

Syntax char *strdel(char *source, char *old);

Prototype in stringhk.h

Remarks strdel deletes the first occurence of the string
old from the string source. This function is case
dependent.

Return value returns source

See also strins()

Example #include
#include /* for the printf */

main()
{
char msg[45], fragment[15], *new;

strcpy(msg,"Did you register yet? Did you?");
strcpy(fragment,"you");
printf(" [%s]\n",msg);
printf("- [%s]\n",fragment);
new = strdel(msg,fragment);
printf("= [%s]\n",new);
}

Program output [Did you register yet? Did you?]
- [you]
= [Did register yet? Did you?]































TCHK 2.1 Page 340


Function strfill - fill a string with a character

Syntax char *strfill(char *str, char c, int count);

Prototype in stringhk.h

Remarks strfill makes a string of c characters of count
length.

Similar to strrep(), strfill() uses an existing
piece of memory pointed to by str. Functions like
strnset set a piece of memory with a character, but
do not make it a valid C string (null terminated.)

Return value returns the pointer passed to strfill.

See also strrep()














































TCHK 2.1 Page 341


Function strins - insert one string into another

Syntax char *strins(char *source, char *new, char *ptr);

Prototype in stringhk.h

Remarks strins inserts the string new into the string
source at the location ptr in source. Basically,
strins copies source up to, but not including, ptr
into a new location, concatenates the new
(inserted) string, and then concatenates the
remainder of source (the string pointed to by ptr.)

Return value returns a pointer to the storage location
containing the newly concatenated string, or NULL
if space could not be allocated. The returned
string is NOT the same as the string passed to the
function. This function does NOT write over the
string passed to it.

See also strdel()

Example #include
#include /* for the printf */

main()
{
char old[25], *ptr, *new;

strcpy(old,"ABCDEFG");
ptr = old + 3; /* *ptr = 'D' */
new = strins(old,"abc",ptr);
printf("%s -> %s\n",old,new);
}

Program output ABCDEDFG -> ABCabcDEFG



























TCHK 2.1 Page 342


Function stroccur - count the occurences of a substring
within a string

Syntax int stroccur(str *str, char *substr);

Prototype in stringhk.h

Remarks stroccur counts the number of times the string
substr appears with the string str.

Return value returns the number of times the string substr
appears within the string str.

Example #include
#include /* for the printf */

main()
{
char original[] = "This is his test";

printf("%d\n",stroccur(original,"is"));
}

Program output 3







































TCHK 2.1 Page 343


Function strpadleft - pad the left of a string

Syntax char *strpadleft(char *str, char c, int len);

Prototype in stringhk.h

Remarks str will be padded on the left with len characters
of c. Make sure space allocated for str is big
enough to hold the new padded string.

Return value returns a pointer to the storage location
containing the newly padded string.

See also strpadright()

Example #include

main()
{
char temp[30];

strcpy(temp,"This is a sample.");
printf("Before: %s\n",temp);
printf(" After: %s\n",strpadleft(temp,'.',3));
}

Program output Before: This is a sample.
After: ...This is a sample.



































TCHK 2.1 Page 344


Function strpadright - pad the right of a string

Syntax char *strpadright(char *str, char c, int len);

Prototype in stringhk.h

Remarks str will be padded on the right with len characters
of c. Make sure space allocated for str is big
enough to hold the new padded string.

Return value returns a pointer to the storage location
containing the newly padded string.

See also strpadleft()

Example #include

main()
{
char temp[30];

strcpy(temp,"This is a sample.");
printf("Before: %s\n",temp);
printf(" After: %s\n",
strpadright(temp,'?',3));
}

Program output Before: This is a sample.
After: This is a sample.???


































TCHK 2.1 Page 345


Function strrep - replicate a char

Syntax char *strrep(char c, int len);

Prototype in stringhk.h

Remarks strrep creates a string len long entirely of
character c.

Return value returns a pointer to the storage location
containing the newly replicated string, or NULL if
space could not be allocated.

See also strfill()

Example #include
#include /* for the printf */

main()
{
char *rep;

printf("%s\n",rep = strrep('k',7));
}

Program output kkkkkkk





































TCHK 2.1 Page 346


Function strshleft - shift string left

Syntax void strshleft(char *source, int count);

Prototype in stringhk.h

Remarks strshleft shifts the characters in the string
source left count places, padding with spaces.

Return value returns source.

See also strshright()

Example #include
#include /* for the printf */

main()
{
char msg[25];

strcpy(msg,"Buy a Mac II");
printf("%s\n",msg);
printf("%s\n",strshleft(msg,4));
}

Program output Buy a Mac II
a Mac II




































TCHK 2.1 Page 347


Function strshright - shift string right

Syntax void strshright(char *source, int count);

Prototype in stringhk.h

Remarks strchright shifts the characters in the string
source right count places, padding with spaces.

Return value returns source.

See also strshleft()

Example #include
#include /* for the printf */

main()
{
char msg[25];

strcpy(msg,"Buy a Mac II");
printf("%s\n",msg);
printf("%s\n",strshright(msg,4));
}

Program output Buy a Mac II
Buy a Ma




































TCHK 2.1 Page 348


Function strspace2tab - compress spaces to tabs

Syntax char *strspace2tab(char *source, char *dest,
int tablen);

Prototype in stringhk.h

Remarks copies the string source to dest with all groups of
tablen spaces replaced with tabs ('\t').

The converted string will be returned in dest, so
you must make sure there is sufficient space
allocated.

Return value returns dest.

See also strtabexpand()

Example #include

main()
{
char spacestr[30] = "Spaces are nice.";
char tabstr[30];

printf("Converted string: %s\n",
strspace2tab(spacestr,tabstr,3);
}

Program output Converted string: Spaces\tare\t nice.

(In the output, \t represents a tab character.)































TCHK 2.1 Page 349


Function strtabexpand - expand tabs to spaces

Syntax char *strtabexpand(char *source, char *dest,
int tablen);

Prototype in stringhk.h

Remarks copies the string source to dest with all tabs
('\t') replaced with tablen spaces.

The converted string will be returned in dest, so
you must make sure there is sufficient space
allocated.

Return value returns dest.

See also strspace2tab()

Example #include

main()
{
char spacestr[30];
char tabstr[30] = "Tabs\tare\tnice.";

printf("Converted string: %s\n",
strtabexpand(tabstr,spacestr,4);
}

Program output Converted string: Tabs are nice.

































TCHK 2.1 Page 350


Function strtocomma - convert a string to xx,xxx format

Syntax char *strtocomma(char *source);

Prototype in stringhk.h

Remarks strtocomma converts a string of numbers into the
comma delimited format (xx,xxx,xxx). The number is
terminated by a non-digit (any character other than
0-9.) A leading sign will be copied before
converting the number.

The comma delimited string will be returned in
source, so you must make sure there is sufficient
space allocated.

Return value returns a pointer to source. This function writes
over the string passed to it.

See also strcomma()

Example #include
#include /* for the printf */

main()
{
char temp[15];

strcpy(temp,"12839.44");
printf("-> %s\n",strtocomma(temp));
}

Program output -> 12,839.44






























TCHK 2.1 Page 351


Function strtoddate - convert a date string to a structure

Syntax struct ddate *strtoddate(char *source);

Prototype in datehk.h

Remarks strtoddate converts a date abbreviation to a
structure of type ddate. The abbreviation can use
dashes or slashes (- or /) to separate the fields
of the date. All fields MUST be of length two (i.e.
02/07/87 is valid, but 2/7/87 and 02/07/1987 are
not valid.)

Return value returns a pointer to the storage location
containing the date structure, or NULL if space
could not be allocated.

See also Cal...(), date_convert(), ddatetofull(),
ddatetoshort(), ddatetostr(), fulltoddate(),
Greg...(), Jul...(), monthexpand(), shorttoddate()

Example #include

main()
{
struct ddate *today;
char strtoday[9];

strcpy(strtoday,"04/01/67");
if ((today = strtoddate(strtoday) != NULL) {
printf("today is %d-%d-%d\n",
today->dmon, today->dday,
today->dyear);
printf("or %s\n", strtoday);
}
}

Program output today is 4-1-67
or 04/01/67
























TCHK 2.1 Page 352


Function strtodol - converts a string to dollar format

Syntax char *strtodol(char *source);

Prototype in stringhk.h

Remarks strtodol converts a string pointed to by source to
dollar format ($-12,839.44). An optional leading
sign is copied. Only the first 2 decimal places are
copied (the string is truncated, not rounded.)

Return value returns a pointer to the storage location
containing the dollar formatted string, or NULL if
space could not be allocated. The returned string
is NOT the same as the string passed to the
function. This function does NOT write over the
string passed to it.

Example #include
#include /* for the printf */

main()
{
char sint[15], *dollar

strcpy(sint,"12839.44");
dollar = strtodol(sint);
printf("%s -> %s\n",sint,dollar);
free(dollar);
strcpy(sint,"+62939445.1");
dollar = strtodol(sint);
printf("%s -> %s\n",sint,dollar);
free(dollar);
}

Program output 12839.44 -> $12,839.44
+62939445.1 -> $+62,939,445.10


























TCHK 2.1 Page 353


Function strtotime - convert a string to a time structure

Syntax struct time *strtotime(char *source);

Prototype in timehk.h

Remarks strtotime converts a string to a time structure,
checking for AM/PM or 24-hour format. If seconds or
hundredths of seconds are not in the string, their
values will be set to 0 in the structure.

Return value returns a pointer to the storage location
containing the time string, or NULL if space could
not be allocated.

See also timetostr()

Example #include

main()
{
struct time *now;

strcpy(strnow,"5:12 PM");
if ((now = strtotime(strnow)) != NULL)
printf("%d hours, %d min, %d.%d secs\n",
now->ti_hour, now->ti_min,
now->ti_sec, now->ti_hund);
}

Program output 17 hours, 12 min, 0.0 secs
































TCHK 2.1 Page 354


Function strwcmp - compares a wild-carded string to
another string

Syntax int strwcmp(char *wstr, char *str);

Prototype in stringhk.h

Remarks strwcmp performs an unsigned comparison of wstr and
str, starting with the first character in each
string and continuing with subsequent characters
until the corresponding characters differ or until
the end of the strings is reached. Wildcards (*,?)
are supported, as per DOS (* wildcards 0 or more
characters, ? wildcards a single character).

Return value strwcmp returns an int value that is

< 0 if wstr is less than str
= 0 if wstr is the same as str
> 0 if wstr is greater than str

Furthermore, if a comparison falls through during a
wildcard matching, -2 or 2 is returned. If a
mismatch is found without using wildcards, a -1 or
1 is returned.

See also strwicmp()




































TCHK 2.1 Page 355


Function strwicmp - compares a wild-carded string to
another string, without case
sensitivity

Syntax int strwicmp(char *wstr, char *str);

Prototype in stringhk.h

Remarks strwicmp performs an unsigned comparison of wstr
and str, starting with the first character in each
string and continuing with subsequent characters
until the corresponding characters differ or until
the end of the strings is reached. Wildcards (*,?)
are supported, as per DOS (* wildcards 0 or more
characters, ? wildcards a single character). The
comparison is not case sensitive.

Return value strwicmp returns a value that is

< 0 if wstr is less than str
= 0 if wstr is the same as str
> 0 if wstr is greater than str

Furthermore, if a comparison falls through during a
wildcard matching, -2 or 2 is returned. If a
mismatch is found without using wildcards, a -1 or
1 is returned.

See also strwcmp()


































TCHK 2.1 Page 356


Function sum_year_digits_dep - calculate sum of the years
digits depreciation

Syntax double sum_year_digits_dep(double cost, double
salvage, int life, int period);

Prototype in finance.h

Remarks given the cost, salvage value and life of an item,
sum_year_digits_dep will calculate the amount of
deprecitation for the given period according to the
sum of the years digits depreciation method. The
cost and salvage can be given in any unit (dollars,
thousands of dollars, etc.) but the life should be
given in depreciable periods (if you depreciate an
item every quarter, and the item has a life of 2
years, then life should be 8).

The cost and salvage values should be in the same
units. The life and period should be given in the
same units.

No error checking is performed.

Return value returns the amount of depreciation for the given
period in the same units as the cost, as per the
sum of the years digits depreciation method.

Note The macro SYD(c,s,l,p) is defined in finance.h for
ease of use.

See also accum_dep(), depreciation(),
double_decline_bal_dep(), straight_line_dep()

Example see demonum.c




























TCHK 2.1 Page 357


Function summation - calculate a summation of integers

Syntax int summation(int max);

Prototype in mathhk.h

Remarks summation calculates a summation denoted by ä Xi
where i ranges from 1 to max. Beware of overflow,
calculations are done as ints.

Return value returns the summation denoted by ä Xi where i
ranges from 1 to max. If max <= 1, summation
returns a 1.

See also average(), factorial(), stddev(), variance()

Example #include

main()
{
printf("Summation is %d\n",summation(10));
}

Program output Summation is 55







































TCHK 2.1 Page 358


Function swap - swap two values

Syntax #include
(void) swap(x,y)

Prototype in mathhk.h

Remarks swap will swap two values, regardless of type, but
should be of equal type.

This function is a macro.

Return value nothing.


















































TCHK 2.1 Page 359


Function time_convert - convert time formats

Syntax boolean time_convert(void *source, void *dest,
int stype, int dtype);

Prototype in timehk.h

Remarks time_convert will convert a time from virtually any
time format to any other. The parameters *source
and *dest must be pointers pointing to a piece of
memory allocated as the proper data type. stype and
dtype determine the format of source and dest.

Due to the great number of formats supported, a
chart of valid time formats is provided in Appendix
C.

Limited error checking is done on passed data. If
an invalid time format is passed, unpredictable
results will occur.

Return value returns TRUE is the conversion was successful and
FALSE if the time could not be converted.

Note This function does NO function calls. I've tried to
optimize this function as much as possible for
speed, not size. If you only need to convert
between a couple of specific formats, you may be
better off doing a pair of sprintfs.

See also Appendix C
strtotime(), timetostr()

Example see demotime.c





























TCHK 2.1 Page 360


Function timetostr - convert time structure to a string

Syntax char *timetostr(struct time *tsource,
boolean seconds, boolean hundreds,
boolean ampm);

Prototype in timehk.h

Remarks timetostr converts a time structure to a string,
with the following options:

seconds = put seconds in string
hundreds = put hundreths of seconds in string
ampm = append AM/PM to string

if ampm is FALSE, 24-hour time will be used.

if hundreds is TRUE, seconds are automatically put
into the string.

Return value returns a pointer to the storage location
containing the time string, or NULL if space could
not be allocated.

See also strtotime()

Example #include

main()
{
char *strnow;
struct time now;

gettime(&now);
if ((strnow = timetostr(&now, FALSE, TRUE,
TRUE)) != NULL)
printf("The time is %s\n",strnow);
}

Program output The time is 11:23:14.22 PM























TCHK 2.1 Page 361


Function to24hour - converts hours to 24-hour format

Syntax #include
(int) to24hour(hr)

Prototype in timehk.h

Remarks converts midnight (0) to the 24th hour.

Return value returns 0 if hr is midnight (0), otherwise returns
hr.

See also isPM(), time_convert(), tohour()


















































TCHK 2.1 Page 362


Function tocapkey - convert the key code to uppercase

Syntax int tocapkey(int k);

Prototype in keyboard.h

Remarks if the key code k is a letter, it is converted to
upper case.

Return value if the key code is a lower case letter, tocapkey
returns the upper case of that letter, otherwise
tocapkey returns the key code unchanged

See also inkeyc(), inkeycdv()

















































TCHK 2.1 Page 363


Function todosdate - make a DOS file date stamp

Syntax #include
(unsigned) todosdate(y,m,d)

Prototype in doshk.h

Remarks makes a DOS file date stamp. Refer to a DOS
reference book (Advanced MS-DOS by Ray Duncan
recommended) for further details.

This function is a macro.

Return value returns the DOS file date stamp.

See also dosday(), doshour(), dosmonth(), dosmin(),
dossec(), dosyear(), todostime()














































TCHK 2.1 Page 364


Function todostime - make a DOS file time stamp

Syntax #include
(unsigned) todostime(h,m,s)

Prototype in doshk.h

Remarks makes a DOS file time stamp. Refer to a DOS
reference book (Advanced MS-DOS by Ray Duncan
recommended) for further details.

This function is a macro.

Return value returns the DOS file time stamp.

See also dosday(), doshour(), dosmonth(), dosmin(),
dossec(), dosyear(), todosdate()














































TCHK 2.1 Page 365


Function tohour - converts 24-hour format to 12-hour

Syntax #include
(int) tohour(hr)

Prototype in timehk.h

Remarks converts hr from 24-hour time to 12-hour time.

Return value returns the hour of the day, as would appear on a
12-hour clock (1-12).

See also isPM(), time_convert(), to24hour()


















































TCHK 2.1 Page 366


Function Tone - play a tone

Syntax void Tone(unsigned frequency, unsigned duration);

Prototype in sound.h

Remarks Tone() will play a tone of a specific frequency for
duration milliseconds. See sound.h for definitions
of common tones.

Return value returns nothing.

See also beep()

Example #include

main()
{
Tone(sA4s,2000u);
/* play A sharp for 2 seconds */
}










































TCHK 2.1 Page 367


Function uninstallWhoa - uninstall WHOA!.COM by Brad
Crandall

Syntax boolean uninstallWhoa(void);

Prototype in doshk.h

Remarks removes WHOA!.COM from memory (system slow-down
utility by Brad Crandall).

Return value returns TRUE if WHOA!.COM is successfully
uninstalled, FALSE otherwise.

See also isWhoa(), setWhoa()

Example #include

main()
{
if (isWhoa()) {
printf("Whoa! is ");
if (! uninstallWhoa())
printf("not ");
printf("successfully uninstalled\n");
} else
printf("Whoa! is not installed");
}




































TCHK 2.1 Page 368


Function valid_date - check if a date is valid

Syntax boolean valid_date(int month, int day,
int yearnum);

Prototype in datehk.h

Remarks valid_date checks if the given date is valid.

Return value returns TRUE if the date is valid, FALSE otherwise.

See also isleapyear()

Example #include

main()
{
int i, d[3] = { 11,5,2 }, m[3] = { 31,12,29};
int y[3] = { 70, 1987, 1981 };

for (i=0; i<3; ++) {
printf("%d/%d/%d ", m[i], d[i], y[i]);
if (valid_date(m[i], d[i], y[i])
printf("valid\n");
else
printf("INVALID\n");

}
}

Program output 11/31/70 INVALID /* Nov has 30 days */
5/13/1987 valid
2/29/1981 INVALID /* 1981 not a leap year */































TCHK 2.1 Page 369


Function variance - calculate the variance of a set of
reals

Syntax double variance(int n, double element[]);

Prototype in mathhk.h

Remarks variance calculates the variance of a set of n
numbers of type double.

Return value returns the variance of a set of n numbers.

See also average(), stddev(), summation()

Example #include

main()
{
double num[] = { 2.3, 7.1, 6.05 };

printf("Variance is %lf\n",variance(3,num));
}

Program output Variance is 4.245







































TCHK 2.1 Page 370


Function vert_line - draw a vertical line

Syntax void vert_line(byte c, int len, int col, int row);

Prototype in video.h

Remarks draws a vertical line of characters c of length len
beginning at (col,row) via INTerrupts, using the
current char_attribute setting for color. Screen
coordinates are absolute.

horiz_line does no error checking on the passed
parameters.

Return value nothing.

See also box(), horiz_line()

Example #include

main()
{
vert_line('*',7,4,4); /* draw 7 *'s */
}







































TCHK 2.1 Page 371


Function whereh - X-coordinate of cursor

Syntax int whereh(void);

Prototype in video.h

Remarks returns the X-coordinate (column) of the cursor's
current location via INT 0x10, Service 3.

Return value returns the X-coordinate of the cursor's current
location.

See also gotohv(), read_cursor(), wherev()

Example #include

main()
{
printf("Cursor's column = %d\n",whereh());
}

Program output Cursor's column = 12









































TCHK 2.1 Page 372


Function wherev - Y-coordinate of cursor

Syntax int wherev(void);

Prototype in video.h

Remarks returns the Y-coordinate (row) of the cursor's
current location via INT 0x10, Service 3.

Return value returns the Y-coordinate of the cursor's current
location.

See also gotohv(), read_cursor(), whereh()

Example #include

main()
{
printf("Cursor's row = %d\n",wherev());
}

Program output Cursor's row = 4









































TCHK 2.1 Page 373


Index


_cursorinsert 131, 145
_cursoroverwrite 131, 145
_dvmajor 148, 149
_mouse1 183, 227, 228, 245
_mouse2 183, 227, 228, 229, 244, 245
_mouse3 227, 228, 229, 244, 245, 249, 250
_mouse4 227, 228, 229, 244, 245, 249, 250
_rmatherror 223
_r_maximum 301
_r_maxpre 301
_r_minpre 288, 289, 298, 300, 301, 305, 306
_shadowchar 327
_shadowcolor 327
_shadowstyle 327


A
Accum_dep 8, 60, 97, 335, 356
ACC_DDB 8
ACC_SLD 8
ACC_SYD 8
Ansiback 10, 11, 12
Ansifore 10, 11, 12
Ansi_call 9, 11, 12
Atrim 13
Average 14, 334, 357, 369


B
Beep 15, 66, 366
Bitrevb 16, 17, 18
Bitrevl 16, 17, 18
Bitrevw 16, 17, 18
Box 19, 20, 21, 29, 144, 195, 213, 214, 267, 309, 310, 327, 370
Boxwindow 19, 20, 21, 213, 267, 327


C
Cal... 22, 53, 57, 58, 59, 116, 143, 210, 251, 329, 351
CapsLock 23, 151, 261, 311
CEDadd 24, 25, 164
CEDremove 24, 25, 164
Center 20, 21, 26, 131, 213, 267
Changelitebar 27, 216, 217, 218, 219, 220, 221, 240
Char_attribute 144, 283, 284, 285, 312, 370
Checksum_block 28, 45, 46, 47, 48
Clear 9, 29, 30, 31
Clear_typeahead 30
Cls 9, 29, 31











TCHK 2.1 Page 374

Color 9, 10, 11, 12, 20, 21, 32, 37, 40,
144, 165, 214, 219, 221, 268, 275,
276, 283, 284, 285, 312, 327, 370
Commit 33
Compaq386GetCpuSpeed 34, 35, 36
Compaq386GetCpuSpeed 34, 35, 36
Compaq386KbdType 34, 35, 36
CompaqExternalMonitorType 37, 38, 39, 40, 41, 42, 43
CompaqGetMasterMode 37, 38, 39, 40, 41, 42, 43
CompaqGetMonitor 37, 38, 39, 40, 41, 42, 43
CompaqInternalMonitorType 37, 38, 39, 40, 41, 42, 43
CompaqModeSwitchDelay 37, 38, 39, 40, 41, 42, 43
CompaqSelectMonitor 37, 38, 39, 40, 41, 42, 43
CompaqSetMasterMode 37, 38, 39, 40, 41, 42, 43
Cpu_id 44, 226, 259
CRC16tupdate 28, 45, 46, 47, 48
CRC16update 28, 45, 46, 47, 48
CRC16_block 28, 45, 46, 47, 48
CRC32tupdate 28, 45, 46, 47, 48
Cursor_blink 49, 50, 51, 52, 125, 293, 313, 319
Cursor_flip 49, 50, 51, 52, 125, 293, 313, 319
CURSOR_HALFBLOCK 50, 145
Cursor_off 49, 50, 51, 52, 125, 293, 313, 319
Cursor_on 49, 50, 51, 52, 125, 293, 313, 319
CURSOR_UNDERBAR 50, 145


D
Date_convert 22, 53, 57, 58, 59, 116, 143, 210,
251, 329, 351
Dayofweek 54, 55
Dayofyear 55, 56, 87
Daysleft 55, 56, 87
Ddatetofull 22, 53, 57, 58, 59, 116, 143, 210,
251, 329, 351
Ddatetoshort 22, 53, 57, 58, 59, 116, 143, 210,
251, 329, 351
Ddatetostr 22, 53, 57, 58, 59, 116, 143, 210,
251, 329, 351
DDB 8, 97
Depreciation 8, 60, 97, 335, 356
DESQapilevel 61, 86
DESQappnum 62
DESQbeginc 63, 67
DESQcommonmem 64, 65, 69
DESQconvenmem 64, 65, 69
DESQdisperror 66, 78
DESQendc 63, 67
DESQexit 68
DESQexpandedmem 64, 65, 69
DESQgetbuf 70
DESQgetmem 71, 81
DESQiskmouse 72, 74, 75
DESQjustify 73










TCHK 2.1 Page 375

DESQkmouse_off 72, 74, 75
DESQkmouse_on 72, 74, 75
DESQostack 76, 85
DESQpause 77, 79, 83, 84
DESQpoke 78
DESQposttask 77, 79, 83, 84
DESQpushkey 80
DESQputmem 71, 81
DESQsound 82
DESQstart 77, 79, 83, 84
DESQstop 77, 79, 83, 84
DESQustack 76, 85
DESQversion 61, 86, 148, 149
Diffddate 55, 56, 87
DISABLED 214, 267
Diskchanged 88, 89
Disktype 88, 89
Dosday 90, 91, 92, 93, 94, 96, 363, 364
Doshour 90, 91, 92, 93, 94, 96, 363, 364
Dosmin 90, 91, 92, 93, 94, 96, 363, 364
Dosmonth 90, 91, 92, 93, 94, 96, 363, 364
Dossec 90, 91, 92, 93, 94, 96, 363, 364
Dostimetolong 95, 222
Dosyear 90, 91, 92, 93, 94, 96, 363, 364
DoubleDOSfreeCPU 98, 99, 100, 168, 180
DoubleDOSGetVirtual 98, 99, 100, 168, 180
DoubleDOSTaskSwitch 98, 99, 100, 168, 180
Double_decline_bal_dep 8, 60, 97, 335, 356
DVERROR_BEEP 66
DVERROR_EITHER 66
DVERROR_LEFT 66
DVERROR_RIGHT 66


E
EMMversion 101, 102, 103, 104, 105, 171
EMSGetStatus 101, 102, 103, 104, 105, 171
EMSinfo 102, 103, 171
EMSpages 101, 102, 103, 104, 105, 171
EMSwarmbootprep 101, 102, 103, 104, 105, 171
ENABLED 214, 267
Endstri 106, 107
Endstrp 107
Expandfilespec 108
Extendedtotal 109, 174


F
Factorial 110, 357
Fileexist 111, 167
Fname_match 112, 113
Fncmp 112, 113
Frac 114, 301, 304
Fsgn 115, 177, 224










TCHK 2.1 Page 376

Fulltoddate 22, 53, 57, 58, 59, 116, 143, 210,
251, 329, 351
FV 117, 118, 266, 286, 287
FVa 117, 118, 266, 286, 287


G
GetAssignmemseg 119, 159
GetBootBlock 120, 121, 122, 140
GetBootBlock4 120, 121, 122, 140
GetBPB 120, 121, 122, 140
Getci_match 124, 135
Getcursor 49, 50, 51, 52, 125, 293, 313, 319
Getc_match 123, 124, 134, 135, 141, 146, 147,
148, 149
Getdatehk 126
Getdouble 127, 133, 137
Getfilespec 108, 128, 263, 264, 297
Getfname 129
Getget 129, 130, 131, 136, 138, 145
Getint 127, 133, 137
Getk 123, 124, 134, 135, 141, 146, 147,
148, 149
Getlogical 123, 124, 134, 135, 141, 146, 147,
148, 149
Getpw 136
Getreal 127, 133, 137
Getstr 132, 138
GetTypePointDevice 139, 296, 321, 322, 323
GetVolSerialNum 121, 140
Getyn 123, 124, 134, 135, 141, 146, 147,
148, 149
Gotohv 19, 29, 142, 283, 285, 371, 372
Greg... 22, 53, 57, 58, 59, 116, 143, 210,
251, 329, 351


H
Horiz_line 19, 20, 144, 370


I
Initkeyvars 145
Inkey 30, 123, 124, 126, 127, 130, 131,
132, 133, 134, 135, 136, 137, 138,
141, 145, 146, 147, 148, 149, 166,
175, 188, 205, 211, 215, 268, 362
Inkeyc 134, 135, 141, 146, 147, 148, 149,
215, 268, 362
Inkeycdv 146, 147, 148, 149, 215, 268
Inkeydv 131, 132, 146, 147, 148, 149, 215,
268
InsLock 23, 151, 261, 311
Intlen 150










TCHK 2.1 Page 377

Is2nd8259 152
Isallalpha 153, 154, 155, 156
Isallalphanum 153, 154, 155, 156
Isalllower 153, 154, 155, 156
Isallupper 153, 154, 155, 156
IsAnarkey 157
IsAppendavail 158, 159, 197
IsAssignavail 119, 158, 159, 197
IsAutoPark 160, 316
IsBlogical 161
IsBREAKon 162, 199, 317, 325
Iscdevicemoderaw 163, 169, 178, 193, 194, 195
IsCEDavail 24, 25, 164
IsCGA 165
Iscolor 165
Isdate 166
Isdir 108, 111, 167
IsDoubleDOS 98, 99, 100, 168, 180
Isdrivelocal 163, 169, 178, 193, 194, 195, 318
IsDriverSys 170
IsEGA 165
IsEMSavail 101, 102, 103, 104, 105, 171
IsEnhanceKbd 172
Iseven 173, 187
IsExtended 109, 174
Isfilename 175, 188
Isgameport 176, 205, 206, 207, 208, 209
Isgn 115, 177, 224
Ishandlelocal 163, 169, 178, 193, 194, 195, 318
IsHerc 165
IsHiliteable 27, 179, 216, 217, 218, 219, 220,
221, 240, 241, 269, 271, 272, 273,
274, 275, 276
IsInvisible 98, 99, 100, 168, 180
Isleapyear 53, 181, 368
IsMCA 182
IsMDA 165
Ismono 165
Ismouse 183, 252
IsNetwork 184
IsNLSFuncCom 185
IsNovellNetavail 186
Isodd 173, 187
Ispathname 175, 188
IspcAnywhere 189, 320
IsPM 191, 361, 365
IsPRINTavail 190, 277, 278, 279, 280, 281, 282
Isrealtimeclock 192
IsRedirectStdin 163, 169, 178, 193, 194, 195, 318
IsRedirectStdout 163, 169, 178, 193, 194, 195, 318
Isremoveable 163, 169, 178, 193, 194, 195, 318
IsScrnSav2 196
IsShareavail 158, 159, 197
Isstate 198, 204, 333










TCHK 2.1 Page 378

IsVERIFYon 162, 199, 317, 325
IsVidclock 200
IsWhoa 201, 326, 367
Iswildcarded 202
IsXMSinstalled 203
Iszip 198, 204, 333


J
JoystickAx 176, 205, 206, 207, 208, 209
JoystickAy 176, 205, 206, 207, 208, 209
JoystickBx 176, 205, 206, 207, 208, 209
JoystickBy 176, 205, 206, 207, 208, 209
Joysticksettings 176, 205, 206, 207, 208, 209
Jul... 22, 53, 57, 58, 59, 116, 143, 210,
251, 329, 351


K
Keyclick 211
Key_extended 134
Key_status 134


L
Leftstr 212, 248, 299
Litebarerrno 27, 216, 217, 218, 219, 220, 221, 240
Litebar_alloc 27, 213, 217, 218, 219, 220, 221, 240
Litebar_free 27, 215, 216, 217, 218, 219, 220,
221, 240
Litebar_get 27, 215, 216, 217, 218, 219, 220,
221, 240
Litehilite 27, 216, 217, 218, 219, 220, 221, 240
Litemessage 27, 216, 217, 218, 219, 220, 221, 240
Liteunlite 216, 217, 218, 219, 220, 221, 240
Longtodostime 95, 222
Lpow 223
Lsgn 115, 177, 224
Ltrim 225


M
Machine_id 44, 182, 226, 259, 302, 303
MAXDOUBLE 110
MButtonPress 227, 228, 229
MButtonRelease 227, 228, 229
MButtonStatus 227, 228, 229
MCursorGraphic 230, 231, 232, 233, 234, 235, 246
MCursorOff 230, 231, 232, 233, 234, 235, 246
MCursorOn 230, 231, 232, 233, 234, 235, 246,
258
MCursorRangex 230, 231, 232, 233, 234, 235, 246
MCursorRangey 230, 231, 232, 233, 234, 235, 246
MCursorText 230, 231, 232, 233, 234, 235, 246










TCHK 2.1 Page 379

MDriverSize 236, 243, 253
Memory_strategy 237
MEmulateLightpenOff 238, 239
MEmulateLightpenOn 238, 239
Menu_litebar 27, 216, 217, 218, 219, 220, 221, 240
Menu_popup 241, 269, 271, 272, 273, 274, 275,
276
MGetDisplayPage 242, 254
MGetDriver 236, 243, 253
MGetSensitivity 244, 255, 256, 257
MGetVerType 183, 245, 252
MGotoxy 230, 231, 232, 233, 234, 235, 246
Mid 95, 212, 227, 228, 229, 247, 248,
260, 299, 361
Midstr 212, 248, 299
MMickeysMovedx 249, 250
MMickeysMovedy 249, 250
Monthexpand 22, 53, 57, 58, 59, 116, 143, 210,
251, 329, 351
MouseReset 183, 252
MPutDriver 236, 243, 253
MSetDisplayPage 242, 254
MSetRatio 244, 255, 256, 257
MSetSensitivity 244, 255, 256, 257
MSetThreshold 244, 255, 256, 257
MUpdateScreen 258


N
Ndp_id 44, 226, 259
Nmid 247, 260
NOTOPTION 214, 267, 268
NumLock 23, 151, 261, 311


P
Parsefilename 108, 128, 262, 263, 264, 297
Parsefnameext 108, 128, 263, 264, 297
Pause 265
PMT 117, 118, 266, 286, 287
Pophilite 241, 270, 271, 272, 273, 274, 275,
276
Popunlite 241, 270, 271, 272, 273, 274, 275,
276
Popuperrno 241, 269, 270, 271, 272, 273, 274,
275, 276
Popup_alloc 241, 267, 271, 272, 273, 274, 275,
276
Popup_free 241, 268, 269, 271, 272, 273, 274,
275, 276
Popup_get 241, 268, 269, 271, 272, 273, 274,
275, 276
Popup_restore 241, 269, 271, 272, 273, 274, 275,
276










TCHK 2.1 Page 380

Popup_setcurrent 241, 269, 271, 272, 273, 274, 275,
276
PRINTadd 190, 277, 278, 279, 280, 281, 282
PRINThold 190, 277, 278, 279, 280, 281, 282
PRINTpurge 190, 277, 278, 279, 280, 281, 282
PRINTremove 190, 277, 278, 279, 280, 281, 282
PRINTresume 190, 277, 278, 279, 280, 281, 282
Print_screen 277
Putk 19, 29, 123, 283, 284, 285, 312
Putsay 283, 284, 285
Putstr 135, 141, 283, 284, 285, 312
PV 117, 118, 266, 286, 287
PVa 117, 118, 266, 286, 287


R
Radd 288, 289, 290, 298, 300, 301, 305,
306
Rceil 288, 289, 290, 298, 300, 301, 305,
306
Rdiv 288, 289, 290, 298, 300, 301, 305,
306
Read_attrib 291, 292
Read_char 291, 292
Read_cursor 49, 50, 51, 52, 125, 142, 293, 313,
319, 371, 372
Read_mode 294, 315
Reboot 295
ResetPointDevice 139, 296, 321, 322, 323
Resolvepath 128, 263, 264, 297
Rfloor 288, 289, 290, 298, 300, 301, 305,
306
Rightstr 212, 248, 299
Rnegate 288, 289, 290, 298, 300, 301, 305,
306
Rnormalize 288, 289, 290, 298, 300, 301, 305,
306
ROM_date 182, 226, 302, 303
ROM_id 182, 226, 302, 303
Round 114, 289, 290, 298, 304, 352
Rsign 288, 289, 290, 298, 300, 301, 305,
306
Rsub 288, 289, 290, 298, 300, 301, 305,
306
Rtrim 307


S
Scrbuff 20, 21, 308
ScrollLock 23, 311
Scroll_down 309, 310
Scroll_up 309, 310
SetAutoPark 316
SetBREAK 162, 199, 317, 325










TCHK 2.1 Page 381

Setcdevicemoderaw 318
Setcursor 49, 50, 51, 52, 125, 293, 313, 319
SetpcAnywhere 189, 320
SetPointDevice 139, 296, 321, 322, 323
SetRatePointDevice 139, 296, 321, 322, 323
SetResPointDevice 139, 296, 321, 322, 323
Settextinfo 215, 268, 324
SetVERIFY 162, 199, 317, 325
SetWhoa 201, 326, 367
Set_color 283, 284, 285, 312
Set_cursor 49, 50, 51, 52, 125, 293, 313, 319
Set_handles 314
Set_mode 9, 294, 315
Shadow 327
SHADOW_B 327
SHADOW_BR 327
SHADOW_R 327
Shorttoddate 22, 53, 57, 58, 59, 116, 143, 210,
251, 329, 351
SLD 8, 335
Soundex 330, 331
Sqr 332
Stateindex 198, 204, 333
States 198, 333
Stddev 14, 334, 357, 369
Straight_line_dep 8, 60, 97, 335, 356
Strcapital 336
Strclean 337
Strcomma 150, 338, 350
Strdel 339
Strfill 340
Strins 341
Stroccur 342
Strpadleft 343, 344
Strpadright 343, 344
Strrep 340, 345
Strshleft 346

Strshright 347
Strspace2tab 348, 349
Strtabexpand 348, 349
Strtocomma 338, 350
Strtoddate 22, 53, 57, 58, 59, 116, 143, 210,
251, 329, 351
Strtodol 352
Strtotime 353, 359, 360
Struct BIOSParmBlock 122
Struct BootBlock 120, 121
Struct BootBlock4 121
Struct ddate 55, 56, 57, 58, 59, 87, 116, 210,
329, 351
Struct DESQmemory 64, 65, 69
Struct EMSrecord 103, 104
Struct filespec 262, 263
Struct fnameext 264










TCHK 2.1 Page 382

Struct litebar_field 27
Struct litebar_header 27, 213, 217, 218, 219, 220, 221
Struct popup_header 267, 271, 272, 273, 274, 275, 276
Struct REAL 288, 289, 290, 298, 300, 301, 305,
306
Strwcmp 354, 355
Strwicmp 354, 355
Summation 14, 110, 334, 357, 369
Sum_year_digits_dep 8, 60, 97, 335, 356
Swap 358
SYD 8, 356


T
Timetostr 353, 359, 360
Time_convert 191, 359, 361, 365
To24hour 191, 361, 365
Tocapkey 146, 147, 148, 149, 362
Todosdate 90, 91, 92, 93, 94, 96, 363, 364
Todostime 90, 91, 92, 93, 94, 96, 363, 364
Tohour 191, 361, 365
Tone 15, 366


U
UDFIDLE 131, 215, 269
UninstallWhoa 201, 326, 367


V
Valid_date 181, 368
Variance 14, 334, 357, 369
Vert_line 19, 20, 144, 370


W
Whereh 142, 293, 371, 372
Wherev 142, 293, 371, 372























  3 Responses to “Category : C Source Code
Archive   : TCHK21.ZIP
Filename : TCHKF.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/