home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / TP4IO23.ZIP / IO23DEMO.DOC < prev    next >
Encoding:
Text File  |  1987-12-10  |  4.0 KB  |  84 lines

  1. DOCUMENTATION FOR IO23DEMO.PAS/COM -- 12/10/87
  2.  
  3. Bill Meacham
  4. 1004 Elm Street
  5. Austin, Tx  78703
  6.  
  7. PUBLIC DOMAIN -- NO COPYRIGHT
  8.  
  9. This program demonstrates a sophisticated method of controlling console data
  10. entry in Turbo Pascal version 4.0.  It allows you precise control over where
  11. data entry occurs on the screen and makes your programs crash-proof from user
  12. input.  This is version 2.3.  I have translated version 2.2 to Turbo Pascal
  13. version 4.0 and fixed a couple of obscure bugs in the process.  Version 2.2
  14. is described in detail in Computer Language magazine, October 1987, page 57,
  15. "Build Your Own User Interface."  Version 2.3 works just the same, so see the
  16. article for more information.
  17.  
  18. All the I/O (input/output) routines except for dates are in the source file
  19. IO23UNIT.PAS.  This is compiled as a linkable Unit.
  20.  
  21. The program also demonstrates a number of ways to manipulate and perform
  22. calculations with dates.  All the date routines are in the file DATE23.PAS. 
  23. If you Use this file, you must Use IO23UNIT.PAS first.
  24.  
  25. Miscellaneous routines for changing colors, etc. on the screen are found in
  26. DOS23.PAS.  It's called "DOS" because it uses MS-DOS function calls.
  27.  
  28. Put the compiler toggle {$V-} at the top of your program; this allows you
  29. to use strings of varying lengths.  Put the command "checkbreak := false"
  30. in the code before you read anything from the console; this disables
  31. checking for control-break and prevents the user from breaking out of the
  32. program.
  33.  
  34. If you have Fansi-Console or a similar video display speed-up utility
  35. installed in your computer it will interfere with Turbo Pascal 4.0's direct
  36. video screen writes.  The solution is to either (a) remove the video
  37. speed-up utility before running your Turbo 4.0 program or (b) put the
  38. command "directvideo := false" at the beginning of your program.  If you do
  39. (b) Turbo uses ROM BIOS calls to display things on the screen instead of
  40. writing directly to video RAM.  Screen displays are then slower, about as
  41. fast as in Turbo 3.0, but are not glitched by the video speed-up utility.
  42.  
  43. The rest of this document describes the Unit files.
  44.  
  45.  
  46. IO23UNIT.PAS --------------------------------------------------------------
  47.  
  48. The functions and procedures in this Unit allow you to control console I/O
  49. with great precision.  You can read and write strings, integers, reals and
  50. booleans at any place on the screen and prevent the user from entering
  51. garbage.  User input cannot crash your program!  You can easily control
  52. cursor movement through data entry forms displayed on the screen, not only
  53. from field to field but from screen to screen.
  54.  
  55. The data input procedures, READ_STR, READ_INT, etc., have an intentional
  56. side-effect on the global variable FLD, which controls which field the
  57. cursor goes to.  Study the code in procedures STRINGS, INTEGERS, REALS and
  58. BOOLEANS in the demonstration program to see how a case statement within a
  59. repeat-until loop uses this variable.  Study the code in procedure IO_DEMO
  60. in the demonstration program to see how a similar case statement within a
  61. repeat-until loop uses the global variable SCRN to control which screen is
  62. displayed.
  63.  
  64. The Interface section describes the global types, variables, procedures
  65. and functions that you can call from your program.  (There are a few more
  66. that are used by these procedures and functions, but are not intended to be
  67. called by themselves.)
  68.  
  69.  
  70. DATE23.PAS ----------------------------------------------------------------
  71.  
  72. The functions and procedures in this Unit allow you to read and write
  73. dates in a fashion similar to reading and writing strings, integers, reals
  74. and booleans.  You can also perform number of other functions on dates,
  75. such as count the number of days between two dates, test for leapyear,
  76. compute the previous and next day, etc.  To Use this unit you must first
  77. Use IO23UNIT.
  78.  
  79.  
  80. DOS23.PAS ----------------------------------------------------------------
  81.  
  82. This Unit uses MS-DOS function calls to set screen colors, turn reverse
  83. video on and off, find out how much free space there is on the disk, etc.
  84.