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: , code 13 , code 27 , 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