.TITLE CSISW .IDENT /V3.2/ ; ;+ ; ; CSISW - Create switch descriptor table entry with optional ; switch value table. ; ; Provides FORTRAN access to the system command string ; interpreter routines. (See also CSI.MAC and CSISW.MAC) ; ; CALL CSISW (STABLE,ISW,MASK,NEGFLG) ; CALL CSISW (STABLE,ISW,MASK,NEGFLG,VTABLE) ; ; STABLE = Switch table on first call or offset in ; switch table on subsequent calls. Allow four ; words per entry (one entry per call) plus a ; one word trailer for the whole table. ; ISW = 2 character ASCII switch code. The switch ; table is set up to match any characters after ; the first two, e.g., /LIST will match LI. ; MASK = One word bit mask to indicate the presence of ; the switch in the command line and its polarity ; (/LI vs. /NOLI) when the command line is parsed ; (see CSI.MAC). Exactly one bit must be on. ; NEGFLG = Flag to indicate that negation is allowed: ; 0 = /NOSW not allowed, ^0 = /NOSW allowed ; VTABLE = Optional switch value table filled in by CSISV. ; ;- ; .PSECT CSISW,RO CSISW:: MOVB (R5)+,R4 ; Get argument count INC R5 ; (only low byte is valid) ; ; Process switch table parameters ; MOV (R5)+,R0 ; Get switch table address MOV @(R5)+,(R0) ; Load switch characters BIC #100200,(R0)+ ; Clear high sign bit for last char, ; clear low sign bit for noexact match MOV @(R5)+,(R0)+ ; Load mask word CLR (R0)+ ; No optional user mask word CLR (R0) ; No switch value table yet TSTB @(R5)+ ; Negative switch allowed? BEQ 10$ ; No, skip this section INC (R0) ; Yes, set neg flag bit 10$: CMPB #4,R4 ; Switch value table supplied? BGE 50$ ; No, finish up ; ; Include switch value table (Don't touch R0!) ; BIS (R5),(R0) ; "OR" addr of switch value ; table with neg flag ; ; Common exit -- R0 -> neg flag word ; 50$: CLR 2(R0) ; Show this is the end of the table RETURN ; Return to caller .END