GET_SWITCH: PROC(SWITCHES,SWITCH_VALUES) RETURNS(FIXED BIN(31)); DCL SWITCHES(4) BIT(1), SWITCH_VALUES(4) CHAR(20) VARYING, INSTRING CHAR(255), CMDSTRING CHAR(255) VARYING, (E,I,J,K,L,M,N,V) FIXED BIN, POLARITY BIT(1), SWITCH CHAR(20) VARYING, SWITCH_VALUE CHAR(20) VARYING, MAX_SWITCH STATIC FIXED BIN INIT(4), DEFAULT_SWITCHES(4) BIT(1) STATIC INIT('0'B, '0'B, '1'B, '0'B), SWITCH_NAMES(4) CHAR(20) STATIC INIT('REPEAT', 'SYSTEM', 'INTERACTIVE', 'SELF'); %INCLUDE 'SYSDCL'; DCL LIB$GET_FOREIGN ENTRY( CHAR(*)) /*RETURNED STRING*/ RETURNS(FIXED BIN(31)); DCL EDIT ENTRY(CHAR(*),FIXED BIN) RETURNS (CHAR(255) VARYING); BUG: PROC(D); DCL (D,E) FIXED BIN(31), LEN FIXED BIN(15), MESG CHAR(256); IF D=SS$_NORMAL THEN GO TO NOP; E=SYS$GETMSG(D,LEN,MESG,,); IF E^=SS$_NORMAL THEN PUT SKIP LIST('HELP! E=',E); PUT SKIP LIST(SUBSTR(MESG,1,LEN) ); NOP: END; SWITCHES=DEFAULT_SWITCHES; DO I=1 TO MAX_SWITCH; SWITCH_VALUES(I)=''; END; E=LIB$GET_FOREIGN(INSTRING); CALL BUG(E); CMDSTRING=EDIT(INSTRING,1+2+4+32);/*Squeeze out superfluity*/ DO I=1 REPEAT(J) WHILE(INDEX(SUBSTR(CMDSTRING,I),'/')>0 & I0 THEN J=J+I; ELSE J=LENGTH(CMDSTRING)+1; SWITCH=SUBSTR(CMDSTRING,I+1,J-I-1); IF INDEX(SWITCH,'NO')=1 THEN DO; POLARITY='0'B; SWITCH=SUBSTR(SWITCH,3); END; ELSE POLARITY='1'B; V=INDEX(SWITCH,'='); IF V>0 THEN DO; SWITCH_VALUE=SUBSTR(SWITCH,V+1); SWITCH=SUBSTR(SWITCH,1,V-1); END; ELSE SWITCH_VALUE=''; N=0; IF LENGTH(SWITCH)>0 THEN DO K=1 TO MAX_SWITCH; IF INDEX(SWITCH_NAMES(K),SWITCH)=1 THEN DO; N=N+1; M=K; END; END; IF N=1 THEN DO; SWITCHES(M)=POLARITY; SWITCH_VALUES(M)=SWITCH_VALUE; END; END; RETURN(SS$_NORMAL); END;