home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS - Coast to Coast
/
simteldosarchivecoasttocoast2.iso
/
turbopas
/
tpdoors.zip
/
PCBDOORS.DOC
< prev
next >
Wrap
Text File
|
1988-01-26
|
8KB
|
190 lines
PCBDOORS
Copyright (C)1988 Joseph E. Goodin III
This collection of routines will aid any programmer in developing doors
using Turbo Pascal 4.0 that will run under PCBOARD V12.0 or higher.
These routines are being distributed in compiled form and released as
shareware. Door developers are asked to send $10, for each door they
are used in, to:
Joseph E. Goodin III
Circle Drive
Tilton, NH 03276
Techincal questions may be send to that address or left on the M.O.R.E.
BBS (1-401-849-1874 8/1/N 9600/4800/2400/1200/300). A copy of the
source code and more liberal usage rights may be purchased from either
of the above sources for $50. This source code may also be purchased
in Turbo Pascal 3.0 compatible form and a Turbo C version will be
released in the near future.
Interfacing these routines to your door is done by using the following
globally declared variables, functions, and procedures:
Variables:
cfg_location : string128; - this variable holds the name and location
of the door configuration file (Example: C:DOOR1.CFG). This variable
is usually set in the code to just the name of the file with no path
because in most circumstances the batch file will have already changed
to the directory where the configuration file and the door program
are located.
sys_location : string128; - this variable holds the name and location
of the pcboard.sys file (Example: C:\PCB\PCBOARD.SYS). This variable
is usually set by calling the get_cfg procedure which gets it by
reading the first line of the configuration file.
machine : string1; - this variable holds the type of machine that the
program will be running on, choices are (I)BM or (C)lone. This should
be first set to "I" and then test run. If there is no echo to the
sysop screen while being run remotely then the setting should be
changed to "C". This causes output to be changed from ROM-BIOS calls
to MSDOS calls, which are slower but deliver a higher degree of
compatibility. This variable is usually set by calling the get_cfg
procedure which gets it by reading the second line of the configuration
file.
time_on : integer; - this variable holds the number of minutes that the
user is allowed to access the door. This variable is usually set by
calling the get_cfg procedure which gets it by reading the third line
if the configuration file (Example: 30 = 30 minutes of usage).
time_in : integer; - this variable holds the time of day in minutes as
read from the system clock (Example: 10:45am = 645). This variable
is usually set by calling the get_cfg procedure which gets it by
reading the system clock.
time_out : integer; - this variable holds the time of day in minutes that
the user will automatically be ejected from the door because his time
has expired. This varialbe is usually set by calling the get_cfg
procedure which gets it by calculating it using the time_on and time_in
variables (Example: time_on = 30, time_in = 645, time_out = 675, which
means the users time will expire at 11:15am).
com : integer; - this variable holds the device number used by IOCTRL to
access the COM ports (Examples: COM1 = 0 and COM2 = 1). This variable is
usually set by calling the get_cfg procedure which gets it by reading
the fourth line of the configuration file. (The configuration file
entry must be the true DOS number for the COM port, i.e. COM1 = 1).
user : string80; - this variable holds 80 characters of data that can
be used by the door developer in any way. This variable is usually
set by calling the get_cfg procedure which gets it by reading the fifth
line of the configuration file.
name : string25; - this variable holds the full name of the current user
logged onto the PCBOARD system (Example: JOE GOODIN). This variable
is usually set by calling the get_sys procedure which gets it by reading
the PCBOARD.SYS file.
first : string15; - this variable holds the first name of the current user
logged onto the PCBOARD system (Example: Joe). This variable is usually
set by calling the get_sys procedure which gets it by reading the
PCBOARD.SYS file.
bps : string4; - this variable holds the modem speed of the PCBOARD user
(Examples: 2400,1200, 300,Loca). This variable is usually set by calling
the get_sys procedure which gets it by reading the PCBOARD.SYS file.
str_range : set of char; - this variable holds a set of characters that
are considered valid inputs to the getstr function (Example: if the input
is to be an answer to a Yes/No question then:
str_range:= ['Y','y','N','n'];
would be a good setting for str_range. At the beginning of the door
code setting the variable to:
str_range:= [' '..'~'];
would be a good idea).
Procedures:
procedure get_cfg(cfg_location : string128;
var sys_location : string128;
var machine : string1;
var time_on,time_in,time_out,com : integer;
var user : string80);
This procedure is passed the name and location of the configuration
file in the variable cfg_location and the other variables are set
and passed back. If a configuration file is not found an error is
trapped, the door is terminated, and control is returned to PCBOARD.
procedure get_sys(sys_location : string128;
var name : string25;
var first : string15;
var bps : string4);
This procedure is passed the name and location of the PCBOARD.SYS
file in the variable sys_location and the other variables are set
and passed back. If PCBOARD.SYS is not found an error is trapped,
the door is terminated, and control is returned to PCBOARD.
procedure wrt(line : string80);
This procedure outputs the line of text passed to it to the I/O
port and to the console. No CR or LF is output.
procedure wrtln(line : string80);
This procedure outputs the line of text passed to it to the I/O
port and to the console. A CR and a LF are both output.
procedure io_flush;
This procedure flushes both the keyboard buffer and the I/O port.
procedure sysop_window;
This procedure establishes the sysop window, clears it, and puts
the sysop hot keys in inverse video at the bottom of the screen.
Functions:
function ck_time(time_out : integer) : boolean;
This function returns a boolean that is true if the time passed
in time_out is less than the current system time and false if it
is greater than or equal to the current system time.
function get_input : char;
This function is a single character input from either the keyboard
or I/O port without waiting for a <CR>.
function getnum(var number : integer) : boolean;
This function returns an integer number in the range -32768..32767
in the variable number that is passed to it in the argument. The
function itself is a boolean that is true if a valid number has been
returned and false if number is invalid.
function getstr(str_length : integer;
var strg : string80) : boolean;
This function returns an string of length str_length the variable
strg that is passed to it in the argument. The function itself is
a boolean that is true if a valid string has been returned and false
if strg is invalid.