home *** CD-ROM | disk | FTP | other *** search
- (*
- TESTLN5.PAS
- Test program for Inline Procedure TOADLN5.INC
- and External Procedure TOADLN5A.BIN
-
- Like READLN, but:
- - Strings only (e.g., don't Toadln(VAR i : INTEGER)
- like you could READLN(VAR i : INTEGER)!
- - TOADLN does NOT "initialize" the string VAR.
- In other words, you can edit an existing string as you desire.
- WATCH OUT FOR "NONINITIALIZED" STRINGS! No telling WHAT they might
- contain .. Turbo Pascal does NOT initialize a string variable
- to length 0, clear it, or anything else! String length and contents
- will be unknown (usually full of beeps and funny faces).
- - Up to 255 chars with "full screen" cursor control and editing.
- Legend:
- "last char" - If less than 255 chars in the string,
- cursor is positioned to space just past last string char.
- Else cursor is positioned ON last char.
- "Home" - Cursor position of first string char.
- "line up" - The cursor tries to move straight up one line.
- If there's not a string char there (e.g., we're now
- positioned left of the string's starting column),
- the cursor moves to the string's first char.
- "line down" - The cursor tries to move straight down one line.
- If there's not a string char there (e.g., we're now
- positioned right of the string's "last char"),
- the cursor moves to the string's "last char."
- Ctrl/Function Keys enabled:
- ^U - clear string, "home" cursor
- ^V - Toggle insert/overwrite mode (default insert)
- Home - move cursor to string start
- End - move cursor to "last char"
- Lft Arr - move cursor 1 char left (up to string start)
- Rt Arr - move cursor 1 char right (to "last char")
- Dn Arr - move cursor 1 line down (or to "last char")
- Up Arr - move cursor 1 line up (or to string start)
- BackSpace - Move cursor 1 character left, do a Delete.
- If at "Home", acts like Delete.
- Delete - Delete character at current cursor position,
- move rest of string left 1 char.
- Return,
- ^Z - Done, CR/LF, returns string. (Ignores cursor position.)
- Other Chars:
- - Gobbles any other function or cursor keys.
- - Passes through other Control chars as the PC "graphics" character.
- (You'll get funny-looking characters.)
- - Unlike READLN, passes through the ESCape key as its ASCII value
- (so you can do ANSI command sequences if you want).
-
- Versions:
- 1.4 - 22 Aug 88, Initial release.
- 1.5 - 23 Aug 88
- - Changed inline code to use more conventional addressing for
- local variables (e.g., "mov [bp+4],dx" rather than "mov >xy[bp],dx").
- Also doing our own SP fiddling to provide the two local integer
- variables required. (No more "VAR xy,width : INTEGER" required.)
- This is all in prep for making TOADLN an external file
- instead of Inline code.
- - Fixed bug in handling BackSpace at the first string char.
- (Now, when sitting on the first char, you can't delete that char
- with a BackSpace, just like a real Backspace works.)
- - Added Insert key toggle
- - Slight code tweaking.
- 1.5A, 24 Aug 88
- - TOADLN5A.ASM is for compilation via MASM, LINK, and EXE2BIN
- (or the Public Domain EXE2COM), producing TOADLN5A.BIN,
- a Turbo Pascal "External Procedure"
- No functional changes from TOADLN5.ASM/.OBJ.
- Released now with
- TOADLN5A.ASM MASM-compatible assembler source
- TOADLN5A.BIN compiled external procedure
- TOADLN5.ASM INLINE-compatible assembler source
- TOADLN5.INC Turbo Pascal procedure with inline code.
- TESTLN5.PAS Test program to test either procedure.
-
- Released to Public Domain.
-
- Many many thanks to L. David Baldwin for his tremendous Public Domain
- Turbo Inline assembler utility, INLINE.COM .. more glory to his name.
-
- If distributing, PLEASE do not remove source code! If you port it
- to some other language, PLEASE include original and new source code.
- (Else may you be cursed with a plague on your house
- and a virus in your hard disk!)
-
- David Kirschbaum
- Toad Hall
- kirsch@braggvax.ARPA
- *)
-
- TYPE
- Str255 = STRING[255];
-
- VAR
- S : Str255;
-
- (* Enable ONE of the following by "uncommenting" it. Insure you have
- the appropriate file (TOADLN5A.BIN or TOADLN5.INC in your current
- drive/directory.
- *)
-
- (*
- PROCEDURE ToadLn(VAR S : Str255) ; External 'TOADLN5A.BIN';
- { Use the external program }
- *)
- (*
- {$I TOADLN5.INC} {a full Turbo Pascal procedure with inline code}
- *)
-
- BEGIN
- S := '';
- WHILE LENGTH(S) < 140 DO {build a long string}
- S := S + '0123456789';
- ClrScr;
- GotoXY(1,8);
- Write('Prompt at line 8: ');
- Toadln(S);
- Writeln('Your answer: [', S, '] ', LENGTH(S));
-
- GotoXY(1,25);
- Write('Prompt at screen bottom (notice the automatic scroll): ');
- Toadln(S);
- Writeln('Your answer: [', S, '] ', LENGTH(S));
- END.