home *** CD-ROM | disk | FTP | other *** search
- ┌─────────────────────────────────────────┐
- │ SAMPLE4 (OASIS Automatic Disk Menu) │
- │ EUREKA SOFTWARE ASSOCIATES │
- └─────────────────────────────────────────┘
-
-
- ┌──────────────┐
- │ INTRODUCTION │
- └──────────────┘
-
- SAMPLE4 is an automatic Disk menu program written in Turbo Pascal using
- Open Architecture Screen Interface System (OASIS), a powerfull but easy
- to use development tool including a screen generator. For more on OASIS
- check the README.OAS file.
-
-
-
-
- ┌──────────────┐
- │ DESCRIPTION │
- └──────────────┘
-
- This example program is quite a useful DOS utility program.
- With SAMPLE4 any program can be executed directly from the menu just by
- pointing to it. It can also let you wander across all subdirectories on
- your disk. It consists of the following files:
-
- SAMPLE4.SCS : The format file, containing a single format.
- SAMPLE4.SCI : The index file to above.
- SAMPLE4.MSG : Contains all Field Messages.
- SAMPLE4.PAS : The Turbo Pascal source program.
- SAMPLE4.EXE : Compiled version of SAMPLE1.PAS.
- SAMPLE4.ERR : Error message file (not used here)
-
- To get started load the above files on you hard disk using DOS copy
- utility, then type sample4.
-
-
-
-
-
- ┌──────────────────┐
- │ TECHNICAL NOTES │
- └──────────────────┘
-
- If you are a programmer, novice or expert the following is for you. For
- a better understanding you are encouraged to consult the README.OAS
- file and print the SAMPLE4.PAS source file, it's only a few pages long.
- OASIS 5.0 is also available as a shareware called OASP5E.ARC. (Turbo
- Pascal 5.0 level).
-
-
-
-
- GENERAL STRUCTURE OF PROGRAMS WRIITEN USING OASIS
-
- Compiler Option '$V-'
-
- This option is required in any SCL program. More details about compiler
- options can be found in your 'TURBO PASCAL' manual. Without this
- compiler option specified SCL programs won't compile.
-
- USES Statement
-
- "USES SCL;" makes SCL accessible from within this program.
-
-
- Main Program
-
- The first statement is Select_Format_File('Sample4');. This procedure
- initializes SCL and all required files.
- 'Select_Format_File' is the first SCL statement to be executed and it
- appears only once in any program.
-
- Close_Formats; is the last SCL statement. It closes all files and frees
- the memory space previously used by SCL.
- Between these two statements, the procedure which processes the format
- in this program, Handle_first, is called.
-
-
- Format Handling
-
- The procedure 'Menu' performs the complete handling of our screen
- format.
- The first statement, 'Select_Format('amenu');' loads our format (with
- the name 'amenu') from the format file into the format stack in memory.
- 'Display_Format(X_Max DIV 2,Y_Max DIV 2);' will center it on the
- screen.
-
- Then follows the actual format handling loop:
-
- REPEAT
- Handle_Format;
- ......
- ......
- UNTIL Format_Done;
-
- The same Loop is used to process any format in SCL. The procedure
- Handle_Format is exited when any of the following occurs:
-
- * Before a new field on the format is initialized (=entered)
- * Before a field is left
- * Before the format is left (if it is finished)
-
- * and, optionally, depending on the format specifications, if a
- User Function Key has been pressed.
-
- The boolean function 'Format_Done' returns FALSE as long as the format
- has not been finished.
- The format is considered to be finished if any one of the following
- conditions occurs:
-
- * All mandatory fields are filled in and either 'Escape' was hit
- or 'Return' was pressed while being in the last field.
-
- * The 'Abort' key (F10) is pressed.
-
-
- Apart from reading and writing fields and, the format handling loop is
- always the same, independent of the number and type of fields on a
- format. In fact, the above loop can fulfill the handling of any SCL
- screen format. There is no need to define any logic for Help screens,
- Display of messages, Input error handling, field check and so on. All
- this is performed automatically by SCL as part of the Format
- Specifications which can be modified anytime via SFD.
-
-
-
- SPECIFIC ATTRIBUTES FOR SAMPLE4
-
- Despite (and maybe especially because of) the fact, that SCL has
- certainly not been designed to develop DOS utilities, this example
- demonstrates and highlights its tremendous power and flexibility.
-
- The main new features exhibited in this program are:
-
- - The 'Execute' and , 'ExecuteDos' routines.
- - Background processing.
- - More sophisticated User Interrupt Procedures.
-
-
- This program only uses one Format (screen) and the procedure handling
- this format is called 'Menu'.
- The procedures involved in this task are 'Init_Dir_Search',
- 'Display_Files' and 'Tell_Result'.
- Apart from this, within the actual Format handling loop, you find a
- statement which invokes a User Interrupt Procedure ('Handle_Key') in
- case a User Function Key has been pressed. If the format has been
- finished (and was not aborted), the procedure 'Do_Work' is executed.
-
-
-
- The relevant components of the program will be discussed in the
- following.
-
-
- Init_Dir_Search
-
- This procedure initializes the parameters for our Directory search. It
- sets the boolean variable 'First' to TRUE and the search mask to '*.*'
- (all files).
-
- Note: 'First' is a parameter for the directory search which if TRUE,
- causes it to initialize a new search, i.e to find the first filename
- matching the specified mask. Once the first file has been found, it is
- set to false and subsequent searches will search for the remaining
- files.
-
-
-
- Display_Files
-
- The first part of this procedure is a REPEAT..UNTIL loop which calls
- 'Dir'. If 'Dir' returns a result of 0 (zero), meaning that a filename
- matching the mask was found, the procedure 'Pick_it_if_we_need_it' is
- called, which determines whether this file is either an executable file
- or a directory entry. If this is the case, the file name is moved to
- the first available field and the field count is increased by 1. In
- order to determine whether the file found should be displayed on the
- format, we access the SCL variable 'Dta'
- We exit the REPEAT..UNTIL loop under any one of the following two
- conditions: either the format is full or there are no more files
- matching the mask. In the latter case we reinitialize 'Dir' by calling
- 'Init_Dir_Search' again and we also blank the remaining fields on the
- format. In every case, we also make a note of the highest field on our
- format containing a filename entry.
- Now that's where the real tricky part starts:
- On this format we want to have two active fields at the same time, one
- being the field containing the filename to be executed and the other
- one where the optional parameters can be entered. SCL can only have one
- active field at a time, therefore we have to cheat somehow.
- One way to achieve this is to declare all the fields holding filenames
- (2 to 46) as 'Output' fields and manipulate these fields independent
- from the normal SCL field processing. This just leaves, what SCL
- concerns, field 49 as the only cursor accessible field on this format
- which is consequently active, i.e ready for input, anytime the format
- is displayed. In order to highlight the currently chosen filename
- field, we use the 'selected' field attribute. The procedure
- 'Handle_Keys', which monitors the 'arrow' keys, determines which
- filename is to be highlighted next and the highlighting itself is
- performed by the procedure 'New_Field'.
-
-
- Handle_Keys
-
- This procedure acts on all User Function Keys defined for this format.
- In case F9 is pressed, the field holding the currently highlighted
- filename is deselected and 'Display_files' is called to refill the
- format.
- In case the display of the current directory is not yet complete,
- ('first' is FALSE) the remaining entries are searched to be displayed
- now, otherwise a new search cycle is initiated to display the first
- page of file names. In case, one of the 'arrows' or 'Home' or 'End' is
- pressed we determine the next field (file name) to be highlighted and
- call 'Next_Field' to do it.
-
- The next two keys are only intercepted for user convenience: If
- 'Escape' is pressed, it is replaced by 'F10' (Abort) which subsequently
- causes the program to be terminated.
- If 'Return' is pressed and the parameter field (49) contains spaces
- this key is replaced by an 'Escape' character, which causes the format
- to be terminated instantly. The reason for this is that SCL would
- interpret 'Return' in this case as a command to switch field 49 to
- 'Edit Mode' and we would have to press 'Return' (or 'Escape') again to
- finish the format, therefore this manipulation saves the user an
- additional keystroke.
- With the exception of the last two cases we want SCL to ignore any
- other key depression by substituting 'No_Op'.
-
-
- New_Field
-
- This procedure is called with two parameters, the field currently
- highlighted (due to be deselected) and the new field (the one about to
- be selected, i.e highlighted). This task is performed by the first two
- statements. Once this is done, 'current field' matches the new field
- now being highlighted.
- In the same time frame three more fields need to be updated but instead
- of being processed here it is treated as a background task because
- another 'Arrow' key could also already be pressed. In this case
- priority is given to handle this key first before attempting to update
- any one of the three fields.
- By making this task a background job we ensure that it is only done
- when spare time is available, without delaying any pending keyboard
- input. In order to notify the Background processing procedure that
- updates are to be carried out , three boolean flags are set, one for
- each field to be revised.
-
-
- Do_Work
-
- This procedure first fetches the file name from the field currently
- highlighted. In case of a directory entry it changes the current
- directory accordingly.
- If we are dealing with an executable file instead it first builds a
- string out of the filename (including path) and the parameter entry and
- then executes this file. Depending on whether it is an '.EXE' file or
- not, 'Execute' or 'ExecuteDos' is used.
- The reason for this is that all '.BAT' and some of the '.COM' files
- (mainly some external DOS commands) require COMMAND.COM to be present
- while '.EXE' files can be started directly.
- On return from the previously executed program, a check for successful
- execution is done and if this is the case a prompt asks the user to
- press 'Return' to go back to the menu program (The reason for not going
- directly back is to give him a chance to read the screen content). In
- case of problems during execution we directly go back to the menu
- program and 'Tell_Result' displays an appropriate error message.
-
-
-
- Tell_Result
-
- This procedure simply checks whether 'Execute' or 'ExecuteDos' caused a
- result code indicating an error. If an error occurred the relevant
- (user defined) error message is displayed in field 50 and a 'beep' is
- initiated.
-
-
-
- LP_Background_Task
-
- This is assigned as a SCL background Task via the
- 'LP_Background_Pointer:=@LP_Background_Task;' statement in the main
- body of the program.
- It is called by the SCL procedure 'Handle_Format' whenever there is no
- keyboard input pending and no other work needs to be done. This
- procedure is used here to update fields 46,47 and 49 after a different
- filename has been selected by the user. It is based on the simple
- principle that whenever the procedure is entered all three flags set by
- 'Next_Field' are checked.
- If one of these flags is found to be TRUE the pertinent update
- procedure is performed and the flag is then set to FALSE. The update
- procedures themselves are clear and easy to understand and therefore
- not separately described here.
-
- NOTICE
-
-
- This document and the information contained herein as well as the
- described software 'O A S I S' (Open Architecture Screen Interface
- System) are protected by international copyright law and treaty
- provisions.
-
-
- Both this documentation and the program are provided strictly on an 'As
- Is' Basis.
-
- There is no warranty, expressed or implied, with respect to the program
- or the documentation, including but not limited to merchantability and
- fitness for a particular purpose with respect to defects in the program
- or the documentation. In no event shall Eureka Software Associates be
- liable for any loss of profit or any other damage, including but not
- limited to special, incidental, consequential or other damages.
-
-
-
- Copyright (C) 1987, 1988
-
- EUREKA SOFTWARE ASSOCIATES
-
- Martin Hossfeld Remy Fesnoux
- 12, Pinewood Green 2344 Yorkshire
- Iver Heath, Bucks. SLO 0QP Ann Arbor, MI 48104
- United Kingdom USA
-
-
- All Rights Reserved.
-
-
-
- Acknowledgements
-
-
- Turbo Pascal is a registered trademark of Borland International Inc.
-
- SFD, SCL, Screen Format Designer, Screen Control Language and Open
- Architecture Screen Interface System are trademarks of EUREKA SOFTWARE
- ASSOCIATES.
-
-
- SAMPLE4 is a copyrighted product provided to you under a shareware
- scheme. SAMPLE4 IS NOT PUBLIC DOMAIN.
-
- ┌────────────────────┐
- │ The Shareware Idea │
- └────────────────────┘
-
- Shareware (sometimes called User supported Software or freeware)
- attempts to provide useful programs to the PC community at low cost by
- reducing the dependence on conventional marketing channels.
- Several software developers have proven that the concept works, to the
- mutual benefit of the independent program authors and the PC community
- itself.
- The user benefits by the availability of low cost software which he can
- evaluate on his own system before making the decision to purchase it.
- The author benefits by being able to enter the software market without
- extensive monetary risks. The user community determines which products
- succeed based on their true utility, rather than on their marketing
- achievements. Under this shareware scheme you are allowed and
- encouraged to copy and distribute the evaluation version of OASIS to
- your friends, colleagues and wherever you like as long as the following
- conditions are met:
-
- 1. You must distribute it unmodified and complete with all its
- files.
- 2. You are not allowed to distribute it commercially for profit. You
- may only charge for the media and handling.