.TITLE FIXUP .IDENT /Y01.4/ ; ; 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. ; NOSTOP::.WORD 0 ; DO NOT STOP FOR EFN1 IF SET ; JGD ; IS SET IF %$% TERMINATES LINE ; JGD .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) PMIN: .WORD 0 ; SAVE PLACE TO KEEP COMMONS ALLIGNED EXSTAT: .WORD 1 ; TO KEEP COMMONS ALLIGNED ; JGD DUIC: .WORD 0 TERMIN: .BYTE 0 ;TERMINAL CHAR 1 IE V OF VT .BYTE 0 ; ............ 2 IE T OF VT UNIT: .BYTE 0 ;UNIT # IE 1 IF VT1 .BLKB 9. ; HOLD REST OF SPACE CLAIMED BY GLBUF .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 .101 MOV (R4),R0 MOVB #15,CMD-1(R0) ; MOVE IN SO IT WILL PROMPT ; JGD INC (R4) INC NOSTOP ; DO NOT STOP CCL UNTIL COMMAND TO EXITS; JGD BR .11 .101: CMPB MCR-1(R0),#'% ;was it %% meaning % BNE .102 MOV (R4),R0 MOVB #'%,CMD-1(R0) INC (R4) BR .11 .102: CMPB MCR-1(R0),#'G BNE .103 MOVB DUIC+1,R1 BR .103X .103: CMPB MCR-1(R0),#'M BNE .104 MOVB DUIC,R1 .103X: MOV (R4),R0 ADD #CMD-1,R0 MOV PC,R2 CALL $CBTMG ADD #3,(R4) BR .11 .104: CMPB MCR-1(R0),#'U BNE .105 MOV R3,-(SP) MOV DUIC,R3 MOV (R4),R2 ADD #CMD-1,R2 MOV R4,-(SP) MOV R2,-(SP) CLR R4 CALL .PPASC SUB (SP)+,R2 MOV (SP)+,R4 MOV (SP)+,R3 ADD R2,(R4) BR .11 .105: CMPB MCR-1(R0),#'T BNE .11 MOV (R4),R0 ADD #CMD-1,R0 MOV #11010,R2 MOV R0,-(SP) MOVB TERMIN,(R0)+ MOVB UNIT,R1 MOVB UNIT,R2 ASR R2 ASR R2 ASR R2 ;div by 8 BIC #177770,R2 ;range 0-7 BIC #177770,R1 TST R2 BEQ 1$ ADD #'0,R2 MOVB R2,(R0)+ 1$: ADD #'0,R1 MOVB R1,(R0)+ SUB (SP)+,R0 ADD R0,(R4) ; here we skip final '%' in skeleton and return to mainline .11: INC (R3) RTS PC .END