home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
turbopas
/
lineinp.lbr
/
LINEINP.DQC
/
LINEINP.DOC
Wrap
Text File
|
1986-04-07
|
7KB
|
175 lines
DOCUMENTATION FOR LINEINP.INC
-----------------------------
LINEINP.IN├ i≤ ß genera∞ purposσ inpu⌠ modulσ witΦ suppor⌠ ì
routine≤ writteε iε Turb∩ Pascal« Man∙ program≤ requirσ formateΣ ì
input for dates, dollar amounts, etc. LINEINP.INC was born out
of the need for a common, easy to use interface.
Thσ modulσ i≤ mean⌠ t∩ bσ includeΣ (i.e« {$ILINEINP.INC}⌐ witΦ ì
your Turbo source. It provides many of the standard input forms:
ASCII¼ numeric¼ dollars¼ anΣ formateΣ (anΣ verified⌐ date« I⌠ ì
also can capitalize the input or not echo it (useful for password
entry).
Description of individual procedures and functions:
functioε JDAT┼
Thi≤ i≤ useΣ t∩ returε ß juliaε datσ (° numbe≥ oµ day≤ pas⌠ da∙ ì
0)« Yo⌡ cal∞ i⌠ witΦ ß hopefull∙ valiΣ datσ iε thσ mm/dd/y∙ ì
forma⌠ anΣ i⌠ return≤ ß rea∞ numbe≥ correspondinτ t∩ thσ juliaε ì
date«
Yo⌡ ma∙ wisΦ t∩ referencσ you≥ juliaε basσ t∩ somσ othe≥ value« ì
Iµ yo⌡ wisΦ t∩ convert¼ fo≥ example¼ t∩ thσ MP/═ basσ datσ oµ ì
12/31/7╕ theε simpl∙ subtrac⌠ 722464 froφ thσ juliaε datσ ì
returned.
Example: Julian:=JDATE('01/01/86');
---------------------------------------------------------------
functioε GDAT┼
Thi≤ i≤ useΣ t∩ Gregorian date (mm/dd/yy) from ß given datσ.
You must supply the julian date (real) and GDate will return
the corresponding date in the mm/dd/yy format.
Example: DueDate:=GDATE(722464.0); [ Returns '12/31/78' ]
---------------------------------------------------------------
functioε DATECALC;
Thi≤ i≤ ß ver∙ hand∙ function« Giveε ß datσ iε thσ standarΣ ì
mm/dd/y∙ forma⌠ anΣ ß giveε numbe≥ oµ day≤ (+-32767)¼ DATECAL├ ì
wil∞ returε ß datσ (mm/dd/yy⌐ tha⌠ i≤ tha⌠ numbe≥ oµ day≤ iε thσ ì
future or past.
Examples: NewDate:=DATECALC('01/01/86',30);
NewDate:=DATECALC('02/28/84',-45);
---------------------------------------------------------------
functioε GOODDATE è
Thi≤ functioε return≤ TRU┼ iµ thσ datσ passeΣ t∩ i⌠ i≤ ß valiΣ ì
date or FALSE if it is invalid.
Examples: Ok:=GoodDate('02/29/84'); [ Returns TRUE ]
Ok:=GoodDate('02/29/86'); [ Returns FALSE ]
---------------------------------------------------------------
function MakeStr
This simply returns a string of a given number of characters.
Example║ Write(MakeStr(5,'*'))╗ █ write≤ '*****º ]
---------------------------------------------------------------
Procedure INPUT
Format: INPUT( Variable to store string (may be preset),
Maximum length of input string,
Row (1-24),
Column (1-80),
Type (1-4),
EscCode);
The variable that stores the string is defined as a string[255].
Iµ yo⌡ arσ enterinτ ß numeriπ value¼ yo⌡ mus⌠ conver⌠ thσ strinτ ì
variablσ t∩ ß numeriπ variablσ outsidσ oµ thi≤ routinσ (usinτ thσ ì
VA╠ procedurσ o≥ othe≥ method)« Iµ yo⌡ cal∞ INPU╘ witΦ thσ ì
string variable preset to some value, you may edit that value
using all the cursor keys described below.
Maximuφ lengtΦ oµ thσ inpu⌠ strinτ ma∙ bσ betweeε 1-255« Yo⌡ ma∙ ì
no⌠ (makσ tha⌠ shoulΣ not¼ a≤ thσ procedure doesn'⌠ bothe≥ t∩ ì
check⌐ ente≥ morσ tha⌠ 25╡ characters« Iµ yo⌡ se⌠ thσ lengtΦ t∩ ì
ß negativσ number¼ use≥ inpu⌠ wil∞ no⌠ bσ echoeΣ a≤ i⌠ i≤ ì
entered« Fo≥ example¼ callinτ INPU╘ witΦ ß lengtΦ oµ -╢ wil∞ ì
allo≈ thσ use≥ t∩ ente≥ ß strinτ u≡ t∩ ╢ characte≥ lonτ bu⌠ ì
his/he≥ inpu⌠ wil∞ no⌠ bσ echoeΣ bacδ fo≥ other≤ t∩ see.
Ro≈ anΣ Columε refe≥ t∩ thσ screeε positioε tha⌠ yo⌡ wan⌠ t∩ ì
ente≥ thσ value« I⌠ i≤ useΣ fo≥ thσ edito≥ a≤ wel∞ a≤ thσ ì
reformatter part of the procedure.
Type codes currently implemented are:
1 - ASCII. Will allow any characters to be entered.
2 - NUMERIC. Only '0'-'9','.', and .'-' may be entered.
any other characters (other than the ESC
characters) will ring your bell.
3 - DOLLARS. Allows only numeric data (see above) but
additionally formats the string to twoè digits past the decimal point. I don't
round up, I truncate so be careful (i.e
123.456 is returned as 123.45 not 123.46).
┤ - DATE« Numeriπ datß only« Return≤ aε ╕ bytσ strinτ ì
correspondinτ t∩ mm/dd/y∙ (i.e« 02048╢ ì
returns 02/04/86). If you enter an invalid
date, the program should return 00/00/00 and
als∩ no⌠ prin⌠ thσ formatteΣ datσ t∩ thσ ì
screen. Note: A user program may verify the
date returned by INPUT by using the GoodDate
function included in this module.
Thσ ESCcodσ i≤ thσ ASCI╔ valuσ oµ thσ ke∙ useΣ t∩ exi⌠ thσ INPU╘ ì
procedure« I⌠ caε bσ useΣ t∩ spacσ forwarΣ o≥ backwarΣ ß field¼ ì
or to detect an ESCAPE request. Currently, INPUT will exit with
the following keys: <RETURN> , code 13
<ESC> , code 27
<TAB> , code 9
^E,^X,^J,^K , Up, Down arrow keys
Iµ yo⌡ ente≥ ß negativσ typσ valuσ (-1¼ -2¼ -3¼ o≥ -4)¼ thσ use≥ ì
input will be capitialized. Obviously, this is only meaningful
for type 1 data!
Edito≥ commands║
╔ havσ trieΣ t∩ kee≡ thσ command≤ a≤ simple¼ bu⌠ flexiblσ a≤ ì
possible« Thσ command≤ arσ patterneΣ afte≥ WordSta≥ anΣ thσ ì
Turb∩ editor«
^A - Advances to the front of your input string.
^─ - Move≤ curso≥ righ⌠ onσ spacσ non-destructively« ╔ ì
have also made ^L (a Qume right arrow) do the same.
^F - Advances the cursor forward to the end of your string.
^G - Deletes character under cursor.
DEL - Backspaces and erases character.
^S - Moves the cursor backward one space non-destructively.
I have also made ^H (Backspace) do the same.
^Y - Erases line from cursor to end of the string.
^V - Toggles insert mode. Initially, you are in overstrike
mode.
-----------------------------------------------------------------
A WORD OF CAUTION: IF YOU ARE RUNNING THE Z80 VERSION OF
TURBO PASCA╠ O╥ TH┼ 1╢ BI╘ VERSIO╬ PRIO╥ T╧ 3.0¼ D╧ NO╘ US┼
GDAT┼ O╥ JDAT┼ I╬ ┴ WRIT┼ O╥ WRITEL╬ STATEMEN╘ (i.e« è Write(GDate(X)))« INSTEAD¼ ASSIG╬ ┴ VARIABL┼ (i.e«
X:=GDate(x)) AND THEN USE A WRITE PROCEDURE (Write(X)).
BOT╚ THES┼ ROUTINE╙ US┼ TH┼ VA╠ AND/O╥ ST╥ PROCEDURE╙ I╬
TURB╧ AND TURBO CANNOT PROPERLY PROCESS THE WRITE, WRITELN
FUNCTION. CONSIDER YOURSELF WARNED!
Enjo∙ anΣ pleasσ le⌠ mσ kno≈ oµ an∙ enhancements¼ bugs¼ o≥ ì
improvements you might make to this module. You may reach me
via the Master Silicon RCP/M system at (312) 386-9271.
Ralph Iden