! ! MetroScript file 'Conv_Patt.scr' ! ! 1/12/98 mdc New file. ! ! This script will save the pattern status to a temp file, ! then convert this (using the CONV_PATT subroutine) into a pattern position ! file including only the failed or unmeasured locations. ! Then the new pattern position file is loaded, and the pattern is run. ! In this way only the locations that passed, or were excluded on the ! first run are NOT re-run. ! ! NOTE: the control: New Control -> Pattern -> Pattern Number must be ! set to something other than zero. ALSO: this script changes ! the pattern position that is being used by the Pattern Editor. ! The user of this script is responsible for restoring this. ! dim PatStatFn$[50] dim PatPosFn$[50] dim msg$[100] ! Convert_Patt: ! PatStatFn$ = "tmp_pat.stat" ! pattern status input PatPosFn$ = "tmp_pat.pos" ! pattern position output ! ! save the pattern status into a temp file: ./tmp_pat.stat ! on error goto FILE_SAVE_ERROR savepatstatus( PatStatFn$ ) gosub CONV_THE_PATT ! ! load the new pattern position file ! on error goto FILE_LOAD_ERROR loadpatpos( PatPosFn$ ) ok = execute("rm -f " & PatPosFn$ ) ! ! run the pattern ! runpattern goto CONVERT_EXIT ! ! FILE_SAVE_ERROR: msg$ = " Could not save temp file in this directory " ok = dialog(msg$, 2) goto CONVERT_EXIT ! FILE_LOAD_ERROR: msg$ = " Could not load temp file: " & PatPosFn$ & " " ok = dialog(msg$, 2) goto CONVERT_EXIT ! CONVERT_EXIT: ! end CONV_THE_PATT: dim InStr$[100] ! input string dim OutStr$[100] ! output string dim InChar$[1] ! input character dim OutChar$[1] ! output character off error assign @inf to PatStatFn$ "r" assign @outf to PatPosFn$ "w" on error goto NO_MORE_LINES_LEFT enter @inf; InStr$ ! read first 2 lines and output output @outf; InStr$ enter @inf; InStr$ ! read first 2 lines and output output @outf; InStr$ for i = 1 to 200 ! run till there is no more index = 1 OutStr$ = "" enter @inf; InStr$ strlen = len(InStr$) ! ! loop past the index number ! LOOP_TILL_NO_NUM: InChar$ = InStr$[index,index] OutStr$ = OutStr$ & InChar$ index = index + 1 if (InChar$ <> " ") then goto LOOP_TILL_NO_NUM ! ! process the remainder of the file ! for j = index to strlen ! first char is a number InChar$ = InStr$[j,j] if (InChar$ = " ") then OutChar$ = " " else if ((InChar$ = "X" ) OR (InChar$ = "P")) then OutChar$ = "X" else OutChar$ = "I" endif endif OutStr$ = OutStr$ & OutChar$ next j output @outf; OutStr$ next i NO_MORE_LINES_LEFT: assign @inf to "" assign @outf to "" off error return