'-----------------------------------------------------------------------------
' NAMING CONVENTIONS
' Category............................................ Format Example
'PROCEDURES
' Main procedure relating to main menu function NNNN TASK
' Subsidiary procedure in main module Nn.nn Do.task
' Utility procedure Nnnn Utility
'DATA
' Constant NNNN FRED
' General variable Nnnn Fredgen
' One of a set of variables related to a subject (Fred) Nn.nn Fred.variable
' Element of variable (Fred) with user-defined type Nn.Nn Fred.Element
'
' I/O PATHS
' #1 Printer LPT1
' #2 PSF file I/P
' #3 PSF file O/P
'-----------------------------------------------------------------------------
CONST TRUE
= 1, YES
= 1, SETFLAG
= 1 CONST FALSE
= 0, NO
= 0, RESETFLAG
= 0 '-----------------------------------------------------------------------------
TYPE Psfparamsttype
' String-only version for file reading '-----------------------------------------------------------------------------
DIM Psf.numpars
(3) AS INTEGER, Psf.setlabel
(3) AS STRING * 20 ' <<<<<<<<<<<<<<<<<<<<<<<<<<<< these never used DIM SHARED Psfset
(3, 1 TO 220) AS Psfparamtype
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< changed SHARED '-----------------------------------------------------------------------------
'General
'File operations
'File contents data
'COMMON SHARED Psfset AS Psfparamtype, Host AS STRING * 20 '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< changed
'-----------------------------------------------------------------------------
'SPECIFICATION EDITOR PROGRAM - SPECEDIT.BAS S J Oxley
Softiss$ = "5 ": Softdate$ = "- 08/11/04"
'REVISION RECORD:
'..DATE....ISSUE......................REVISION DETAILS..................
'25/01/99 1 FIRST ISSUE - Archived as SPECED01.BAS + UTILS02.BAS
'22/02/99 (1) Added choice of Template File in CHOOSE, F9 & F10 functions
' on editor P.2 (default indices & copy set)
'13/10/99 2 Added clearance of unused parameter sets when loading a PSF
' with fewer parameter sets than the previous PSF.
' Cleared Print.tol format bug; Label/Units trailing spaces.
' Archived as SPECED02.BAS
'19/10/99 (2) Added default drive selection using OPTIONH.PSF file.
'14/01/00 (2) Changed Filename$ to Psf$ when saving edited PSF at end of
' EDIT. The global Psf$ is now updated when changing class.
'28/02/00 (2) Removal of F7 option.
'04/06/03 3 Default drive and paths set to T and \TEST\SPECS.
'02/09/03 4 Index as STRING * 3 changed to * 4.
' Changed to allow for index>100 " 100" is 4 CHRs.
' Changed default drive and paths back to C and \BLP\SPECS.
'07/11/04 5 Changed DIM Psfset(3,1 TO 200) to 220 to get more parameters.
'-----------------------------------------------------------------------------
Stay% = YES
Continue% = NO
'-----------------------------------------------------------------------------
Keysoff: 'De-activate main menu softkeys
Quit:
GOSUB Keysoff: Stay%
= NO: Continue%
= YES:
RETURNErrhandler: '------------------------------------------------------------------
CALL State
("PRINTER NOT READY - Check paper loaded & on-line, then press any key.") Fileunfound% = TRUE
Fileduplicate% = TRUE
CALL State
("DISK FULL OR BAD - Replace disk, then press any key.") CALL State
("DISK WRITE-PROTECTED - Replace or unprotect disk, then press any key.") 'SOUND 800, 15
Message$
= "ERROR NUMBER " + STR$(ERR) IF Ask%
("Do you want to ABANDON PRINT") = YES
THEN Printerok% = NO
Pathname$ = Drive$ + ":" + Path$ + Psf$
Fileunfound% = RESETFLAG
Choose.done% = YES
IF Psfoption$
= "PREVIOUS" THEN PRINT "FAILED TO FIND PREVIOUS PSF "; Pathname$;
". Press any key." ELSEIF Ask%
("This PSF does not exist. Do you want to CREATE NEW PSF") = YES
THEN State ("Just press ENTER FOR DEFAULT - C:\BLP\SPECS\SPECEDIT.PSF")
Pathname$ = "C:\BLP\SPECS\SPECEDIT.PSF"
Fileunfound% = RESETFLAG
Psf.typeno$ = "******"
Psf.preceding$ = "*"
Choose.done% = YES
State ("Could not find " + Pathname$ + " Press any key.")
Waitkey
CALL State
("Working file not specified yet; select CHOOSE first. Press any key.") Issue.raised% = NO
IF Psfoption$
= "CURRENT" THEN IF Psf.typeno$
= "******" THEN 'New PSF Valid% = NO
CALL State
("The issue must be a valid DOS filename extension.") LOCATE 23, 1:
LINE INPUT "Enter the FIRST ISSUE (up to 3 characters), or ENTER for A - "; New.iss$
IF New.iss$
= "" THEN New.iss$
= "A" New.iss$
= LEFT$(New.iss$
, 3) IF Dosvalid%
(New.iss$
) = YES
THEN Valid% = YES
Psf.progiss$ = New.iss$
Psf.preceding$ = "*"
Stay% = YES
CALL State
("If you up-issue, the loaded CURRENT PSF is first archived as a PREVIOUS PSF.") IF Ask%
("Are you CHANGING THE ISSUE of the test program & PSF") = YES
THEN Valid% = NO
CALL State
("Current issue is " + Psf.progiss$
+ ". The issue must be a valid DOS filename extension.") LOCATE 23, 1:
LINE INPUT "Enter the NEW ISSUE (up to 3 characters): "; New.iss$
New.iss$
= LEFT$(New.iss$
, 3) IF Dosvalid%
(New.iss$
) = YES
THEN Valid% = YES
CALL State
("About to change issue from " + Psf.progiss$
+ " to " + New.iss$
) IF Ask%
("Are you sure you want to CHANGE ISSUE NOW") = YES
THEN Filename$ = TType.number$ + "P." + Psf.progiss$
Issue.raised% = YES
Psf.preceding$ = Psf.progiss$
Psf.progiss$ = New.iss$
Stay% = NO
Stay% = NO
Pageno% = 1
Stay% = YES
Stay% = NO
Edit.set% = 0: Edit.line% = 1: Copy.set% = 1
CALL Edit.head2
(Pageno%
, Edit.set%
, Edit.line%
, Copy.set%
) CALL Edit.param
(Pageno%
, Edit.set%
, Edit.line%
) Save.file% = YES
CALL State
("You can either save the edited PSF or quit without saving & lose any edits.") IF Psfoption$
= "PREVIOUS" THEN Question$ = "Do you wish to SAVE THE EDITED PREVIOUS PSF AS HYPOTHETICAL"
Question$ = "Do you wish to SAVE THE EDITED PSF"
Save.file% = NO
IF Psfoption$
= "PREVIOUS" THEN Psfoption$
= "HYPOTHETICAL" IF Psfoption$
= "CURRENT" THEN CALL State
("You can either save as CURRENT PSF (same issue) or convert to HYPOTHETICAL.") IF Ask
("Do you wish to SAVE AS CURRENT PSF") = NO
THEN Psfoption$
= "HYPOTHETICAL" Psf$
= TType.number$
+ LEFT$(Psfoption$
, 1) + ".PSF"
'Move cursor around first header screen and edit data
Lineno% = 4
Stay% = YES
Colno% = 1
Colno% = 30
Psf.hitemp% = Entry%
IF Checkint%
(Entry%
, 23, 200) = YES
THEN Psf.hitemp%
= Entry%
Psf.lotemp% = Entry%
IF Checkint%
(Entry%
, -99, 23) = YES
THEN Psf.lotemp%
= Entry%
IF Checkint%
(Entry%
, 0, 1) = YES
THEN Psf.sermark%
= Entry%
CASE 9, 80, 13 'TAB, Down, ENTER Lineno% = Lineno% + 3
Lineno% = Lineno% + 2
Lineno% = Lineno% + 1
CASE 15, 72 'Shift TAB, Up Lineno% = Lineno% - 3
Lineno% = Lineno% - 2
Lineno% = Lineno% - 1
Lineno% = 4
Lineno% = 20
Pageno% = 2
Stay% = NO
Pageno% = 0
Stay% = NO
SUB Edit.head2
(Pageno%
, Edit.set%
, Edit.line%
, Copy.set%
) 'Move cursor around second header screen and edit data
Lineno% = 5
Stay% = YES
CALL Show.head2
(Edit.set%
, Edit.line%
, Copy.set%
) Colno% = 1
Colno% = 30
IF Checkint%
(Entry%
, 1, Psf.numspaces%
) = YES
THEN Psf.numpars%
(0) = Entry%
IF Checkint%
(Entry%
, 0, Psf.numspaces%
) = YES
THEN Psf.numpars%
(1) = Entry%
IF Checkint%
(Entry%
, 0, Psf.numspaces%
) = YES
THEN Psf.numpars%
(2) = Entry%
IF Checkint%
(Entry%
, 0, Psf.numspaces%
) = YES
THEN Psf.numpars%
(3) = Entry%
Entry%
= VAL(Numspacesst$
) IF Checkint%
(Entry%
, 1, 220) = YES
THEN Psf.numspaces%
= Entry%
IF Checkint%
(Entry%
, 0, Psf.numsets%
) = YES
THEN Edit.set%
= Entry%
IF Checkint%
(Entry%
, 1, 220) = YES
THEN Edit.line%
= Entry%
IF Checkint%
(Entry%
, 0, Psf.numsets%
) = YES
THEN Copy.set%
= Entry%
CASE 9, 80, 13 'TAB, Down, ENTER Lineno% = Lineno% + 2
Lineno%
= 15:
IF Psf.numpars%
(1) = 0 THEN Lineno%
= 19 Lineno%
= 17:
IF Psf.numpars%
(2) = 0 THEN Lineno%
= 19 Lineno% = Lineno% + 1
CASE 15, 72 'Shift TAB, Up Lineno% = Lineno% - 2
Lineno% = 14
Lineno% = 16
Lineno% = 18
Lineno% = Lineno% - 1
Lineno% = 5
Lineno% = 23
Pageno% = 1
Stay% = NO
Pageno% = 3
Stay% = NO
Pageno% = 0
Stay% = NO
IF Ask
("Are you sure you want to MAKE INDICES = LINE NUMBERS in Set " + Setst$
) = YES
THEN FOR Line.number%
= 1 TO Psf.numpars%
(Edit.set%
) Psfset
(Edit.set%
, Line.number%
).Index
= Line.number%
IF Copy.set%
<> Edit.set%
THEN IF Ask
("Are you sure you want to COPY SET " + Setst$
+ " TO SET " + Copysetst$
) = YES
THEN Psf.numpars%(Copy.set%) = Psf.numpars%(Edit.set%)
FOR Line.number%
= 1 TO Psf.numpars%
(Edit.set%
) Psfset
(Copy.set%
, Line.number%
).Index
= Psfset
(Edit.set%
, Line.number%
).Index
Psfset
(Copy.set%
, Line.number%
).Label
= Psfset
(Edit.set%
, Line.number%
).Label
Psfset
(Copy.set%
, Line.number%
).Units
= Psfset
(Edit.set%
, Line.number%
).Units
Psfset
(Copy.set%
, Line.number%
).Lower
= Psfset
(Edit.set%
, Line.number%
).Lower
Psfset
(Copy.set%
, Line.number%
).Upper
= Psfset
(Edit.set%
, Line.number%
).Upper
Psf.numpars%(2) = 0
Psf.numpars%(3) = 0
Psf.numsets% = 1
Psf.numpars%(3) = 0
Psf.numsets% = 2
Psf.numsets% = 3
Psf.numsets% = 4
IF Edit.set%
> Psf.numsets%
THEN Edit.set%
= Psf.numsets%
IF Copy.set%
> Psf.numsets%
THEN Copy.set%
= Psf.numsets%
IF Edit.set%
> Psf.numsets%
- 1 THEN Edit.set%
= Psf.numsets%
- 1
SUB Edit.param
(Pageno%
, Edit.set%
, Edit.line%
) 'Scroll and edit parameter data
Colno% = 7
Stay% = YES
IF Psf.numpars%
(Edit.set%
) = 0 THEN Pageno% = 2
Stay% = NO
CALL Show.param
(Edit.set%
, Edit.line%
) Indexst$
= LTRIM$(STR$(Psfset
(Edit.set%
, Edit.line%
).Index
)) Unique% = YES
FOR Line.number%
= 1 TO Psf.numpars%
(Edit.set%
) IF Psfset
(Edit.set%
, Line.number%
).Index
= Entry%
THEN Unique%
= NO
Psfset(Edit.set%, Edit.line%).Index = Entry%
SOUND 300, 4:
COLOR , 4:
LOCATE 23, 1:
PRINT "INDEX"; Entry%;
"ALREADY USED! Indices must be unique within each set. Press any key.";
CALL Line.edit
(Psfset
(Edit.set%
, Edit.line%
).Label
, 24, Exit.code%
) CALL Line.edit
(Psfset
(Edit.set%
, Edit.line%
).Units
, 5, Exit.code%
) Lowerst$
= LTRIM$(STR$(Psfset
(Edit.set%
, Edit.line%
).Lower
)) Entry.real!
= VAL(Lowerst$
) IF Entry.real!
< -9999.999 THEN Entry.real!
= -9999.999 IF Entry.real!
> 9999.999 THEN Entry.real!
= 9999.999 Hilim! = Psfset(Edit.set%, Edit.line%).Upper
IF Checkreal%
(Entry.real!
, -9999.999, Hilim!
) = YES
THEN Psfset(Edit.set%, Edit.line%).Lower = Entry.real!
Psfset(Edit.set%, Edit.line%).Lower = Entry.real!
SOUND 300, 4:
COLOR , 4:
LOCATE 23, 1:
PRINT "LIMITS OUT OF RANGE! (-/+9999.999 and LOWER < UPPER). Press any key.";
Upperst$
= LTRIM$(STR$(Psfset
(Edit.set%
, Edit.line%
).Upper
)) Entry.real!
= VAL(Upperst$
) IF Entry.real!
< -9999.999 THEN Entry.real!
= -9999.999 IF Entry.real!
> 9999.999 THEN Entry.real!
= 9999.999 Lolim! = Psfset(Edit.set%, Edit.line%).Lower
IF Checkreal%
(Entry.real!
, Lolim!
, 9999.999) = YES
THEN Psfset(Edit.set%, Edit.line%).Upper = Entry.real!
Psfset(Edit.set%, Edit.line%).Upper = Entry.real!
SOUND 300, 4:
COLOR , 4:
LOCATE 23, 1:
PRINT "LIMITS OUT OF RANGE! (-/+9999.999 and LOWER < UPPER). Press any key.";
Colno% = 13
Colno% = 40
Colno% = 48
Colno% = 61
Colno% = 48
Colno% = 40
Colno% = 13
Colno% = 7
IF Edit.line%
< Psf.numpars%
(Edit.set%
) THEN Edit.line%
= Edit.line%
+ 1 IF Edit.line%
> 1 THEN Edit.line%
= Edit.line%
- 1 Edit.line% = 1
Edit.line% = Psf.numpars%(Edit.set%)
IF Psf.numpars%
(Edit.set%
) < Psf.numspaces%
THEN Psfset
(Edit.set%
, (Line.number%
+ 1)).Index
= Psfset
(Edit.set%
, Line.number%
).Index
Psfset
(Edit.set%
, (Line.number%
+ 1)).Label
= Psfset
(Edit.set%
, Line.number%
).Label
Psfset
(Edit.set%
, (Line.number%
+ 1)).Units
= Psfset
(Edit.set%
, Line.number%
).Units
Psfset
(Edit.set%
, (Line.number%
+ 1)).Lower
= Psfset
(Edit.set%
, Line.number%
).Lower
Psfset
(Edit.set%
, (Line.number%
+ 1)).Upper
= Psfset
(Edit.set%
, Line.number%
).Upper
Psfset(Edit.set%, Edit.line%).Index = 0
Psfset(Edit.set%, Edit.line%).Label = ""
Psfset(Edit.set%, Edit.line%).Units = ""
Psfset(Edit.set%, Edit.line%).Lower = 0
Psfset(Edit.set%, Edit.line%).Upper = 0
Psf.numpars%(Edit.set%) = Psf.numpars%(Edit.set%) + 1
SOUND 300, 4:
COLOR , 4:
LOCATE 23:
PRINT "NO SPACE to insert new parameter! Increase TRF record size first. Press any key.";
IF Ask
("Are you sure you want to DELETE THIS LINE") = YES
THEN IF Edit.line%
< Psf.numpars%
(Edit.set%
) THEN FOR Line.number%
= Edit.line%
+ 1 TO Psf.numpars%
(Edit.set%
) Psfset
(Edit.set%
, (Line.number%
- 1)).Index
= Psfset
(Edit.set%
, Line.number%
).Index
Psfset
(Edit.set%
, (Line.number%
- 1)).Label
= Psfset
(Edit.set%
, Line.number%
).Label
Psfset
(Edit.set%
, (Line.number%
- 1)).Units
= Psfset
(Edit.set%
, Line.number%
).Units
Psfset
(Edit.set%
, (Line.number%
- 1)).Lower
= Psfset
(Edit.set%
, Line.number%
).Lower
Psfset
(Edit.set%
, (Line.number%
- 1)).Upper
= Psfset
(Edit.set%
, Line.number%
).Upper
Psfset(Edit.set%, Psf.numpars%(Edit.set%)).Index = 0
Psfset(Edit.set%, Psf.numpars%(Edit.set%)).Label = ""
Psfset(Edit.set%, Psf.numpars%(Edit.set%)).Units = ""
Psfset(Edit.set%, Psf.numpars%(Edit.set%)).Lower = 0
Psfset(Edit.set%, Psf.numpars%(Edit.set%)).Upper = 0
Psf.numpars%(Edit.set%) = Psf.numpars%(Edit.set%) - 1
IF Psf.numpars%
(Edit.set%
) = 0 THEN Pageno% = 2
Stay% = NO
Pageno% = 2
Stay% = NO
Pageno% = 0
Stay% = NO
'Move cursor around setup screen and edit data
Prev.issue$ = "1 "
Lineno% = 9
Stay% = YES
Psfoption$ = "CURRENT"
Psfoption$ = "PREVIOUS"
Psfoption$ = "HYPOTHETICAL"
Edit.prev.issue$ = Prev.issue$
IF Dosvalid%
(Edit.prev.issue$
) = YES
THEN Prev.issue$
= Edit.prev.issue$
IF Lineno%
< 10 THEN Lineno%
= Lineno%
+ 1 IF Lineno%
= 10 AND Psfoption$
= "PREVIOUS" THEN Lineno%
= 11 IF Lineno%
> 7 THEN Lineno%
= Lineno%
- 1 Lineno% = 7
IF Psfoption$
= "PREVIOUS" THEN Lineno% = 11
Lineno% = 10
CASE 81, 73 'Pg Down, Pg Up Stay% = NO
'Print out the History Report entry for the PSF now loaded
PRINT #1, " " '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<, just skip ??? blank line I bet! IF Plain$
(Psf.crn$
) <> "NONE" THEN Issued$ = ") issued under Change Note No. " + Psf.crn$
Issued$ = ") not issued."
PRINT #1, Psfoption$;
" ("; Psf$; Issued$
PRINT #1, "PROG Iss. "; Psf.progiss$;
" - "; Psf.progdate$;
" SPEC "; Psf.sourcename$;
" Iss. "; Psf.sourceiss$;
" - "; Psf.sourcedate$
'Display the History Report entry for the PSF now loaded
IF Plain$
(Psf.crn$
) <> "NONE" THEN Issued$ = " issued under Change Note No. " + Psf.crn$
Issued$ = " not issued."
PRINT "PROG Iss. "; Psf.progiss$;
" - "; Psf.progdate$;
" SPEC "; Psf.sourcename$;
" Iss. "; Psf.sourceiss$;
" - "; Psf.sourcedate$
CALL State
("Working file not specified yet; select CHOOSE first. Press any key.") IF Psfoption$
<> "CURRENT" THEN CALL State
("You can produce a History Report only from a CURRENT PSF . Press any key.") Pathname$ = Drive$ + ":" + Path$ + Psf$
Fileunfound% = RESETFLAG
History.complete% = YES
PRINT "HISTORY REPORT for "; TType.number$;
" produced on "; British$
(DATE$);
" @ ";
LEFT$(TIME$, 5);
" Engineer:"; Psf.eng$
PRINT "Program + "; Psf$;
SPACE$(19 - LEN(Psf$
));
"Issue:"; Psf.progiss$;
" Dated:"; Psf.progdate$
PRINT "Source:"; Psf.sourcename$;
" Issue:"; Psf.sourceiss$;
" Dated:"; Psf.sourcedate$
Sermarked$ = " Serial Marked"
Sermarked$ = " Not Serial Marked"
PRINT "Customer Reference:"; Psf.custype$; Sermarked$
Lotempst$ = " N/A "
Lotempst$
= "=" + STR$(Psf.lotemp%
) + "DegC" Hitempst$ = " N/A "
PRINT "Low Temp."; Lotempst$;
" Ambient Temp.=23DegC High Temp."; Hitempst$
Psfoption$ = "PREVIOUS"
Preceding.issue% = Dosvalid%(Psf.preceding$)
WHILE Preceding.issue%
= YES
Psf$ = TType.number$ + "P." + Noblanks$(Psf.preceding$)
Pathname$ = Drive$ + ":" + Path$ + Psf$
Fileunfound% = RESETFLAG
Preceding.issue% = Dosvalid%(Psf.preceding$)
CALL State
("Press any key to continue."):
COLOR 15, 4 PRINT "HISTORY REPORT MAY BE INCOMPLETE: "; Psf$;
" was referenced but not found." Preceding.issue% = NO
History.complete% = NO
IF History.complete%
= YES
THEN PRINT "HISTORY REPORT COMPLETE." Psfoption$ = "CURRENT"
Psf$ = TType.number$ + "C.PSF"
Pathname$ = Drive$ + ":" + Path$ + Psf$
IF Ask%
("Do you want to PRINT THIS REPORT") = YES
THEN History.complete% = YES
PRINT #1, "HISTORY REPORT for "; TType.number$;
" produced on "; British$
(DATE$);
" @ ";
LEFT$(TIME$, 5);
" Engineer:"; Psf.eng$
PRINT #1, "Program + "; Psf$;
SPACE$(19 - LEN(Psf$
));
"Issue:"; Psf.progiss$;
" Dated:"; Psf.progdate$
PRINT #1, "Source:"; Psf.sourcename$;
" Issue:"; Psf.sourceiss$;
" Dated:"; Psf.sourcedate$
Sermarked$ = " Serial Marked"
Sermarked$ = " Not Serial Marked"
PRINT #1, "Customer Reference:"; Psf.custype$; Sermarked$
Lotempst$ = " N/A "
Lotempst$
= "=" + STR$(Psf.lotemp%
) + "DegC" Hitempst$ = " N/A "
PRINT #1, "Low Temp."; Lotempst$;
" Ambient Temp.=23DegC High Temp."; Hitempst$
Psfoption$ = "PREVIOUS"
Preceding.issue% = Dosvalid%(Psf.preceding$)
WHILE Preceding.issue%
= YES
Psf$ = TType.number$ + "P." + Noblanks$(Psf.preceding$)
Pathname$ = Drive$ + ":" + Path$ + Psf$
Fileunfound% = RESETFLAG
Preceding.issue% = Dosvalid%(Psf.preceding$)
PRINT #1, "HISTORY REPORT MAY BE INCOMPLETE: "; Psf$;
" was referenced but not found." Preceding.issue% = NO
History.complete% = NO
IF History.complete%
= YES
THEN PRINT #1, "HISTORY REPORT COMPLETE." Psfoption$ = "CURRENT" ' Restore current file
Psf$ = TType.number$ + "C.PSF"
Pathname$ = Drive$ + ":" + Path$ + Psf$
'Initialise all shared variables
Fileunfound% = RESETFLAG
Host$ = Psf.custype$
Host$ = ""
Drive$ = "C"
Printerok% = YES
TType.number$ = "~~~~~~"
Choose.done% = NO
Path$ = "\BLP\SPECS\"
Psf$ = "SPECEDIT.PSF"
Psfoption$ = "CURRENT"
Fileunfound% = FALSE
Fileduplicate% = FALSE
'Line editor - processes left & right arrow, delete and insert keys to edit
'Edit.string$, which is padded if necessary to a length of Field.size%.
'Exit.code% is ASCII code of key used to quit line edit:- TAB, Shift+TAB, Up,
'Down, ENTER, Pg Up, Pg Down, ESC, Home, End, F9, F10
PRINT "Line.edit: Edit string exceeds field size":
STOP End.char%
= Start.char%
+ Field.size%
- 1 Char% = Start.char%
Insert.mode%
= NO:
LOCATE , , , 0, 7 Stay% = YES
Chars.left% = Char% - Start.char%
Chars.right%
= Start.char%
+ LEN(Edit.
string$) - Char%
- 1:
IF Chars.right%
< 0 THEN Chars.right%
= 0 IF LEN(K$
) = 2 THEN Ascii%
= Ascii%
* 100 ' EXTENDED CODE IF Char%
> Start.char%
THEN Char%
= Char%
- 1:
LOCATE , Char%
Insert.mode%
= YES:
LOCATE , , , 7, 7 Insert.mode%
= NO:
LOCATE , , , 0, 7 Edit.
string$ = Left.part$
+ Right.part$
CASE 9, 1500, 7200, 8000, 13, 7300, 8100, 27, 7100, 7900, 6700, 6800 'EXIT CODES Stay% = NO
Edit.
string$ = Left.part$
+ CHR$(Ascii%
) + LEFT$(Incl.right.part$
, Chars.right%
)
'Enter all data from PSF file, which has already been opened as #2
DIM Psfparamst
AS Psfparamsttype
Psf.numsets%
= VAL(Psf.numsetsst$
) FOR Setno%
= 0 TO Psf.numsets%
- 1 Psf.numpars%
(Setno%
) = VAL(Psf.numparsst$
) FOR Setno%
= Psf.numsets%
TO 3 'Clear unused parameter sets Psf.numpars%(Setno%) = 0
FOR Setno%
= 0 TO Psf.numsets%
- 1 FOR Setno%
= Psf.numsets%
TO 3 'Clear unused parameter sets Psf.setlabel$(Setno%) = ""
FOR Setno%
= 0 TO Psf.numsets%
- 1 FOR Paramno%
= 1 TO Psf.numpars%
(Setno%
) Psfset
(Setno%
, Paramno%
).Index
= VAL(Psfparamst.Index
) Psfset(Setno%, Paramno%).Label = Psfparamst.Label
Psfset(Setno%, Paramno%).Units = Psfparamst.Units
Psfset
(Setno%
, Paramno%
).Lower
= VAL(Psfparamst.Lower
) / 10000 Psfset
(Setno%
, Paramno%
).Upper
= VAL(Psfparamst.Upper
) / 10000 Psf.hitemp%
= VAL(Psf.hitempst$
) Psf.lotemp%
= VAL(Psf.lotempst$
) Psf.sermark%
= VAL(Psf.sermarkst$
) Psf.numspaces%
= VAL(Psf.numspacesst$
)
'Display / refresh status bars at top & bottom of screen
LOCATE 1, 1:
PRINT "*** SPECification EDITor SOFTWARE ISSUE "; Softiss$; Softdate$;:
LOCATE 1, 66:
PRINT "S J OXLEY ***";
Specpath$ = Drive$ + ":" + Path$
LOCATE 25, 5:
PRINT "Directory "; Specpath$;
" File "; TType.number$;
" - "; Psfoption$;
IF Psfoption$
<> "HYPOTHETICAL" THEN PRINT " Issue: "; Psf.progiss$;
'Display first header edit screen
COLOR 15, 2:
PRINT "Up/Dn, Home/End, TAB keys to move; Ins/Del as normal; Pg Dn for P.2; ESC to quit";:
COLOR 15, 4
SUB Show.head2
(Edit.set%
, Edit.line%
, Copy.set%
) 'Display second header edit screen
Col%
= 1:
IF Psf.numpars
(1) = 0 THEN Col%
= 4 Col%
= 1:
IF Psf.numpars
(2) = 0 THEN Col%
= 4 COLOR 15, 2:
PRINT "Up/Dn, Home/End or TAB keys to move; Ins; Del; Pg Up/Dn for P.1/P.3; ESC to quit";:
COLOR 15, 4
SUB Show.param
(Edit.set%
, Edit.line%
) 'Display parameter edit screen
Setlabelst$ = "- " + Psf.setlabel$(Edit.set%)
IF Edit.line%
> Psf.numpars%
(Edit.set%
) THEN Edit.line%
= Psf.numpars%
(Edit.set%
) IF Edit.line%
< 1 THEN Edit.line%
= 1 FOR Line.number%
= Edit.line%
- 9 TO Edit.line%
+ 8 Lowval! = Psfset(Edit.set%, Edit.line%).Lower
Upval! = Psfset(Edit.set%, Edit.line%).Upper
Nominal! = (Round!(((Lowval! + Upval!) / 2), 3))
IF LEFT$(Nomval$
, 1) = "." THEN Nomval$
= "0" + Nomval$
IF LEFT$(Rangeval$
, 1) = "." THEN Rangeval$
= "0" + Rangeval$
LOCATE 23, 15:
COLOR 10, 1:
PRINT " Specified Value: "; Nomval$; Unit$;
" ";
CHR$(241);
" "; Rangeval$; Unit$;
" " IF LEFT$(Tolval$
, 1) = "." THEN Tolval$
= "0" + Tolval$
LOCATE 23, 15:
COLOR 10, 1:
PRINT " Specified Value: "; Nomval$; Unit$;
" ";
CHR$(241);
" "; Rangeval$; Unit$;
" ("; Tolval$;
"%) " COLOR 15, 2:
PRINT "Arrow & TAB keys to move; F9/F10 Insert/Delete line; Pg Up for P.2; ESC to quit ";:
COLOR 15, 4
'Display current CHOOSE options
Psf$ = TType.number$ + "P." + Noblanks$(Prev.issue$)
Psf$
= TType.number$
+ Option$
+ ".PSF" PRINT "If you load a CURRENT PSF you can edit it, produce a Tolerance Report or" PRINT "produce a History Report." PRINT "If you choose to edit it, you must decide whether you are going to raise the" PRINT "software issue of the test program. If so, the PSF will be archived as a" PRINT "PREVIOUS PSF before editing commences, and then the edited version will be" PRINT "saved as the new CURRENT PSF. If you choose not to change the issue, you will" PRINT "be able to save the edited version as either CURRENT or HYPOTHETICAL, or to" PRINT "quit the editor without saving the changes." PRINT "If you load a HYPOTHETICAL PSF you can edit it or produce a Tolerance Report," PRINT "but not a History Report." PRINT "If you choose to edit it, you will be able to save the edited version as" PRINT "HYPOTHETICAL, or quit the editor without saving the changes. You cannot" PRINT "convert a HYPOTHETICAL PSF to CURRENT class. This preserves the integrity of" PRINT "the issue history." PRINT "If you load a PREVIOUS PSF you can edit it or produce a Tolerance Report, but" PRINT "not a History Report." PRINT "If you choose to edit it, you will be able to save the edited version as" PRINT "HYPOTHETICAL, or quit the editor without saving the changes. You cannot" PRINT "convert a PREVIOUS PSF to CURRENT class, nor can you over-write a PREVIOUS" PRINT "class file. This preserves the integrity of the issue history and of the" PRINT "archived PSF data." LOCATE 24:
COLOR 15, 2:
PRINT "Up/Dn, Home/End keys to move; Edit entry or TAB to select option; ESC to finish ";:
COLOR , 4
'Print out a tolerance report for the loaded PSF
' STATIC Labelst AS STRING * 24
PRINT #1, "TOLERANCE REPORT for "; TType.number$;
" produced on "; British$
(DATE$);
" @ ";
LEFT$(TIME$, 5);
" Engineer:"; Psf.eng$
IF Psfoption$
= "HYPOTHETICAL" THEN PRINT #1, "HYPOTHETICAL PSF - Generated for results analysis, not applied in testing." IF Psfoption$
= "PREVIOUS" THEN Prev.psf$ = " (PREVIOUS) Dated:"
Prev.psf$ = " Dated:"
PRINT #1, "Program + "; Psf$;
SPACE$(19 - LEN(Psf$
));
"Issue:"; Psf.progiss$; Prev.psf$; Psf.progdate$
PRINT #1, "Source:"; Psf.sourcename$;
" Issue:"; Psf.sourceiss$;
" Dated:"; Psf.sourcedate$
Sermarked$ = " Serial Marked"
Sermarked$ = " Not Serial Marked"
PRINT #1, "Customer Reference:"; Psf.custype$; Sermarked$
Lotempst$ = " N/A "
Lotempst$
= "=" + STR$(Psf.lotemp%
) + "DegC" Hitempst$ = " N/A "
PRINT #1, "Low Temp."; Lotempst$;
" Ambient Temp.=23DegC High Temp."; Hitempst$
FOR Setno%
= 0 TO Psf.numsets%
- 1 PRINT #1, "PARAMETER SET NUMBER"; Setno%;
" "; Psf.setlabel$
(Setno%
);
" "; Psf.numpars%
(Setno%
);
"Parameters:-" PRINT #1, " ============================================================================" PRINT #1, "[IND| PARAMETER | LOWER | UPPER | Nominal & Tol. | UNITS]" PRINT #1, "[---+-------------------------+----------+----------+-----------------+------]" FOR Paramno%
= 1 TO Psf.numpars%
(Setno%
) Labelst$ = Psfset(Setno%, Paramno%).Label
Unitsst$ = Psfset(Setno%, Paramno%).Units
Lowerst$
= STR$(Psfset
(Setno%
, Paramno%
).Lower
) Upperst$
= STR$(Psfset
(Setno%
, Paramno%
).Upper
) Lowval! = Psfset(Setno%, Paramno%).Lower
Upval! = Psfset(Setno%, Paramno%).Upper
Nominal! = (Round!(((Lowval! + Upval!) / 2), 4))
Toleranceval! = (Upval! - Lowval!) / 2
Tolst$ = "+->999"
Toleranceval!
= 100 * (Upval!
- Lowval!
) / 2 / ABS(Nominal!
) Tolst$ = "+-99.9%"
PRINT #1, "["; Indexst$;
"| ";
Char$
= MID$(Labelst$
, Charpos
, 1) Char$ = " "
PRINT #1, "|"; Lowerst$;
"|"; Upperst$;
"|"; Nomst$; Tolst$;
"| ";
Char$
= MID$(Unitsst$
, Charpos
, 1) Char$ = " "
PRINT #1, " ============================================================================"
'Display a tolerance report for the loaded PSF
PRINT "TOLERANCE REPORT for "; TType.number$;
" produced on "; British$
(DATE$);
" @ ";
LEFT$(TIME$, 5);
" Engineer:"; Psf.eng$
IF Psfoption$
= "HYPOTHETICAL" THEN PRINT "HYPOTHETICAL PSF - Generated for results analysis, not applied in testing." IF Psfoption$
= "PREVIOUS" THEN Prev.psf$ = " (PREVIOUS) Dated:"
Prev.psf$ = " Dated:"
PRINT "Program + "; Psf$;
SPACE$(19 - LEN(Psf$
));
"Issue:"; Psf.progiss$; Prev.psf$; Psf.progdate$
PRINT "Source:"; Psf.sourcename$;
" Issue:"; Psf.sourceiss$;
" Dated:"; Psf.sourcedate$
Sermarked$ = " Serial Marked"
Sermarked$ = " Not Serial Marked"
PRINT "Customer Reference:"; Psf.custype$; Sermarked$
Lotempst$ = " N/A "
Lotempst$
= "=" + STR$(Psf.lotemp%
) + "DegC" Hitempst$ = " N/A "
PRINT "Low Temp."; Lotempst$;
" Ambient Temp.=23DegC High Temp."; Hitempst$
FOR Setno%
= 0 TO Psf.numsets%
- 1 COLOR 14:
PRINT "PARAMETER SET NUMBER"; Setno%;:
COLOR 15:
PRINT " "; Psf.setlabel$
(Setno%
);
" "; Psf.numpars%
(Setno%
);
"Parameters:-" PRINT " ============================================================================" PRINT "[IND| PARAMETER | LOWER | UPPER | Nominal & Tol. | UNITS]" PRINT "[---+-------------------------+----------+----------+-----------------+------]" FOR Paramno%
= 1 TO Psf.numpars%
(Setno%
) Labelst$ = Psfset(Setno%, Paramno%).Label
Unitsst$ = Psfset(Setno%, Paramno%).Units
Lowerst$
= STR$(Psfset
(Setno%
, Paramno%
).Lower
) Upperst$
= STR$(Psfset
(Setno%
, Paramno%
).Upper
) Lowval! = Psfset(Setno%, Paramno%).Lower
Upval! = Psfset(Setno%, Paramno%).Upper
Nominal! = (Round!(((Lowval! + Upval!) / 2), 4))
Toleranceval! = (Upval! - Lowval!) / 2
Tolst$ = "+->999"
Toleranceval!
= 100 * (Upval!
- Lowval!
) / 2 / ABS(Nominal!
) Tolst$ = "+-99.9%"
PRINT "["; Indexst$;
"| ";
Char$
= MID$(Labelst$
, Charpos
, 1) Char$ = " "
PRINT "|"; Lowerst$;
"|"; Upperst$;
"|"; Nomst$; Tolst$;
"| ";
Char$
= MID$(Unitsst$
, Charpos
, 1) Char$ = " "
CALL State
("Press any key to continue."):
COLOR 15, 4 PRINT " ============================================================================" CALL State
("Press any key to continue."):
COLOR 15, 4
CALL State
("Working file not specified yet; select CHOOSE first. Press any key.") Pathname$ = Drive$ + ":" + Path$ + Psf$
Fileunfound% = RESETFLAG
IF Ask%
("Do you want to PRINT THIS REPORT") = YES
THEN State ("Printing Tolerance Report...")
State ("")
' Output all data to PSF file, which has already been opened as #3
DIM Psfparamst
AS Psfparamsttype
Psf.hitempst$
= STR$(Psf.hitemp%
) Psf.lotempst$
= STR$(Psf.lotemp%
) Psf.sermarkst$
= STR$(Psf.sermark%
) Psf.numspacesst$
= STR$(Psf.numspaces%
) PRINT #3, Psf.sourcename$:
PRINT #3, Psf.sourceiss$
PRINT #3, Psf.sourcedate$:
PRINT #3, Psf.amendrefs$
Psf.numsetsst$
= STR$(Psf.numsets%
) FOR Setno%
= 0 TO Psf.numsets%
- 1 Psf.numparsst$
= STR$(Psf.numpars%
(Setno%
)) PRINT #3, Psf.numspacesst$
FOR Setno%
= 0 TO Psf.numsets%
- 1 PRINT #3, Psf.setlabel$
(Setno%
) FOR Setno%
= 0 TO Psf.numsets%
- 1 FOR Paramno%
= 1 TO Psf.numpars%
(Setno%
) Psfparamst.Index
= STR$(Psfset
(Setno%
, Paramno%
).Index
) Psfparamst.Label = Psfset(Setno%, Paramno%).Label
Psfparamst.Units = Psfset(Setno%, Paramno%).Units
Lower.
val!
= (Psfset
(Setno%
, Paramno%
).Lower
* 10000) Lower.
val!
= Lower.
val!
+ .1 * SGN(Lower.
val!
) 'Eliminate rounding errors Psfparamst.Lower
= STR$(Lower.int&
) Upper.
val!
= (Psfset
(Setno%
, Paramno%
).Upper
* 10000) Upper.
val!
= Upper.
val!
+ .1 * SGN(Upper.
val!
) 'Eliminate rounding errors Psfparamst.Upper
= STR$(Upper.int&
) PRINT #3, Psfparamst.Index
PRINT #3, Psfparamst.Label
PRINT #3, Psfparamst.Units
PRINT #3, Psfparamst.Lower
PRINT #3, Psfparamst.Upper
' UTILs _____________________________________________________________________________________
'Prompt for Y / N response
Valid% = NO
PRINT Question$;
"? (Y/N) ";
Valid% = YES
Ask% = YES
Ask% = NO
Valid% = NO
'Converts "m[m]{-./}d[d]{-./}yy[yy]" to "dd/mm/yy[yy]"
Month%
= VAL(LEFT$(Indate$
, (Delim
- 1))) Indate$
= RIGHT$(Indate$
, (LEN(Indate$
) - Delim
)) British$ = d$ + "/" + m$ + "/" + y$
FUNCTION Checkint%
(Value%
, Lolim%
, Hilim%
) IF Value%
< Lolim%
OR Value%
> Hilim%
THEN Checkint% = NO
Checkint% = YES
FUNCTION Checkreal%
(Value!
, Lolim!
, Hilim!
) IF Value!
< Lolim!
OR Value!
> Hilim!
THEN Checkreal% = NO
Checkreal% = YES
'Converts a number of days since 30/12/1899 (Quattro pro ref) into a date
'string. Output date string is DD/MM/YYYY
Indate& = Inputdate& + 364
Numdays(1) = 31
Numdays(2) = 28
Numdays(3) = 31
Numdays(4) = 30
Numdays(5) = 31
Numdays(6) = 30
Numdays(7) = 31
Numdays(8) = 31
Numdays(9) = 30
Numdays(10) = 31
Numdays(11) = 30
Numdays(12) = 31
'Derive date from input number of days past reference
Year% = 1899
Indate& = Indate& - 366
Indate& = Indate& - 365
Year% = Year% + 1
Numdays(2) = 29
Indate& = 1
Year% = Year% + 1
Month% = 1
WHILE Indate&
> Numdays
(Month%
) Indate& = Indate& - Numdays(Month%)
Month% = Month% + 1
Day% = Indate&
'Construct date$
Datestr$ = d$ + "/" + m$ + "/" + y$
'Converts a date string into number of days since 30/12/1899 (Quattro-Pro ref) 1/1/1899
'Input date string is DAY/MONTH/YEAR, DAY.MONTH.YEAR or DAY-MONTH-YEAR
'where DAY and MONTH are 1 or 2 digits and YEAR is 2 or 4 digits
'A 2-digit year is interpreted as being between 1951 and 2050. Dates outside
'this range and invalid dates return error code (-1).
Indate$ = Inputdate$
Numdays(1) = 31
Numdays(2) = 28
Numdays(3) = 31
Numdays(4) = 30
Numdays(5) = 31
Numdays(6) = 30
Numdays(7) = 31
Numdays(8) = 31
Numdays(9) = 30
Numdays(10) = 31
Numdays(11) = 30
Numdays(12) = 31
'Extract days, months and years from Indate$
Indate$
= RIGHT$(Indate$
, (LEN(Indate$
) - Delim
)) Year% = Year% + 2000
Year% = Year% + 1900
'Convert date to number of days since reference
Daycount& = 0
IF Year%
< 1951 OR Year%
> 2050 OR Month%
< 1 OR Month%
> 12 THEN Daycount& = -1
IF Day%
> 29 THEN Daycount&
= -1 IF Day%
> Numdays
(Month%
) THEN Daycount&
= -1 IF Day%
< 1 THEN Daycount&
= -1 FOR I
= 1899 TO Year%
- 1 Daycount& = Daycount& + 365
Daycount& = Daycount& + 1
Daycount& = Daycount& + Numdays(I)
IF Month%
> 2 THEN Daycount&
= Daycount&
+ 1 Daycount& = Daycount& + Day%
Dateval& = Daycount& - 364
Dateval& = -1
'Check whether (first 3 chars of) Extension$ is a valid DOS filename extension
Check.ext$ = Extension$
Check.ext$
= Check.ext$
+ SPACE$(3 - LEN(Extension$
)) Check.ext$
= LEFT$(Check.ext$
, 3) Valid% = YES
Validchar% = NO
X% = C%(n%)
IF X%
= 33 OR (X%
> 34 AND X%
< 42) OR X%
= 45 OR (X%
> 47 AND X%
< 58) THEN Validchar%
= YES
IF (X%
> 63 AND X%
< 91) OR (X%
> 93 AND X%
< 124) OR X%
= 125 OR X%
= 126 THEN Validchar%
= YES
IF n%
> 1 AND X%
= 32 THEN Validchar%
= YES
'Allow trailing spaces IF Validchar%
= NO
THEN Valid%
= NO
'IF Valid% = NO THEN SOUND 400, 1
Dosvalid% = Valid%
' Strip leading, trailing and all contained spaces and convert to upper case
' (see Plain$)
Blanksin% = YES
Spacepos%
= INSTR(Temp$
, " ") Leftbit$
= LEFT$(Temp$
, Spacepos%
- 1) Rightbit$
= RIGHT$(Temp$
, LEN(Temp$
) - Spacepos%
) Temp$ = Leftbit$ + Rightbit$
Blanksin% = NO
Noblanks$ = Temp$
IF TIMER < Start.time
THEN Start.time
= Start.time
- 24 * 3600 'IF MIDNIGHT HAPPENS
' Strip leading & trailing spaces and convert to upper case (see Noblanks$)
'Derives a Quattro-pro date value from an HP Basic TIMEDATE value.
Qpwdate&
= INT(Intimedate!
/ 86400 - 2415019)
'Derives a Quattro-pro time value from an HP Basic TIMEDATE value.
Qpwtime#
= (Intimedate#
/ 86400) - INT(Intimedate#
/ 86400)
'Round Value! to Dec% DP, max 4 DP
Power.ten! = 10 ^ Dec%
Decimal.part!
= Value!
- FIX(Value!
) IF Power.ten!
<> 0 THEN Decimal.part!
= CINT(Decimal.part!
* Power.ten!
) / Power.ten!
Round!
= Integer.part!
+ Decimal.part!
'Display single line prompt
FUNCTION Timedate!
(Inqpwdate&
, Inqpwtime!
) 'Converts a Quattro-pro date and time value to the corresponding HP Basic
'TIMEDATE value.
Timedate! = (Inqpwdate& + 2415019 + Inqpwtime!) * 86400
'Converts a fraction of a day (Quattro pro format) into a time string.
'Output time string is HH:MM:SS. Conversion accuracy +/- 1 Sec.
Inputhours!
= (Inputtime#
- INT(Inputtime#
)) * 24 Min%
= INT((Inputhours!
- Hour%
) * 60) Sec%
= INT(((Inputhours!
- Hour%
) * 60 - Min%
) * 60)
'Construct time$
Timestr$ = h$ + ":" + m$ + ":" + s$
' If inflag is logic (1 / 0) then its complement is returned.
Toggle% = 1
Toggle% = 0
Toggle% = Inflag%
'Wait for keypress then continue
Pause (.1) ' Delay to avoid keybounce
Pause (.1) ' Delay to avoid keybounce
'Display single line prompt