home *** CD-ROM | disk | FTP | other *** search
- { S_I_TPL.GEN }
-
- { *************************************************************************** }
- { * * }
- { * TURBO SCREEN INPUT PRE-PROCESSOR TOOLKIT * }
- { * * }
- { * SCROLLING INPUT COLUMN HEADING SCREEN TEMPLATE GENERATOR * }
- { * * }
- { * Version 1.07 * }
- { * * }
- { * * }
- { * This program provides a method of inputing the input column headings * }
- { * (or descriptors) for the scrolling input pages and storing them on a * }
- { * file so that they can be read and used by the scrolling input * }
- { * subprogram. * }
- { * * }
- { *************************************************************************** }
-
-
-
- Procedure FileGeneratorModule;
-
- { *************************************************************************** }
- { * * }
- { * SCREEN TEMPLATE GENERATOR MODULE * }
- { * * }
- { * This module reads the record entries out of a file, places the entries * }
- { * in an array, allows you to inspect the entries and change them if so * }
- { * desired, and then writes the record entries back to the file. * }
- { * * }
- { * This screen template generator is used to generate a template which * }
- { * stores the following information about each entry in its record: * }
- { * * }
- { * Prompt1 ( column prompt heading on row one ) * }
- { * Prompt2 ( column prompt heading on row two ) * }
- { * Prompt3 ( column prompt heading on row three ) * }
- { * InputDataType: * }
- { * * }
- { * 1 = Positive Integer * }
- { * 2 = Negative Integer * }
- { * 3 = Integer * }
- { * 4 = Positive Real * }
- { * 5 = Negative Real * }
- { * 6 = Real * }
- { * 7 = File Name Characters * }
- { * 8 = Disk Drive Subdirectory Path Characters * }
- { * 9 = General Characters * }
- { * * }
- { *************************************************************************** }
-
- {$V-}
-
- Const { Scrolling Input Page Constants }
-
- MAX_NUM_OF_S_I_PROMPT_COLS=7; { maximum number of column prompts in the scrolling window }
- { Usually this number is found to be MaxRightCol-MAX_LEFT_COL+1 }
-
- MAX_SIZE_OF_S_I_PROMPT=9; { maximum size of column prompt heading string entry }
-
- MAX_NUM_OF_S_I_PAGES=4; { number of scrolling input pages this particular }
- { implementation of the input pre-processor is }
- { required to support. }
-
- FILE_NAME='S_INPUT.TPL'; { scrolling window template file name }
-
-
-
- Type { Scrolling Input Page Data Structure }
-
- S_I_ColPrompts= { record type used for S_I column template used to }
- Record { store specific information about a particular column }
- Prompt1, { heading }
- Prompt2,
- Prompt3:String[MAX_SIZE_OF_S_I_PROMPT];
- InputDataType:Integer; { allowable input data type for a particular column }
- End; { S_I_PageRecord }
-
- S_I_Prompts= { S_I column prompt template used to store the column }
- Array[1..MAX_NUM_OF_S_I_PROMPT_COLS] of S_I_ColPrompts; { prompts for a particular S_I Page }
-
- Typical_S_I_Page= { an enumerated data type which stores }
- Record { for each general input page: }
- Prompts:S_I_Prompts; { a record of the column prompts for each page }
- End; { Typical_G_I_Page }
-
-
-
- Var { Scrolling Input Page Data Structure Variables }
-
- S_I_Pages:
- Array[1..MAX_NUM_OF_S_I_PAGES] Of Typical_S_I_Page; { an array constructed of the data type Typical }
- { scrolling input page }
-
- S_I_TemplateFile:File Of S_I_ColPrompts; { S_I_Page file template type }
-
- S_I_Page:Integer; { an index to the current S_I_Page }
-
- DescriptorCol:Integer; { an index to the current descriptor column }
-
- RecordOK:Char; { character variable used to determine the user's response }
-
-
-
- Procedure InitializeTemplateEntries;
-
- { This procedure initializes the entries in the template array of records.
- This procedure removes any garbage that might have been in the memory
- locations that the template array uses. }
-
- Var
- S_I_Page:Integer; { an index to the current S_I_Page }
- DescriptorCol:Integer; { an index to the current descriptor column }
-
- Begin { InitializeTemplateEntries }
- For S_I_Page:=1 To MAX_NUM_OF_S_I_PAGES Do
- For DescriptorCol:=1 To MAX_NUM_OF_S_I_PROMPT_COLS Do
- With S_I_Pages[S_I_Page].Prompts[DescriptorCol] Do
- Begin
- Prompt1:='';
- Prompt2:='';
- Prompt3:='';
- InputDataType:=0;
- End; { With S_I_Pages }
- End; { InitializeTemplateEntries }
-
-
-
- Procedure ReadFileEntries;
-
- { This procedure reads the entries out of the file named above and
- stores the entries into the proper array record. }
-
- Var
- S_I_Page:Integer; { an index to the current S_I_Page }
- DescriptorCol:Integer; { an index to the current descriptor column }
-
- Begin { ReadFileEntries }
- {$I-}
- Assign(S_I_TemplateFile,FILE_NAME); { assign to a disk file }
- Reset(S_I_TemplateFile); { open the file for reading }
- If IOResult=0 Then
- For S_I_Page:=1 To MAX_NUM_OF_S_I_PAGES Do
- For DescriptorCol:=1 To MAX_NUM_OF_S_I_PROMPT_COLS Do
- Read(S_I_TemplateFile,S_I_Pages[S_I_Page].Prompts[DescriptorCol]); { read record off of disk }
- Close(S_I_TemplateFile);
- {$I+}
- End; { ReadFileEntries }
-
-
-
- Procedure WriteFileEntries;
-
- { This procedure takes the entrys stored in the array records
- and writes them to the file named above. }
-
- Var
- S_I_Page:Integer; { an index to the current S_I_Page }
- DescriptorCol:Integer; { an index to the current descriptor column }
-
- Begin { WriteFileEntries }
- Assign(S_I_TemplateFile,FILE_NAME); { assign to a file on disk }
- Rewrite(S_I_TemplateFile); { open the file for writing, removes any previous entries }
- For S_I_Page:=1 To MAX_NUM_OF_S_I_PAGES Do
- For DescriptorCol:=1 To MAX_NUM_OF_S_I_PROMPT_COLS Do
- Write(S_I_TemplateFile,S_I_Pages[S_I_Page].Prompts[DescriptorCol]); { put the next record out }
- Close(S_I_TemplateFile);
- End; { WriteFileEntries }
-
-
-
- Procedure ShowTemplateRecord;
-
- { This procedure shows the operator the entries in the column prompts in the
- template array for the current record number. }
-
- Begin { ShowTemplateRecord }
- With S_I_Pages[S_I_Page].Prompts[DescriptorCol] Do
- Begin
- WriteLn('Array Column= ',DescriptorCol);
- WriteLn('S_I_Page= ',S_I_Page);
- WriteLn;
- WriteLn('Prompt1= ',Prompt1);
- WriteLn('Prompt2= ',Prompt2);
- WriteLn('Prompt3= ',Prompt3);
- WriteLn('InputDataType= ',InputDataType);
- End; { With Template[DescriptorCol,S_I_Page] }
- End; { ShowTemplateRecord }
-
-
-
- Procedure EnterTemplateRecord;
-
- { This procedure reads column prompt entries from the user and places them
- into the current template record. }
-
- Begin { EnterTemplateRecord }
- With S_I_Pages[S_I_Page].Prompts[DescriptorCol] Do
- Begin
- WriteLn('Array Column= ',DescriptorCol);
- WriteLn('S_I_Page= ',S_I_Page);
- WriteLn;
- Write('Prompt1= ? ');
- ReadLn(Prompt1);
- Write('Prompt2= ? ');
- ReadLn(Prompt2);
- Write('Prompt3= ? ');
- ReadLn(Prompt3);
- Write('InputDataType= ? ');
- ReadLn(InputDataType);
- End; { With Template[DescriptorCol,S_I_Page] }
- End; { EnterTemplateRecord }
-
-
-
- Begin { FileGeneratorModule }
- S_I_Page:=1;
- DescriptorCol:=1;
- InitializeTemplateEntries;
- ReadFileEntries;
- Repeat
- Repeat
- ClrScr;
- ShowTemplateRecord;
- WriteLn; Write('Are the above entries correct (Y or N) ?');
- ReadLn(RecordOK);
- If (RecordOK<>'Y') And (RecordOK<>'y') Then
- Begin
- ClrScr;
- EnterTemplateRecord;
- End { If (RecordOK<> }
- Else
- DescriptorCol:=DescriptorCol+1;
- Until DescriptorCol=MAX_NUM_OF_S_I_PROMPT_COLS+1;
- DescriptorCol:=1;
- S_I_Page:=S_I_Page+1;
- Until S_I_Page=MAX_NUM_OF_S_I_PAGES+1;
- WriteFileEntries;
- End; { FileGeneratorModule }
-
-
-
- Begin { Main Program }
- FileGeneratorModule;
- End. { Main Program }