home *** CD-ROM | disk | FTP | other *** search
- { ERROR.INC }
-
- { *************************************************************************** }
- { * * }
- { * TURBO SCREEN INPUT PRE-PROCESSOR TOOLKIT * }
- { * * }
- { * ERROR CHECKING SUBPROGRAM INCLUDE FILE * }
- { * * }
- { * Version 1.07 * }
- { * * }
- { * * }
- { * This subprogram contains two modules which are used in checking * }
- { * specific user data input. * }
- { * * }
- { *************************************************************************** }
-
-
-
- Procedure G_I_ErrorCheckingModule;{(Var OldPrompt,
- NewPrompt:Integer;
- Var DataEntry:Workstring);}
-
- { *************************************************************************** }
- { * * }
- { * GENERAL INPUT PAGE ERROR CHECKING MODULE * }
- { * * }
- { * This module controls the checking of user data input for the * }
- { * general input pages. * }
- { * * }
- { * Note that the procedures within this module have been written * }
- { * specifically for the example application of the input pre-processor. * }
- { * You may want to write similar procedures for your application. * }
- { * * }
- { *************************************************************************** }
-
-
-
- Procedure DisplayErrorMessage( ScreenRow :Integer;
- ErrorMessage:WorkString);
-
- { This procedure displays the passed error message describing the illegal
- general input page data entry that the user has inputed at the passed
- screen row location. }
-
- Begin { DisplayErrorMessage }
- StoreTextScreen(1); { take a snapshot of the screen }
- TextColor(ForegroundColor);
- TextBackground(BackgroundColor);
- SoundAttention;
- ZoomWindow1(4,ScreenRow-1,77,ScreenRow+1); { display error message }
- TextColor(HighlightColor);
- WriteCenterText(ScreenRow,ErrorMessage);
- TextColor(ForegroundColor);
- WriteCenterText(ScreenRow+1,'Strike any key to continue');
- WaitUntilKeypressed;
- RecallTextScreen(1); { restore old screen from snapshot }
- End; { DisplayErrorMessage }
-
-
-
- Procedure RequestBeamSpan;
-
- { This procedure is specific to the example application of the input
- pre-processor. You may want to write a similar procedure to do your input
- error checking.
-
- This procedure requests that the user enter the beam length before it
- will allow the user to page downward. }
-
- Begin { RequestBeamSpan }
- DisplayErrorMessage(19,'Please enter beam span before paging downward');
- OldPrompt:=NewPrompt;
- NewPrompt:=13; { place user's current prompt at prompt entry that requires filling out. }
- Move_G_I_InputPromptBlockModule(OldPrompt,NewPrompt);
- End; { RequestBeamSpan }
-
-
-
- Procedure CheckForDirectory(Var DirectoryPathEntry:WorkString);
-
- { This procedure is specific to the example application of the input
- pre-processor. You may want to write a similar procedure to do your input
- error checking.
-
- This procedure checks for the existance of the passed user entered disk
- directory path. }
-
- Var
- LoggedDirectory:WorkString; { string variable used to temporarily store the currently logged directory }
- ExistantDirectory:Boolean; { boolean used in the test for the existance of the user requested disk directory }
-
- Begin { CheckForDirectory }
- GetDir(0,LoggedDirectory); { get the currently logged directory }
- {$I- } { I/O error checking is set to passive state }
- ChDir(DirectoryPathEntry); { attempt to change directory to user's specified directory }
- {$I+ } { I/O error checking is set to active state }
- ExistantDirectory:=(IOresult=0); { If ExistantDirectory=True, then directory exists }
- ChDir(LoggedDirectory); { change back to original directory }
- If Not (ExistantDirectory) Then
- Begin { user has specified a non-existent directory }
- DisplayErrorMessage(6,'The above specified directory path is non-existant');
- OldPrompt:=NewPrompt;
- NewPrompt:=NewPrompt-1; { place user's current prompt at prompt entry that requires filling out. }
- DirectoryPathEntry:=G_I_Data[NewPrompt,G_I_Page]^; { place previous entry into passed entry }
- End; { If Not(ExistantDirectory) }
- End; { CheckForDirectory }
-
-
-
- Procedure CheckBeamLength(Var BeamLengthEntry:WorkString);
-
- { This procedure is specific to the example application of the input
- pre-processor. You may want to write a similar procedure to do your input
- error checking.
-
- This procedure checks to see if there are any load locations that exceed
- the newly entered beam length entry. This procedure prevents the
- corruption of previously entered input data. }
-
- Var
- Page:Integer; { an index counter to a data page }
- Row:Integer; { an index counter to a data row }
- ErrorCode:Integer; { variable used in the return of an error code during a string conversion to a real }
- LoadPosition:Real; { a temporary variable used in checking input data for corruption }
- BeamLengthExceeded:Boolean; { a boolean used in testing if an attempt has been made to corrupt data }
-
- Begin { CheckBeamLength }
- BeamLengthExceeded:=False; { initialize boolean flag }
- Val(BeamLengthEntry,BeamLength,ErrorCode);
- For Page:=1 To MAX_NUM_OF_S_I_PAGES Do
- For Row:=1 To S_I_ENTRY_LIMIT Do
- Begin { check all previous inputed data entries }
- If S_I_Data[2,Row,Page]^<>'' Then
- Begin
- Val(S_I_Data[2,Row,Page]^,LoadPosition,ErrorCode);
- If LoadPosition>BeamLength Then
- BeamLengthExceeded:=True;
- End; { If S_I_Data }
- If S_I_Data[4,Row,Page]^<>'' Then
- Begin
- Val(S_I_Data[4,Row,Page]^,LoadPosition,ErrorCode);
- If LoadPosition>BeamLength Then
- BeamLengthExceeded:=True;
- End; { If S_I_Data }
- End; { For Row }
- If BeamLengthExceeded Then
- Begin { user has attempted to corrupt previously entered input data }
- DisplayErrorMessage(19,'There exists a load position that exceeds the above beam length');
- OldPrompt:=NewPrompt;
- NewPrompt:=NewPrompt-1; { place user's current prompt at prompt entry that requires filling out. }
- BeamLengthEntry:=G_I_Data[NewPrompt,G_I_Page]^; { place previous entry into passed entry }
- End; { If BeamLengthExceeded }
- End; { CheckBeamLength }
-
-
-
- Procedure CheckShearStudDiameter(Var ShearStudDiameterEntry:WorkString);
-
- { This procedure is specific to the example application of the input
- pre-processor. You may want to write a similar procedure to do your input
- error checking.
-
- This procedure determines if the passed user entered shear stud diameter
- is a legal entry. Note this procedure only allows the user to enter the
- following choices for shear stud diameters:
-
- 0.5"
- 0.75"
- 0.875" }
-
- Var
- ErrorCode:Integer; { variable used in the return of an error code during a string conversion to a real }
- StudDiameter:Real; { variable used in converting user entered string entry into a real }
-
- Begin { CheckShearStudDiameter }
- Val(ShearStudDiameterEntry,StudDiameter,ErrorCode);
- If Not((StudDiameter=0.5) Or (StudDiameter=0.75) Or (StudDiameter=0.875)) Then { user only allowed to enter three types }
- Begin { illegal entry }
- DisplayErrorMessage(23,' Allowable shear stud diameters are: 0.500", 0.750", 0.875"');
- OldPrompt:=NewPrompt;
- NewPrompt:=NewPrompt-1; { place user's current prompt at prompt entry that requires filling out. }
- ShearStudDiameterEntry:=G_I_Data[NewPrompt,G_I_Page]^; { place previous entry into passed entry }
- End; { If Not((StudDiameter }
- End; { CheckShearStudDiameter }
-
-
-
- Procedure CheckEntry(Var InputEntry:Workstring);
-
- { This procedure controls the checking of specific general input page data
- entries to determine if the just entered data is legal and takes
- appropriate action as defined in the specific procedures. Note that the
- case statement below only supports 4 general input pages, but can easily
- be added to inorder to support additional pages. }
-
- Begin { CheckEntry }
- Case G_I_Page Of
- 1 : Begin
- If InputEntry=Chr(81) Then { page down entered }
- RequestBeamSpan { user must enter beam span before pre-processor will allow him to page down }
- Else
- If InputEntry<>'' Then
- Case NewPrompt Of
- 2 : CheckForDirectory(InputEntry);
- 13 : CheckBeamLength(InputEntry);
- 21 : CheckShearStudDiameter(InputEntry);
- End; { Case NewPrompt }
- End; { page 1 }
- 2 : Begin
- End; { page 2 }
- 3 : Begin
- End; { page 3 }
- 4 : Begin
- End; { page 4 }
- End; { Case G_I_Page }
- End; { CheckEntry }
-
-
-
- Begin { G_I_ErrorCheckingModule }
- CheckEntry(DataEntry);
- End; { G_I_ErrorCheckingModule }
-
-
-
- Procedure S_I_ErrorCheckingModule;{(Var OldCol :Integer;
- OldRow :Integer;
- Var NewCol :Integer;
- NewRow,
- CurrentTopMostDataRow :Integer;
- Var CurrentLeftMostDataCol,
- CurrentRightMostDataCol:Integer;
- Var DataEntry :Workstring);}
-
- { *************************************************************************** }
- { * * }
- { * SCROLLING INPUT PAGE ERROR CHECKING MODULE * }
- { * * }
- { * This module controls the checking of user data input for the * }
- { * scrolling input pages. * }
- { * * }
- { * Note that the procedures within this module have been written * }
- { * specifically for the example application of the input pre-processor. * }
- { * You may want to write similar procedures for your application. * }
- { * * }
- { *************************************************************************** }
-
-
-
- Procedure DisplayErrorMessage( IllegalEntryCode:Integer);
-
- { This procedure is specific to the example application of the input
- pre-processor. You may want to write a similar procedure to do your input
- error checking.
-
- This procedure displays the error message describing the illegal scrolling
- input page data entry that the user has inputed, according to the passed
- IllegalEntryCode. }
-
- Begin { DisplayErrorMessage }
- StoreTextScreen(1);
- SoundAttention;
- TextColor(ForegroundColor);
- TextBackground(ErrorWindowColor);
- Case IllegalEntryCode Of
- 1 : Begin { X1 cannot be larger than or equal to Beam Span }
- ZoomWindow1(4,10,55,12);
- TextColor(HighlightColor);
- GotoXY(7,11);
- Write('X1 cannot be larger than or equal to Beam Span');
- TextColor(ForegroundColor);
- GotoXY(17,12);
- Write('Strike any key to continue');
- End; { X1 cannot be larger than or equal to Beam Span }
- 2 : Begin { X1 cannot be larger than or equal to X2 }
- ZoomWindow1(4,10,48,12);
- TextColor(HighlightColor);
- GotoXY(7,11);
- Write('X1 cannot be larger than or equal to X2');
- TextColor(ForegroundColor);
- GotoXY(13,12);
- Write('Strike any key to continue');
- End; { X1 cannot be larger than or equal to X2 }
- 3 : Begin { X2 cannot be larger than Beam Span }
- ZoomWindow1(4,10,43,12);
- TextColor(HighlightColor);
- GotoXY(7,11);
- Write('X2 cannot be larger than Beam Span');
- TextColor(ForegroundColor);
- GotoXY(11,12);
- Write('Strike any key to continue');
- End; { X2 cannot be larger than Beam Span }
- 4 : Begin { X2 cannot be smaller than or equal to X1 }
- ZoomWindow1(4,10,49,12);
- TextColor(HighlightColor);
- GotoXY(7,11);
- Write('X2 cannot be smaller than or equal to X1');
- TextColor(ForegroundColor);
- GotoXY(14,12);
- Write('Strike any key to continue');
- End; { X2 cannot be smaller than or equal to X1 }
- 5 : Begin { X2 cannot be equal to 0 }
- ZoomWindow1(4,10,35,12);
- TextColor(HighlightColor);
- GotoXY(9,11);
- Write('X2 cannot be equal to 0');
- TextColor(ForegroundColor);
- GotoXY(7,12);
- Write('Strike any key to continue');
- End; { X2 cannot be equal to 0 }
- 6 : Begin { X cannot be larger than Beam Span }
- ZoomWindow1(4,10,42,12);
- TextColor(HighlightColor);
- GotoXY(7,11);
- Write('X cannot be larger than Beam Span');
- TextColor(ForegroundColor);
- GotoXY(10,12);
- Write('Strike any key to continue');
- End; { X cannot be larger than Beam Span }
- End; { Case IllegalEntryCode }
- WaitUntilKeypressed;
-
- { routine erases error message window }
- RecallTextScreen(1);
-
- Window(LEFT_EDGE_OF_OUTER_SCROLL_WINDOW,
- TOP_EDGE_OF_OUTER_SCROLL_WINDOW,
- RightEdgeOfOuterScrollWindow,
- BOTTOM_EDGE_OF_OUTER_SCROLL_WINDOW);
- End; { DisplayErrorMessage }
-
-
-
- Procedure CheckEntry(Var InputEntry:Workstring);
-
- { This procedure is specific to the example application of the input
- pre-processor. You may want to write a similar procedure to do your input
- error checking.
-
- This procedure checks the scrolling input page data entry to determine if
- the data entry is legal and takes the appropriate action defined, if
- necessary.
-
- Note that the case statement below only supports 4 scrolling input pages,
- but can easily be added to inorder to support additional pages. }
-
- Var
- ErrorCode:Integer; { variable used in the return of an error code during a string conversion to a real }
- IllegalEntry:Integer; { variable used to register why user's entry is illegal }
- X_Entry:Real; { variable used in converting user entered string entry into a real }
- X1_Entry:Real; { variable used in converting user entered string entry into a real }
- X2_Entry:Real; { variable used in converting user entered string entry into a real }
-
- Begin { CheckEntry }
- IllegalEntry:=0; { initialize illegal entry code }
- { convert loading dimensions to type real }
- Val(S_I_Data[2,NewRow,S_I_Page]^,X_Entry,ErrorCode);
- X1_Entry:=X_Entry; { defined by example application of input pre-processor }
- Val(S_I_Data[4,NewRow,S_I_Page]^,X2_Entry,ErrorCode);
- Case S_I_Page Of
- 1 : Begin
- Case NewCol Of
- 2 : Begin
- Val(InputEntry,X1_Entry,ErrorCode);
- If X1_Entry>=BeamLength Then
- IllegalEntry:=1; { X1 cannot be larger than or equal to Beam Span }
- If (X1_Entry>=X2_Entry) And (S_I_Data[4,NewRow,S_I_Page]^<>'') Then
- IllegalEntry:=2; { X1 cannot be larger than or equal to X2 }
- End;
- 4 : Begin
- Val(InputEntry,X2_Entry,ErrorCode);
- If X2_Entry>BeamLength Then
- IllegalEntry:=3; { X2 cannot be larger than Beam Span }
- If (X2_Entry<=X1_Entry) And (S_I_Data[2,NewRow,S_I_Page]^<>'') Then
- IllegalEntry:=4; { X2 cannot be smaller than or equal to X1 }
- If (X2_Entry=0.0) And (InputEntry<>'') Then
- IllegalEntry:=5; { X2 cannot be equal to 0 }
- End;
- End; { Case NewCol }
- End; { page 1 }
- 2 : Begin
- Case NewCol Of
- 2 : Begin
- Val(InputEntry,X_Entry,ErrorCode);
- If X_Entry>BeamLength Then
- IllegalEntry:=6; { X cannot be larger than Beam Span }
- End;
- End; { Case NewCol }
- End; { page 2 }
- 3 : Begin
- Case NewCol Of
- 2 : Begin
- Val(InputEntry,X1_Entry,ErrorCode);
- If X1_Entry>=BeamLength Then
- IllegalEntry:=1; { X1 cannot be larger than or equal to Beam Span }
- If (X1_Entry>=X2_Entry) And (S_I_Data[4,NewRow,S_I_Page]^<>'') Then
- IllegalEntry:=2; { X1 cannot be larger than or equal to X2 }
- End;
- 4 : Begin
- Val(InputEntry,X2_Entry,ErrorCode);
- If X2_Entry>BeamLength Then
- IllegalEntry:=3; { X2 cannot be larger than Beam Span }
- If (X2_Entry<=X1_Entry) And (S_I_Data[2,NewRow,S_I_Page]^<>'') Then
- IllegalEntry:=4; { X2 cannot be smaller than or equal to X1 }
- If (X2_Entry=0.0) And (InputEntry<>'') Then
- IllegalEntry:=5; { X2 cannot be equal to 0 }
- End;
- End; { Case NewCol }
- End; { page 3 }
- 4 : Begin
- Case NewCol Of
- 2 : Begin
- Val(InputEntry,X_Entry,ErrorCode);
- If X_Entry>BeamLength Then
- IllegalEntry:=6; { X cannot be larger than Beam Span }
- End;
- End; { Case NewCol }
- End; { page 4 }
- End; { Case S_I_Page }
- If IllegalEntry<>0 Then
- Begin
- DisplayErrorMessage(IllegalEntry);
- NewCol:=NewCol-1;
- If NewCol<CurrentLeftMostDataCol Then
- ShiftScrollWindowDataSidewaysModule(NewCol,
- CurrentTopMostDataRow,
- CurrentLeftMostDataCol,
- CurrentRightMostDataCol);
- InputEntry:=S_I_Data[NewCol,NewRow,S_I_Page]^;
- End; { If IllegalEntry }
- End; { CheckEntry }
-
-
-
- Begin { S_I_ErrorCheckingModule }
- CheckEntry(DataEntry);
- End; { S_I_ErrorCheckingModule }