home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / OASISS.ZIP / README.1ST next >
Encoding:
Text File  |  1988-11-22  |  14.7 KB  |  368 lines

  1.              ┌─────────────────────────────────────────┐
  2.              │   SAMPLE4  (OASIS Automatic Disk Menu)  │
  3.              │       EUREKA SOFTWARE ASSOCIATES        │
  4.              └─────────────────────────────────────────┘
  5.  
  6.  
  7.                           ┌──────────────┐
  8.                           │ INTRODUCTION │   
  9.                           └──────────────┘  
  10.  
  11. SAMPLE4 is an automatic Disk menu program written in Turbo Pascal using
  12. Open Architecture Screen Interface System (OASIS), a powerfull but easy
  13. to use development tool including a screen generator. For more on OASIS
  14. check the README.OAS file.
  15.  
  16.  
  17.  
  18.  
  19.                           ┌──────────────┐
  20.                           │ DESCRIPTION  │
  21.                           └──────────────┘
  22.  
  23. This example program is quite a useful DOS utility program.
  24. With SAMPLE4 any program can be executed directly from the menu just by
  25. pointing to it. It can also let you wander across all subdirectories on
  26. your disk. It consists of the following files:
  27.  
  28. SAMPLE4.SCS : The format file, containing a single format. 
  29. SAMPLE4.SCI : The index file to above.
  30. SAMPLE4.MSG : Contains all Field Messages.
  31. SAMPLE4.PAS : The Turbo Pascal source program. 
  32. SAMPLE4.EXE : Compiled version of SAMPLE1.PAS.
  33. SAMPLE4.ERR : Error message file (not used here)
  34.  
  35. To get started load the above files on you hard disk using DOS copy
  36. utility, then type sample4.
  37.  
  38.  
  39.  
  40.  
  41.  
  42.                         ┌──────────────────┐
  43.                         │ TECHNICAL NOTES  │
  44.                         └──────────────────┘
  45.  
  46. If you are a programmer, novice or expert the following is for you. For
  47. a better understanding you are encouraged to consult the README.OAS
  48. file and print the SAMPLE4.PAS source file, it's only a few pages long.
  49. OASIS 5.0 is also available as a shareware called OASP5E.ARC. (Turbo
  50. Pascal 5.0 level).
  51.  
  52.  
  53.  
  54.  
  55. GENERAL STRUCTURE OF PROGRAMS WRIITEN USING OASIS
  56.  
  57. Compiler Option '$V-'
  58.  
  59. This option is required in any SCL program. More details about compiler
  60. options can be found in your 'TURBO PASCAL' manual.  Without this
  61. compiler option specified SCL programs  won't compile. 
  62.  
  63. USES Statement
  64.  
  65. "USES SCL;" makes SCL accessible from within this program.
  66.  
  67.  
  68. Main Program
  69.  
  70. The first statement is Select_Format_File('Sample4');. This procedure
  71. initializes SCL and all required files. 
  72. 'Select_Format_File' is the first SCL statement to be executed and it
  73. appears only once in any program. 
  74.  
  75. Close_Formats; is the last SCL statement. It closes all files and frees
  76. the memory space previously used by SCL. 
  77. Between these two statements, the procedure which processes the format
  78. in this program, Handle_first, is called.
  79.  
  80.  
  81. Format Handling
  82.  
  83. The procedure 'Menu' performs the complete handling of our screen
  84. format.
  85. The first statement, 'Select_Format('amenu');' loads our format (with
  86. the name 'amenu') from the format file into the format stack in memory.
  87. 'Display_Format(X_Max DIV 2,Y_Max DIV 2);' will center it on the
  88. screen.
  89.  
  90. Then follows the actual format handling loop:
  91.  
  92. REPEAT
  93.   Handle_Format; 
  94.   ......
  95.   ......
  96. UNTIL Format_Done;
  97.  
  98. The same Loop is used to process any format in SCL.  The procedure
  99. Handle_Format is exited when any of the following occurs: 
  100.  
  101. * Before a new field on the format is initialized (=entered) 
  102. * Before a field is left 
  103. * Before the format is left (if it is finished)
  104.  
  105. * and, optionally, depending on the format specifications, if a
  106.   User Function Key has been pressed. 
  107.  
  108. The boolean function 'Format_Done' returns FALSE as long as the format
  109. has not been finished. 
  110. The format is considered to be finished if any one of the following
  111. conditions occurs: 
  112.  
  113. * All mandatory fields are filled in and either 'Escape' was hit
  114.   or 'Return' was pressed while being in the last field. 
  115.  
  116. * The 'Abort' key (F10) is pressed.
  117.  
  118.  
  119. Apart from reading and writing fields and, the format handling loop is
  120. always the same, independent of the number and type of fields on a
  121. format. In fact, the above loop can fulfill the handling of any SCL
  122. screen format. There is no need to define any logic for Help screens,
  123. Display of messages, Input error handling,  field check and so on.  All
  124. this is performed automatically by SCL as part of the Format
  125. Specifications which can be modified anytime via SFD. 
  126.  
  127.  
  128.  
  129. SPECIFIC ATTRIBUTES FOR SAMPLE4 
  130.  
  131. Despite (and maybe especially because of) the fact, that SCL has
  132. certainly not been designed to develop DOS utilities, this example
  133. demonstrates and highlights its tremendous power and flexibility. 
  134.  
  135. The main new features exhibited in this program are:
  136.  
  137.      - The 'Execute' and , 'ExecuteDos' routines. 
  138.      - Background processing.
  139.      - More sophisticated User Interrupt Procedures. 
  140.  
  141.  
  142. This program only uses one Format (screen) and the procedure handling
  143. this format is called 'Menu'.
  144. The procedures involved in this task are 'Init_Dir_Search',
  145. 'Display_Files' and 'Tell_Result'. 
  146. Apart from this, within the actual Format handling loop, you find a
  147. statement which invokes a User Interrupt Procedure ('Handle_Key') in
  148. case a User Function Key has been pressed. If the format has been
  149. finished (and was not aborted), the procedure 'Do_Work' is executed. 
  150.  
  151.  
  152.  
  153. The relevant components of the program will be discussed in the
  154. following.
  155.  
  156.  
  157. Init_Dir_Search 
  158.  
  159. This procedure initializes the parameters for our Directory search. It
  160. sets the boolean variable 'First' to TRUE and the search mask to '*.*'
  161. (all files). 
  162.  
  163. Note:  'First' is a parameter for the directory search which if TRUE,
  164. causes it to initialize a new search, i.e to find the first filename
  165. matching the specified mask. Once the first file has been found, it is
  166. set to false and subsequent searches will search for the remaining
  167. files.
  168.  
  169.  
  170.  
  171. Display_Files
  172.  
  173. The first part of this procedure is a REPEAT..UNTIL loop which calls
  174. 'Dir'. If 'Dir' returns a result of 0 (zero), meaning that a  filename 
  175. matching the mask was found,  the  procedure 'Pick_it_if_we_need_it' is
  176. called, which determines whether this file is either an executable file
  177. or a directory entry. If this is the case, the file name is moved to
  178. the first available field and the field count is increased by 1. In
  179. order to determine whether the file found should be displayed on the
  180. format, we access the SCL variable 'Dta' 
  181. We exit the REPEAT..UNTIL loop under any one of the following two
  182. conditions: either the format is full or there are no more files
  183. matching the mask. In the latter case we reinitialize 'Dir' by calling
  184. 'Init_Dir_Search' again and we also blank the remaining fields on the
  185. format. In every case, we also make a note of the highest field on our
  186. format containing a filename entry.
  187. Now that's where the real tricky part starts:
  188. On this format we want to have two active fields at the same time, one
  189. being the field containing the filename to be executed and the other
  190. one where the optional parameters can be entered. SCL can only have one
  191. active field at a time, therefore we have to cheat somehow.
  192. One way to achieve this is to declare all the fields holding filenames
  193. (2 to 46) as 'Output' fields and manipulate these fields independent
  194. from the normal SCL field processing. This just leaves, what SCL
  195. concerns, field 49 as the only cursor accessible field on this format
  196. which is consequently active, i.e ready for input, anytime the format
  197. is displayed.  In order to highlight the currently chosen filename
  198. field, we use the 'selected' field attribute. The procedure
  199. 'Handle_Keys', which monitors the 'arrow' keys, determines which
  200. filename is to be highlighted next and the highlighting itself is
  201. performed by the procedure 'New_Field'. 
  202.  
  203.  
  204. Handle_Keys
  205.  
  206. This procedure acts on all User Function Keys defined for this format.
  207. In  case F9 is pressed,  the field holding the currently highlighted
  208. filename is deselected and 'Display_files' is called to refill the
  209. format. 
  210. In case the display of the current directory is not yet complete,
  211. ('first' is FALSE) the remaining entries are searched to be displayed
  212. now, otherwise a new search cycle is initiated to display the first
  213. page of file names.  In case, one of the 'arrows' or 'Home' or 'End' is
  214. pressed we determine the next field (file name) to be highlighted and
  215. call 'Next_Field' to do it. 
  216.  
  217. The next two keys are only intercepted for user convenience: If
  218. 'Escape' is pressed, it is replaced by 'F10' (Abort) which subsequently
  219. causes the program to be terminated.
  220. If 'Return' is pressed and the parameter field (49) contains spaces
  221. this key is replaced by an 'Escape' character, which causes the format
  222. to be terminated instantly. The reason for this is that SCL would
  223. interpret 'Return' in this case as a command to switch field 49 to
  224. 'Edit Mode' and we would have to press 'Return' (or 'Escape') again to
  225. finish the format, therefore this manipulation saves the user an
  226. additional keystroke. 
  227. With the exception of the last two cases we want SCL to ignore any
  228. other key depression by substituting 'No_Op'. 
  229.  
  230.  
  231. New_Field
  232.  
  233. This procedure is called with two parameters, the field currently
  234. highlighted (due to be deselected) and the new field (the one about to
  235. be selected, i.e highlighted). This task is performed by the first two
  236. statements. Once this is done, 'current field' matches the new field
  237. now being highlighted. 
  238. In the same time frame three more fields need to be updated but instead
  239. of being processed here it is treated as a background task because
  240. another 'Arrow' key could also already be pressed. In this case
  241. priority is given to handle this key first before attempting to update
  242. any one of the three fields. 
  243. By making this task a background job we ensure that it is only done
  244. when spare time is available, without delaying any pending keyboard
  245. input. In order to notify the Background processing procedure that
  246. updates are to be carried out , three boolean flags are set, one for
  247. each field to be revised.
  248.  
  249.  
  250. Do_Work
  251.  
  252. This procedure first fetches the file name from the field currently
  253. highlighted. In case of a directory entry it changes the current
  254. directory accordingly. 
  255. If we are dealing with an executable file instead it first builds a
  256. string out of the filename (including path) and the parameter entry and
  257. then executes this file. Depending on whether it is an '.EXE' file or
  258. not, 'Execute' or 'ExecuteDos' is used. 
  259. The reason for this is that all '.BAT' and some of the '.COM' files
  260. (mainly some external DOS commands) require COMMAND.COM to be present
  261. while '.EXE' files can be started directly.  
  262. On return  from the previously executed program, a check for successful
  263. execution is done and if this is the case a prompt asks the user to
  264. press 'Return' to go back to the menu program (The reason for not going
  265. directly back is to give him a chance to read the screen content). In
  266. case of problems during execution we directly go back to the menu
  267. program and 'Tell_Result' displays an appropriate error message. 
  268.  
  269.  
  270.  
  271. Tell_Result
  272.  
  273. This procedure simply checks whether 'Execute' or 'ExecuteDos' caused a
  274. result code indicating an error.  If an error occurred the relevant
  275. (user defined) error message is displayed in field 50 and a 'beep' is
  276. initiated.
  277.  
  278.  
  279.  
  280. LP_Background_Task
  281.  
  282. This  is  assigned  as a SCL  background  Task  via  the
  283. 'LP_Background_Pointer:=@LP_Background_Task;' statement in the main
  284. body of the program.
  285. It is called by the SCL procedure 'Handle_Format' whenever there is no
  286. keyboard input pending and no other work needs to be done. This
  287. procedure is used here to update fields 46,47 and 49 after a different
  288. filename has been selected by the user. It is based on the simple
  289. principle that whenever the procedure is entered all three flags set by
  290. 'Next_Field' are checked. 
  291. If one of these flags is found to be TRUE the pertinent update
  292. procedure is performed and the flag is then set to FALSE. The update
  293. procedures themselves are clear and easy to understand and therefore
  294. not separately described here.
  295.  
  296.                                NOTICE
  297.  
  298.  
  299. This document and the information contained herein as well as the
  300. described software 'O A S I S' (Open Architecture Screen Interface
  301. System) are protected by international copyright law and treaty
  302. provisions. 
  303.  
  304.  
  305. Both this documentation and the program are provided strictly on an 'As
  306. Is' Basis.
  307.  
  308. There is no warranty, expressed or implied, with respect to the program
  309. or the documentation, including but not limited to merchantability and
  310. fitness for a particular purpose with respect to defects in the program
  311. or the documentation. In no event shall Eureka Software Associates be
  312. liable for any loss of profit or any other damage, including but not
  313. limited to special, incidental, consequential or other damages. 
  314.  
  315.  
  316.  
  317.                        Copyright (C) 1987, 1988
  318.                                    
  319.                       EUREKA SOFTWARE ASSOCIATES
  320.  
  321.              Martin Hossfeld                    Remy Fesnoux 
  322.              12, Pinewood Green                 2344 Yorkshire
  323.              Iver Heath, Bucks. SLO 0QP         Ann Arbor, MI 48104
  324.              United Kingdom                     USA
  325.  
  326.  
  327.                          All Rights Reserved.
  328.  
  329.  
  330.  
  331.                            Acknowledgements
  332.  
  333.  
  334. Turbo Pascal is a registered trademark of Borland International Inc.
  335.  
  336. SFD, SCL, Screen Format Designer, Screen Control Language and Open
  337. Architecture Screen Interface System are trademarks of EUREKA SOFTWARE
  338. ASSOCIATES.
  339.  
  340.                                                             
  341. SAMPLE4 is a copyrighted product provided to you under a shareware
  342. scheme. SAMPLE4 IS NOT PUBLIC DOMAIN. 
  343.  
  344.                            ┌────────────────────┐
  345.                            │ The Shareware Idea │
  346.                            └────────────────────┘
  347.  
  348. Shareware (sometimes  called  User supported  Software  or freeware)
  349. attempts to provide useful programs to the PC community at low cost by
  350. reducing the dependence on conventional marketing channels.
  351. Several software developers have proven that the concept works, to the
  352. mutual benefit of the independent program authors and the PC community
  353. itself.
  354. The user benefits by the availability of low cost software which he can
  355. evaluate on his own system before making the decision to purchase it. 
  356. The author benefits by being able to enter the software market without
  357. extensive monetary risks.  The user community determines which products
  358. succeed based on their true utility, rather than on their marketing
  359. achievements. Under this shareware scheme you are allowed and
  360. encouraged to copy and distribute the evaluation version of OASIS to
  361. your friends, colleagues and wherever you like as long as the following
  362. conditions are met:
  363.   
  364.   1.  You must distribute it unmodified and complete with all its
  365.       files. 
  366.   2.  You are not allowed to distribute it commercially for profit. You
  367.       may only charge for the media and handling.  
  368.