DECsystem-20 SIMULA %4A(310) 1-FEB-1981 14:49 PAGE 1 DSK:DECOM.SIM 11-FEB-1976 19:00 1 OPTIONS(/L/E); !/C/-A/-I/-D); 2 EXTERNAL TEXT PROCEDURE rest, scanto, frontstrip, upcase, 3 front, conc, checkextension; 4 EXTERNAL REF (Infile) PROCEDURE findinfile; 5 EXTERNAL REF (Outfile) PROCEDURE findoutfile; 6 EXTERNAL BOOLEAN PROCEDURE frontcompare; 7 EXTERNAL CHARACTER PROCEDURE findtrigger; 8 EXTERNAL INTEGER PROCEDURE scanint, search; 9 EXTERNAL LONG REAL PROCEDURE scanreal; 10 EXTERNAL PROCEDURE split; 11 EXTERNAL CLASS safmin; 12 13 COMMENT DECOM --- Interpret user command with files and switches.; 14 15 safmin CLASS decom(limit); INTEGER limit; B1 16 BEGIN 17 TEXT ARRAY swarray[1:limit]; 18 TEXT dottext, colontext, switchchar, equal; 19 INTEGER nswin, nswout, i; 20 21 BOOLEAN PROCEDURE deccom(command,ohead,ihead); 22 NAME ohead,ihead; 23 TEXT command,ohead,ihead; B2 24 BEGIN TEXT outspec,inspec; 25 INTEGER switchcount,i,noutswitches; 26 27 TEXT PROCEDURE getswitch(t); NAME t; TEXT t; B3 28 BEGIN TEXT s; 29 split(rest(t),s,switchchar,t); 30 IF s == NOTEXT THEN B4 31 BEGIN Outtext("%DECSWV - Switch Without Value."); 32 Outimage; deccom:= FALSE; E4 33 END; 34 getswitch:- s E3 35 END of getswitch; 36 37 INTEGER PROCEDURE collectswitch(t,header); 38 NAME header; TEXT t,header; B5 39 BEGIN 40 header:- scanto(t,'/'); 41 WHILE t.More DO B6 42 BEGIN 43 IF switchcount >= limit THEN B7 44 BEGIN Outtext("%DECTMS - Too Many Switches."); 45 deccom:= FALSE; Outimage; GO TO exit E7 46 END; 47 switchcount:= switchcount + 1; 48 swarray[switchcount]:- getswitch(t); E6 49 END; 50 exit: 51 collectswitch:= switchcount E5 52 END of collectswitch; DECsystem-20 SIMULA %4A(310) 1-FEB-1981 14:49 PAGE 1-1 DSK:DECOM.SIM 11-FEB-1976 19:00 53 54 deccom:= TRUE; 55 OPTIONS(/A); swarray[1]:- swarray[1]; 56 swarray[limit]:- swarray[limit]; 57 COMMENT OPTIONS(/-A); 58 59 split(command,outspec,equal,inspec); 60 noutswitches:= 61 switchcount:= collectswitch(outspec,ohead); 62 switchcount:= collectswitch(inspec ,ihead); 63 nswin:= switchcount - noutswitches; 64 nswout:= noutswitches; 65 E2 66 END of deccom; 67 68 OPTIONS(/p); DECsystem-20 SIMULA %4A(310) 1-FEB-1981 14:49 PAGE 2 DSK:DECOM.SIM 11-FEB-1976 19:00 69 PROCEDURE createfiles(ohead,ihead,oextension,iextension, 70 ofile,ifile,help); 71 NAME ohead,ihead,ofile,ifile,help; 72 TEXT ohead, ihead, oextension, iextension; 73 REF (Outfile) ofile; REF (Infile) ifile; 74 BOOLEAN help; B8 75 BEGIN 76 REF (Outfile) ofile2; REF (Infile) ifile2; 77 78 ihead:- checkextension(ihead,iextension); 79 ohead:- checkextension(ohead,oextension); 80 FOR ifile2:- findinfile(ihead) WHILE ifile2 == NONE DO B9 81 BEGIN Outtext("%DECCFI - Cannot Find Infile:"); 82 Outtext(ihead); Outimage; 83 request("Enter new infile spec: ",nodefault, 84 textinput(ihead,TRUE),NOTEXT,help); E9 85 END check infile; 86 87 IF ohead = "TTY:" THEN ofile2:- Sysout ELSE 88 FOR ofile2:- findoutfile(ohead) WHILE ofile2 == NONE DO B10 89 BEGIN Outtext("?DECIOS Illegal Outfile Spec:"); 90 Outtext(ohead); Outimage; 91 request("Enter new outfile spec: ",nodefault, 92 textinput(ohead,TRUE),NOTEXT,help); E10 93 END check outfile; 94 95 ifile:- ifile2; ofile:- ofile2; 96 E8 97 END of procedure create_files; 98 OPTIONS(/p); DECsystem-20 SIMULA %4A(310) 1-FEB-1981 14:49 PAGE 3 DSK:DECOM.SIM 11-FEB-1976 19:00 99 100 101 PROCEDURE intswitch(id,default,result,okay,errmess,help); 102 NAME default, id, result, okay, errmess, help; 103 TEXT default, id, errmess; INTEGER result; BOOLEAN okay, help; B11 104 BEGIN 105 TEXT sw; 106 FOR i:= nswin+nswout STEP -1 UNTIL 1 DO 107 IF frontcompare(swarray[i],id) THEN B12 108 BEGIN 109 sw:- swarray[i]; sw.Setpos(1); scanto(sw,':'); 110 swarray[i]:- NOTEXT; 111 GO TO out E12 112 END; 113 IF default == NOTEXT THEN GOTO askforvalue ELSE 114 sw:- Copy(default); 115 out: 116 result:= scanint(sw); 117 IF NOT okay THEN B13 118 BEGIN 119 Outtext("?DECISV - Illegal Switch Value /"); Outtext(id); 120 Outchar(':'); Outint(result,8); Outimage; 121 outline(errmess); 122 askforvalue: request(id,default,intinput(result,okay),errmess,help); E13 123 END; E11 124 END of intswitch; 125 126 127 BOOLEAN PROCEDURE boolswitch(id,okay,errmess,help); 128 NAME id, okay, errmess, help; 129 TEXT id, errmess; BOOLEAN okay, help; B14 130 BEGIN 131 TEXT sw; BOOLEAN result; 132 FOR i:= nswin+nswout STEP -1 UNTIL 1 DO 133 IF frontcompare(swarray[i],id) THEN B15 134 BEGIN 135 result:= TRUE; 136 swarray[i]:- NOTEXT; 137 WHILE result AND NOT okay DO B16 138 BEGIN 139 Outtext("?DECISV - Illegal Switch Value: /"); Outtext(id); 140 Outimage; 141 outline(errmess); 142 request(id,"NO",boolinput(result),errmess,help); E16 143 END; 144 out: E15 145 END; 146 out: 147 boolswitch:= result; E14 148 END of boolswitch; 149 150 DECsystem-20 SIMULA %4A(310) 1-FEB-1981 14:49 PAGE 3-1 DSK:DECOM.SIM 11-FEB-1976 19:00 151 BOOLEAN PROCEDURE illegalswitch(errmess,help); 152 NAME errmess, help; TEXT errmess; BOOLEAN help; B17 153 BEGIN 154 FOR i:= nswin+nswout STEP -1 UNTIL 1 DO B18 155 BEGIN 156 IF swarray[i] =/= NOTEXT THEN B19 157 BEGIN 158 upcase(swarray[i]); swarray[i].Setpos(1); 159 IF swarray[i].Getchar = '?' OR swarray[i] = "H" 160 OR swarray[i] = "HE" OR 161 swarray[i] = "HEL" OR swarray[i] = "HELP" THEN B20 E20 162 BEGIN IF help THEN ; END ELSE B21 163 BEGIN 164 Outtext(errmess); Outtext(swarray[i]); 165 Outimage; E21 166 END; 167 illegalswitch:= TRUE; E19 168 END; E18 169 END; E17 170 END; 171 172 dottext:- Copy(".:/="); 173 equal:- dottext.Sub(4,1); 174 switchchar:- dottext.Sub(3,1); 175 colontext:- dottext.Sub(2,1); 176 dottext:- dottext.Sub(1,1); 177 E1 178 END of decom; SWITCHES CHANGED FROM DEFAULT: E EXTERNAL CLASS/PROCEDURE NEW ATR FILE GENERATED RECOMPILE DEPENDENT PROGRAMS NO ERRORS DETECTED