home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol080 / console.doc < prev    next >
Text File  |  1984-04-29  |  4KB  |  70 lines

  1.       CONSOLE-CONTROL PROCEDURES FOR PASCAL/Z
  2.  
  3.     The console-control procedures "Conact", GotoXY", 
  4. and "ReadXY" are provided as built-in extensions to the 
  5. language in Pascal/M and UCSD Pascal, but not in Pascal/Z. 
  6. The accompanying files "CONACT.PSP" and "GOTOXY.PSP" 
  7. (filetype "PSP" is for "PaScal Procedure", to distinguish 
  8. such a file from an executable Pascal program) provide two 
  9. of these procedures. The third, "ReadXY", has not yet been 
  10. successfully implemented, for reasons described later.
  11.     Since the Pascal/M and UCSD console procedures are 
  12. called frequently from programs written in either of these 
  13. two implementations of Pascal, conversion of such programs 
  14. to Pascal/Z can be done much more easily if the necessary 
  15. procedures can simply be included in the program and called
  16. in the same way. Since most CRT terminals use different 
  17. control codes for the actions needed, however, it will be 
  18. necessary to change the codes shown here to whatever your 
  19. own terminal requires. In most cases, this will require no 
  20. changes in the procedure headings or the formal parameter 
  21. types, though, so the interface to the programs can be the 
  22. same, no matter which terminal you have. To repeat a theme 
  23. I've used elsewhere, maximum compatibility between 
  24. different programmers, and different dialects of Pascal, 
  25. should benefit all of us -- and if you take the trouble to 
  26. get these procedures working right for your hardware setup,
  27. and then use them in your own programs, it should be one 
  28. more step toward this goal.
  29.     Since it may not always be obvious, from the 
  30. information given in the various manuals (it certainly 
  31. wasn't in mine), exactly how to get hardware-dependent 
  32. procedures like these working right, some trial and error 
  33. may be required. To facilitate this process, I also wrote 
  34. a program called "CONSOLE.PAS", to test the procedures.
  35. Unfortunately, neither this nor "READXY" could be included 
  36. on this disk, due to two problems with Pascal/Z that I 
  37. haven't yet figured out solutions for. One is that the 
  38. "Read" function is improperly implemented from the "Input" 
  39. (console) file, and it acts like "Readln" instead (waits 
  40. for a "Return" before accepting the input). The other is 
  41. the failure to provide a non-echoing mode for inputs from 
  42. the console, like the "Keyboard" file in Pascal/M and UCSD.
  43. Together these flaws make it impossible to move the cursor 
  44. around under user control, or accept the X,Y return values 
  45. from "ReadXY", since everything keeps getting echoed to the
  46. screen. I've tried a number of ways of working around these
  47. problems, including the "Input" procedure on p. 77 of the
  48. Pascal/Z Manual, but so far without success. If I were a 
  49. better assembly-language programmer, I might have been able
  50. to make it work, but (now, here comes the soapbox) the 
  51. whole point of using a high-level (and in the case of 
  52. Pascal/Z, high-priced!) language is to avoid having to do 
  53. this sort of low-level hacking. After about a week of 
  54. unsuccessful attempts, I decided that there were better 
  55. ways to spend my time than trying to add features to the 
  56. language that should have been there in the first place. 
  57. Good console-control procedures are a must for a language 
  58. that's going to be used to develop serious applications 
  59. software, and I can only hope that they are provided for 
  60. Pascal/Z before much longer (sorry about the tirade, but it
  61. was a long, frustrating experience). Anyway, try out the 
  62. two procedures that I was able to use (they seem to work in
  63. my programs, at least -- see "ARTIL/Z.PAS" for some 
  64. examples), and good luck with them.
  65.  
  66.             Jim Bearden
  67.             Cancer Center, University of Hawaii
  68.             1236 Lauhala Street
  69.             Honolulu, Hawaii 96813
  70.