home *** CD-ROM | disk | FTP | other *** search
- DOCUMENTATION FOR IO23DEMO.PAS/COM -- 12/10/87
-
- Bill Meacham
- 1004 Elm Street
- Austin, Tx 78703
-
- PUBLIC DOMAIN -- NO COPYRIGHT
-
- This program demonstrates a sophisticated method of controlling console data
- entry in Turbo Pascal version 4.0. It allows you precise control over where
- data entry occurs on the screen and makes your programs crash-proof from user
- input. This is version 2.3. I have translated version 2.2 to Turbo Pascal
- version 4.0 and fixed a couple of obscure bugs in the process. Version 2.2
- is described in detail in Computer Language magazine, October 1987, page 57,
- "Build Your Own User Interface." Version 2.3 works just the same, so see the
- article for more information.
-
- All the I/O (input/output) routines except for dates are in the source file
- IO23UNIT.PAS. This is compiled as a linkable Unit.
-
- The program also demonstrates a number of ways to manipulate and perform
- calculations with dates. All the date routines are in the file DATE23.PAS.
- If you Use this file, you must Use IO23UNIT.PAS first.
-
- Miscellaneous routines for changing colors, etc. on the screen are found in
- DOS23.PAS. It's called "DOS" because it uses MS-DOS function calls.
-
- Put the compiler toggle {$V-} at the top of your program; this allows you
- to use strings of varying lengths. Put the command "checkbreak := false"
- in the code before you read anything from the console; this disables
- checking for control-break and prevents the user from breaking out of the
- program.
-
- If you have Fansi-Console or a similar video display speed-up utility
- installed in your computer it will interfere with Turbo Pascal 4.0's direct
- video screen writes. The solution is to either (a) remove the video
- speed-up utility before running your Turbo 4.0 program or (b) put the
- command "directvideo := false" at the beginning of your program. If you do
- (b) Turbo uses ROM BIOS calls to display things on the screen instead of
- writing directly to video RAM. Screen displays are then slower, about as
- fast as in Turbo 3.0, but are not glitched by the video speed-up utility.
-
- The rest of this document describes the Unit files.
-
-
- IO23UNIT.PAS --------------------------------------------------------------
-
- The functions and procedures in this Unit allow you to control console I/O
- with great precision. You can read and write strings, integers, reals and
- booleans at any place on the screen and prevent the user from entering
- garbage. User input cannot crash your program! You can easily control
- cursor movement through data entry forms displayed on the screen, not only
- from field to field but from screen to screen.
-
- The data input procedures, READ_STR, READ_INT, etc., have an intentional
- side-effect on the global variable FLD, which controls which field the
- cursor goes to. Study the code in procedures STRINGS, INTEGERS, REALS and
- BOOLEANS in the demonstration program to see how a case statement within a
- repeat-until loop uses this variable. Study the code in procedure IO_DEMO
- in the demonstration program to see how a similar case statement within a
- repeat-until loop uses the global variable SCRN to control which screen is
- displayed.
-
- The Interface section describes the global types, variables, procedures
- and functions that you can call from your program. (There are a few more
- that are used by these procedures and functions, but are not intended to be
- called by themselves.)
-
-
- DATE23.PAS ----------------------------------------------------------------
-
- The functions and procedures in this Unit allow you to read and write
- dates in a fashion similar to reading and writing strings, integers, reals
- and booleans. You can also perform number of other functions on dates,
- such as count the number of days between two dates, test for leapyear,
- compute the previous and next day, etc. To Use this unit you must first
- Use IO23UNIT.
-
-
- DOS23.PAS ----------------------------------------------------------------
-
- This Unit uses MS-DOS function calls to set screen colors, turn reverse
- video on and off, find out how much free space there is on the disk, etc.