home *** CD-ROM | disk | FTP | other *** search
-
-
- Page 20
-
-
-
-
- X. CHILD PROGRAM EXECUTION
-
-
- The include subprogram file "Execute.Inc" contains routines that allow you to
- run other programs directly from Turbo Pascal, get the return codes when those
- programs terminate, and be able to temporarily exit your Turbo program to issue
- DOS commands.
-
- You could, for example, use these routines within this include file to execute
- a child program, perhaps written in Fortran. The user would be totally unaware
- that control had been passed to a different program. Once the child program
- terminates, control would then be passed back to the parent program,
- specifically to the next line of Pascal code. Thus one could write a Turbo
- Pascal shell program to execute other programs, thereby preventing the user
- from having to deal with DOS.
-
- The Exec calls in "Execute.Inc" (SubProcess, SubProcessViaCOMMAND, ShellToDOS,
- ExecuteChildProgram) will not work unless you restrict Turbo's allocated heap.
- To do this, lower "mAximum dynamic free memory" on the compiler Options menu to
- a reasonable value. What a reasonable value is depends on your program's use
- of the heap and the stack, and must be determined by you. The value 1000 (64k)
- is a fairly good value to start off with for a large program like the input
- pre-processor. Then try reducing, if possible, that value as your program
- development nears completion.
-
- The Exec calls CANNOT be called from within the interactive Turbo compiler
- system. They can only be called from .COM or .CHN files running outside of the
- Turbo environment.
-
-
-
-
- XI. DESCRIPTION OF SCREEN TEMPLATES
-
-
- The screen templates are the key to the versatility of this the pre-processor.
- It is by altering these templates you then alter how the screen pages will
- appear to the user. For example, you may have four different application core
- programs you have written and each program requires a unique set of inputs from
- the user. All you do is alter the screen templates for each of the four
- programs with the proper screen template generators, while using the same input
- pre-processor subprograms to control the interaction between the user and the
- four application programs.
-
-
-
- Page 21
-
-
-
-
- A screen template is simply a file containing information about the prompts
- (or descriptors) to be displayed when a particular screen page is shown.
- The screen template file is a series of records where each record describes one
- descriptor (or prompt).
-
- Thus the input pre-processor then uses these screen templates, for example, to
- determine which descriptor to highlight when the user curses downward. The
- pre-processor also uses the screen template to determine what character types
- are allowed for a particular entry. And by simply altering the prompt locators
- you redefine where a particular prompt is to be located on the screen.
-
- There are three template form sheets included in this toolkit. They are
- "G_I_Tpl.Frm", "Menu_Tpl.Frm", and "S_I_Tpl.Frm". These forms will aid you in
- designing and filling out your screen templates. I recommend that you set
- your printer to print in compressed mode before printing out these forms since
- they are 125 columns wide. Then fill out the template forms according to the
- directions included with each of forms.
-
-
- A. GENERAL INPUT SCREEN TEMPLATE
-
- Below is an example general input screen template record.
-
-
- EXAMPLE GENERAL INPUT SCREEN TEMPLATE RECORD
-
- /
- |-------|-------|-------|-------|-------|-------|-------|-------|-------|/
- |Record |Prompt |Prompt |Input |Input |Input |Input |Return |Up /
- |Number |Column |Row |Column |Row |Length |Data |Key |Key /
- | | | | | | |Type |Pointer|Point/
- |-------|-------|-------|-------|-------|-------|-------|-------|----/
- | 17 | 5 | 19 | 32 | 19 | 5 | 4 | 18 | /
- |-------|-------|-------|-------|-------|-------|-------|-------|--/
- /
-
- /
- /-|-------|-------|-------|-------|------------------------------|
- / |Up |Down |Left |Right |Prompt |
- / |Key |Key |Key |Key | |
- /nter|Pointer|Pointer|Pointer|Pointer| |
- /-----|-------|-------|-------|-------|------------------------------|
- / | 15 | 19 | 0 | 18 |Beam Spacing (ft) |
- /-------|-------|-------|-------|-------|------------------------------|
- /
-
-
-
- Page 22
-
-
-
-
- Description of the previous general input template record fields:
-
-
- Record Number
- -------------
- Record Number is not an actual field in the template file, but is
- present in the previous example screen template record to help you
- see that we are looking at record 17.
-
-
- Prompt Column and Prompt Row
- ----------------------------
- Prompt Column and Prompt Row describe the X,Y location on the screen
- where the prompt "Beam Spacing (ft)" will be displayed (note that the
- screen is 80 columns wide and 25 rows high, the upper left corner of
- the screen is column 1, row 1 ). For the previous example screen
- template record the general input page subprogram will display the
- prompt "Beam Spacing (ft)" at column 5, row 19.
-
-
- Input Column and Input Row
- --------------------------
- Input Column and Input Row describes the X,Y location on the screen
- of the start of the reverse video input block. The reverse video
- input block is where the user enters his input onto the screen. For
- the previous example screen template record the general input page
- subprogram will display the reverse video input block starting at
- column 32, row 19.
-
-
- Input Length
- ------------
- Input Length describes how long the reverse video input block is
- (number of columns long). The general input page subprogram makes
- certain that the user's data entry length does not exceed this
- maximum allowed length as the data entry is entered. For the
- previous example screen template record the reverse video input block
- is five characters long.
-
-
-
- Page 23
-
-
-
-
- Input Data Type
- ---------------
- Input Data Type is used to define what type of characters the user is
- allowed to enter for a particular entry. The general input
- subprogram then checks as the user enters characters from the
- keyboard that the characters are of the type allowed. For example,
- if only a positive integer is allowed, only that data type will be
- allowed to be entered from the keyboard. All other characters will
- be discarded with an error sounded also. A list of different input
- data types that the general input subprogram can check for
- follows:
-
-
- Input
- Data
- Type
- Value Description of Input Data Type
- ----- -------------------------------------------
- 1 Positive Integer ( including zero )
- 2 Negative Integer ( including zero )
- 3 Integer
- 4 Positive Real ( including zero )
- 5 Negative Real ( including zero )
- 6 Real
- 7 Data File Name Characters
- 8 Disk Drive and Subdirectory Path Characters
- 9 General Characters
-
-
- Return Key Pointer
- ------------------
- Return Key Pointer identifies for the general input page subprogram
- the record of the prompt to be highlighted when the user enters a
- carriage return while at this prompt. In the previous example screen
- template record, when the user is at the highlighted prompt "Beam
- Spacing (ft)" and the user enters a carriage return, the prompt of
- record 18 would then be highlighted. The previous prompt "Beam
- Spacing (ft)" would return to a non-highlighted color. Thus the
- highlighted prompt is used to inform the user at what prompt he is
- at.
-
-
-
- Page 24
-
-
-
-
- Up Key Pointer, Down Key Pointer, Left Key Pointer, and Right Key Pointer
- -------------------------------------------------------------------------
- Up Key Pointer, Down Key Pointer, Left Key Pointer, and Right Key
- Pointer identify for the general input page subprogram the particular
- record of a prompt to be highlighted when the user enters that
- particular keystroke while at this prompt. Note that a zero in a
- direction field indicates that a particular keystroke is not allowed.
- In the previous example, when the user is at that prompt "Beam
- Spacing (ft)" he cannot curse to the left. The general input page
- subprogram will ignore this keystroke and sound an error.
-
-
- Prompt
- ------
- Prompt is a string field in which the particular prompt is stored.
- What is entered in this field will be what the general input page
- subprogram will display at Prompt Column, Prompt Row.
-
-
- B. MENU SCREEN TEMPLATE RECORDS
-
- A similar screen template to that of the general input screens are used for
- each menu screen. The menu subprogram then abides by the menu templates you
- define in controlling the display and handling of the menus. The following
- record fields are contained in the menu screen template:
-
-
- Prompt Column
- Prompt Row
- Return Key Pointer
- Up Key Pointer
- Down Key Pointer
- Left Key Pointer
- Right Key Pointer
- Prompt
-
-
-
- Page 25
-
-
-
-
- C. SCROLLING INPUT COLUMN HEADING TEMPLATES
-
- The scrolling input screens use a very simplified template. Basically, only
- the column heading descriptors (or prompts) are stored in the screen template,
- along with the particular input data type allowed for each column. The input
- pre-processor is setup to display only three rows of text for each column
- descriptor.
-
- Below is an example of four scrolling input screens with their column headings
- similar to that used in the example application of the input pre-processor.
- Notice each column heading has only three rows of text, and each column field
- width is 9 columns.
-
-
- EXAMPLE SCROLLING INPUT COLUMN HEADING TEMPLATE RECORD
-
-
- |-----------|---------|---------|---------|---------|---------|---------|
- | |Column 1 |Column 2 |Column 3 |Column 4 |Column 5 |Column 6 |
- |-----------|=========|=========|=========|=========|=========|=========|
- |S_I_Page1 || | | | | | |
- |Prompt 1 ||Load |X1 |Load |X2 |Load | |
- |Prompt 2 ||Number |Position | |Position |Width | |
- |Prompt 3 || |(ft) |(kip/ft) |(ft) |(ft) | |
- |Data Type || |4 |4 |4 |4 | |
- |----------||---------|---------|---------|---------|---------|---------|
- |S_I_Page2 || | | | | | |
- |Prompt 1 ||Load |X |Load | | | |
- |Prompt 2 ||Number |Position |at X | | | |
- |Prompt 3 || |(ft) |(kip) | | | |
- |Data Type || |4 |4 | | | |
- |----------||---------|---------|---------|---------|---------|---------|
- |S_I_Page3 || | | | | | |
- |Prompt 1 ||Load |X1 |Load |X2 |Load |Load |
- |Prompt 2 ||Number |Position |at X1 |Position |at X2 |Width |
- |Prompt 3 || |(ft) |(kip/ft) |(ft) |(kip/ft) |(ft) |
- |Data Type || |4 |4 |4 |4 |4 |
- |----------||---------|---------|---------|---------|---------|---------|
- |S_I_Page4 || | | | | | |
- |Prompt 1 ||Load |X |Applied | | | |
- |Prompt 2 ||Number |Position |Moment | | | |
- |Prompt 3 || |(ft) |(ft-kip) | | | |
- |Data Type || |4 |4 | | | |
- |----------||---------|---------|---------|---------|---------|---------|
-
-
-
- Page 26
-
-
-
-
- Observe that some of the scrolling input screens have less column headings (and
- less columns) than others. Those particular column headings were simply left
- blank when the scrolling input screen template was defined by the scrolling
- input column heading template generator.
-
- Below is a list of data types that the scrolling input subprogram can check
- for.
-
-
- Input
- Data
- Type
- Value Description of Input Data Type
- ----- -------------------------------------------
- 1 Positive Integer ( including zero )
- 2 Negative Integer ( including zero )
- 3 Integer
- 4 Positive Real ( including zero )
- 5 Negative Real ( including zero )
- 6 Real
- 7 Data File Name Characters
- 8 Disk Drive and Subdirectory Path Characters
- 9 General Characters
-
-
-
-
- XII. SCREEN TEMPLATE GENERATORS
-
-
- Before using the template generators, print out the template form sheets that
- you require. They are "G_I_Tpl.Frm", "Menu_Tpl.Frm", and "S_I_Tpl.Frm". I
- recommend that you set your printer to print in compressed mode since these
- forms are 125 columns wide. Then fill out the template forms according to the
- directions included with the forms.
-
- There are three template generators associated with this toolkit. Below is
- a list of the generator names and the templates they generate.
-
-
- Template
- Generator Template Generated
- ------------ ----------------------------------------
- G_I_Tpl.Gen General Input Screen Templates
- Menu_Tpl.Gen Menu Screen Templates
- S_I_Tpl.Gen Scrolling Input Column Heading Templates
-
-
-
- Page 27
-
-
-
-
- The template generators are used in entering the parameters and descriptors (or
- prompts) into template files for the various subprograms to use.
-
- For example, the general input screen template generator "G_I_Tpl.Gen" provides
- a method of entering the input prompt parameters for the general input screen
- template storing them in a template file so that it can be read and used by the
- general input page subprogram.
-
- The template generators are rather crude programs when you actually get around
- to using them. They must be "hard-wired" by you for them to work in generating
- the proper screen templates for your application. I never bothered to make
- them any easier to use since they are generally only used once or twice during
- actual template development. Perhaps someday I will use the input pre-
- processor toolkit to make the template generators more user friendly. Then it
- will be sort of like who came first--the chicken or the egg!
-
- When using the template generators you will have to "hard-wire" the following
- constants to make the template generators work for your application:
-
-
- G_I_Tpl.Gen -- General Input Screen Template Generator
- ------------------------------------------------------
-
- TEMPLATE_RECORD_LIMIT -- The number of records in the new screen
- template.
- TEMPLATE_FILE_NAME -- The name of the file you want the screen
- template to be written to.
-
-
- Menu_Tpl.Gen -- Menu Screen Template Generator
- ----------------------------------------------
-
- MENU_RECORD_LIMIT -- The number of records in the new screen
- template.
- MENU_FILE_NAME -- The name of the file you want the screen
- template to be written to.
-
-
-
- Page 28
-
-
-
-
- S_I_Tpl.Gen -- Scrolling Input Column Heading Template Generator
- ----------------------------------------------------------------
-
- MAX_NUM_OF_S_I_PROMPT_COLS -- The maximum number of column headings
- on any particular scrolling input
- page.
- MAX_NUM_OF_S_I_PAGES -- The number of scrolling input pages
- you want included in the scrolling
- input column heading template you are
- generating.
- FILE_NAME -- The name of the file you want the screen
- template to be written to.
-
-
- Both "G_I_Tpl.Gen" and "Menu_Tpl.Gen" generate one screen template file at a
- time. Thus each screen template is for only one physical screen page.
- "S_I_Tpl.Gen" also generates only one template file at a time, but the template
- it generates supports as many physical scrolling input pages that you want your
- particular application program to have.
-
-
-
-
- XIII. PRE-PROCESSOR ALTERATIONS
-
-
- I have listed below the changes that you may need to make to your particular
- application of the input pre-processor.
-
-
- A. DISPLAY SUBPROGRAM "Display.Inc"
-
- This subprogram is linked with scrolling input subprogram. If you are
- not using the scrolling input subprogram, then you do not need this
- display subprogram.
-
- If you plan on using the scrolling input subprogram and this subprogram,
- you will have to tailor this display subprogram for your particular
- application. You may perhaps want to display a graph, bar chart, etc.
- as the user is entering his data into the scrolling input pages.
-
-
-
- Page 29
-
-
-
-
- B. ERROR CHECKING SUBPROGRAM "Error.Inc"
-
- You may need to alter the following procedures for your particular
- implementation of the pre-processor:
-
- G_I_ErrorCheckingModule
- S_I_ErrorCheckingModule
-
-
- C. EXECUTE SUBPROGRAM "Execute.Inc"
-
- No changes required.
-
- You will need to lower the maximum free dynamic memory at compile time
- for routines to work. See section describing executing child programs
- for more information.
-
-
- D. FILE I/O SUBPROGRAM "File.Inc"
-
- You may need to alter the following procedures for your particular
- implementation of the pre-processor:
-
- ReadInputDataFile
- WriteInputDataFile
-
-
- E. GENERAL INPUT SUBPROGRAM "G_Input.Inc"
-
- You may need to alter the following procedures for your particular
- implementation of the pre-processor:
-
- HighlightSpecial_G_I_Prompts
- Draw_G_I_PagesModule
- Special_G_I_CharEntryModule
- Escape
- PageUp
- PageDown
- ReadKeyboard
-
-
-
- Page 30
-
-
-
-
- F. INITIALIZATION SUBPROGRAM "Init.Inc"
-
- No changes needed.
-
- You will need to remove some of the initialization procedure calls in
- the procedure InitModule if you are not using all of the toolkit's
- subprograms.
-
-
- G. MAIN SUBPROGRAM "Tsipp.Pas"
-
- You may need to alter the following constants for your particular
- implementation of the pre-processor:
-
- MAX_NUM_OF_G_I_PAGES -- The number of general input pages (or
- templates) your particular application
- has.
-
- MAX_NUM_OF_MENU_PAGES -- The number of menu pages (or templates)
- your particular application has.
-
- MAX_NUM_OF_S_I_PAGES -- The number of scrolling input pages
- your particular application has.
-
- MAX_NUM_OF_TEXT_SCREENS -- The number of temporary text screens
- that you want to store in the heap, as
- when temporarily displaying a help
- message. Increase this if you want more
- screen images to be stored in the heap.
- Allows you to pop windows on to and off
- of each other.
-
- INPUT_FILE_NAME_EXTENSION -- Three character extension to the input
- data file names. This allows more than
- one application of the pre-processor to
- exist in the same directory, without
- confusing input data files between the
- two pre-processors.
-
- TEMPLATE_FILE_NAME_EXTENSION -- Three character extension to the
- template file names. This allows more
- than one application of the pre-
- processor to exist in the same
- directory, without confusing template
- files between the two pre-processors.
-
-
- You may need to alter the following procedure for your particular
- implementation of the pre-processor:
-
- ProgramPageControl
-
-
-
- Page 31
-
-
-
-
- H. MENU SUBPROGRAM "Menu.Inc"
-
- You may need to alter the following procedures for your particular
- implementation of the pre-processor:
-
- DrawMenuPagesModule
- Escape
- PageUp
- PageDown
- ProgramControl
- MenuControl
-
-
- I. SCREEN SUBPROGRAM "Screen.Inc"
-
- No changes required
-
-
- J. SCROLLING INPUT SUBPROGRAMS "S_Input1.Inc" & "S_Input2.Inc"
-
- You may need to alter the following constants for your particular
- implementation of the pre-processor:
-
- S_I_ENTRY_LIMIT -- The maximum number of input data rows
- that can be accessed in the scrolling
- window. Note that this is not the
- number of data rows displayed in the
- scroll window at one time.
-
- TOP_EDGE_OF_OUTER_SCROLL_WINDOW -- Top physical screen row of the outer
- window used in scrolling input data up,
- down, left, and right. This value can
- range from 1 to 24. This is the actual
- top row (or edge) of the scroll window.
-
- BOTTOM_EDGE_OF_OUTER_SCROLL_WINDOW -- Bottom physical screen row of the
- outer window used in scrolling input
- data up, down, left, and right. This
- value can range from 2 to 25. This is
- the actual bottom edge (or row) of the
- scroll window.
-
- LEFT_EDGE_OF_OUTER_SCROLL_WINDOW -- Left physical screen row of the outer
- window used in scrolling input data up,
- down, left, and right. This is the
- actual left edge (or column) of the
- scroll window.
-
-
-
- Page 32
-
-
-
-
- TOP_EDGE_OF_INNER_SCROLL_WINDOW -- Top physical screen row of the inner
- window used in scrolling input data up,
- down, left, and right. This value can
- range from 1 to 24. This is the actual
- top row that the input data is displayed
- in.
-
- BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW -- Bottom physical screen row of the
- inner window used in scrolling input
- data up, down, left, and right. This
- value can range from 2 to 25. This is
- the actual bottom row that the input
- data is displayed in.
-
- LEFT_EDGE_OF_INNER_SCROLL_WINDOW -- Left physical screen row of the inner
- window used in scrolling input data up,
- down, left, and right. This is the
- actual leftmost column that the input
- data is displayed in.
-
- MAX_LEFT_COL -- Leftmost input data column that the
- scrolling window can access and display.
- This value is normally 1.
-
- MAX_NUM_OF_S_I_PROMPT_COLS -- Maximum number of column prompts (or
- headings) in the scrolling window.
- Usually this number is found to be
- MaxRightCol-MAX_LEFT_COL+1.
-
- MAX_NUM_OF_S_I_DATA_COLS -- Maximum number of columns in the input
- data array. Usually this number is
- found to be MaxRightCol-MAX_LEFT_COL,
- or one less than
- MAX_NUM_OF_S_I_PROMPT_COL since the
- first column of the scroll window is
- usually an index column.
-
- You may need to alter the following procedures for your particular
- implementation of the pre-processor:
-
- RightEdgeOfOuterScrollWindow
- RightEdgeOfInnerScrollWindow
- MaxRightCol
- HighlightSpecial_S_I_Prompts
- Draw_S_I_PagesModule
- Special_S_I_CharEntryModule
- Escape
- PageUp
- PageDown
-
-
-
- Page 33
-
-
-
-
- XIV. MISCELLANEOUS NOTES
-
-
- All data entered by the user is stored as strings. This allows entries to be
- easily manipulated by the user and the pre-processor, also allowing the data to
- be easily error checked as it is entered.
-
- The input pre-processor is designed so that the user can store his input data
- in a work file so that he can later return to it and alter it. You may or may
- not want to include this feature.
-
- Screen pages are read from screen page files and are stored in the heap until
- they need to be displayed. This method of displaying screens provides very
- rapid screen display for a particular input page, making your application
- program appear very professional. A video retrace check is included in all
- rapid screen routines to prevent colored snow from appearing on standard color
- monitors.
-
- The user is not allowed to specify the input data file name extension. This
- was done to simplify the file I/O routines for the user. That way the user
- does not have to guess what files are input files since the program will only
- recognize those data files with the proper extension. The pre-processor will
- only read, write, or display input data files with the same file name
- extension.
-
-
-
-
- XV. FINAL NOTES
-
-
- Much more documentation can be found in the specific subprogram files.
-
- I hope that you find this input pre-processor toolkit of use for your
- program(s). I welcome any comments and/or improvements that you can make in
- regard to this toolkit.
-
- Happy programming!!