.TITLE FIXUP .IDENT /Y01.3/ ; ; this is derived from an original in fortran (now deceased) so excuse ; the odd names for psects, varaibles etc. please. ; ; ; This module fixes up the parameters in the final output line ; from the parameter specifications answered in return to ; questions or on the initial command line. ; .PSECT .$$$$.,rw,d,con,ovr,gbl PARAMS: .word 0 ;max # params to question for MCRL: .word 0 ;length of mcr initial line KEYL: .word 0 ;length of keyword typed MCR: .blkb 80. ;command line typed by user KEYB: .blkb 8. ;text of typed keyword P: .blkb 416 ;parameter block space CMD: .blkb 80. ;output command line ( space to build it) .PSECT $VARS,RW,D,CON,LCL SEEN: .BYTE 0 ;this is 0 if no explicent extender ;field is matched, -1 if it is. The extender ;field is that field which will be added by ;default to a pararmeter if the initial char ; is not matched in the parameter ;If it is matched then the default will not ;be added DEFCH: .BYTE 0 ;This is the character at the start ;which determines the match .PSECT $CODE1,rw,i,con,lcl ; AT this point all the parameters in the array should ; have any value they will finally take ; The array P is a fortran array (9,30) bytes which contains ; as the initial bytes for each of the 9 parameters the ; the character text of all parameters ; The character text is terminated on a null FIXUP:: ; 0007 ; Entry here occurs for each occurance ofthe parameter flag ; characeter "%" in the skeleton line which at this phase of ; proessing lies in the MCR buffer since tghat information has been ; dealt with. ; The routine maintains R3 as the pointer to a word which is the ; the poiinter into the skeleton in the MCR buffer ; and R4 as the pointer to a word which is the pointer into the ; new command buffer which is being created. CLRB SEEN ;say not seen extender delimiter yet MOV 2(R5),R3 ;GET ADDRESS OF word pointer in skeleton MOV 4(R5),R4 ; and pointer to result INC (R3) ;skip over "%" that caused call MOV (R3),R2 ;get pointer value MOVB MCR-1(R2),R2 ;and character from there ;should be param # 1-9 SUB #60,R2 ;try it as number -"0" BLE L$HACP ;<="0" then not number CMP R2,#11 ;>"9" BLE L$HAIJ ;a valid # I say L$HACP: ;error go look for better at end BR .12 L$HAIJ: MOV R2,R1 ;check for a null parameter in which case entire ;parameter spec is skipped MUL #36,R1 TSTB P-36(R1) BEQ .10 ; null parameter skip to "%" ; now check for a prefix character %n,xxxxxxx% or %n=xxxxxx% ; if either we insert the prefix characeter now becasue we know ; the parameter is non null MOV #1,R5 MOV (R3),R0 CMPB MCR(R0),#', BEQ L$HAFL CMPB MCR(R0),#'= BNE .5 ; here there is a prefix characetr insert it L$HAFL: INC (R3) MOV (R3),R0 MOV (R4),R1 MOVB MCR-1(R0),CMD-1(R1) INC (R4) .5: ; here we set the default starter character for an extender field ; into defch MOV (R3),R0 MOVB MCR(R0),DEFCH .1: ;get the next character from the parameter MOV R2,R1 MUL #36,R1 ADD R5,R1 TSTB P-37(R1) ;if null,parameter is ended - go check for extenders BEQ .2 MOV (R4),R0 MOVB P-37(R1),CMD-1(R0) ;copy the parameter character ;if it matches the default starter then default is not wanted ;so set default extender seen CMPB CMD-1(R0),DEFCH BNE L$HAAN MOVB #-1,SEEN L$HAAN: INC (R4) INC R5 BR .1 ; parameter is done, is extender field required .2: INC (R3) MOV (R3),R0 CMPB MCR-1(R0),#'% ; there is no extender field to give anyway %n{,or=ornull}% BEQ L$HAIP TSTB SEEN ;if extender still wanted then go to l$hagn BPL L$HAGN L$HAIP:BR .10 ;go skip to % L$HAGN: .6: ;add default extender until we reach '%' MOV (R3),R0 MOV (R4),R1 MOVB MCR-1(R0),CMD-1(R1) INC (R4) INC (R3) MOV (R3),R0 CMPB MCR-1(R0),#45 BNE .6 ; here skip until (r3) points to '%' in skeleton .10: MOV (R3),R0 CMPB MCR-1(R0),#'% ;found end of parameter BEQ .11 INC (R3) BR .10 .12: ; out of range for 1-9 is it %$ meaning altmode/escape MOV (R3),R0 CMPB MCR-1(R0),#'$ BNE .11 MOV (R4),R0 MOVB #33,CMD-1(R0) INC (R4) ; here we skip final '%' in skeleton and return to mainline .11: INC (R3) RTS PC .END