summaryrefslogtreecommitdiff
path: root/system/printer-laser/4/src/laser.inserter
blob: c28766fdb8bcca4b5f5fd36495b7a630cf9773d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
PACKET laserdrucker inserter DEFINES treiber einrichten : 
 
(**************************************************************************)
(*   Installationsprogramm                        Stand   : 12.12.88      *)
(*   für Tintenstrahl-                            Version : 0.9           *)
(*   und Laserdrucker                             Autor   : hjh           *)
(**************************************************************************)
 
LET anzahl firmen = 6 ; 
LET apple = "APPLE" , 
    canon = "CANON" , 
    epson = "EPSON" , 
    hp    = "HEWLETT PACKARD" , 
    kyo   = "KYOCERA" , 
    nec   = "NEC" ; 
 
THESAURUS VAR firmen := empty thesaurus ; 
 
INT VAR i ; 
ROW anzahl firmen THESAURUS VAR drucker ; 
FOR i FROM 1 UPTO anzahl firmen REP 
  drucker (i) := empty thesaurus 
PER ;
ROW anzahl firmen THESAURUS VAR printer ; 
FOR i FROM 1 UPTO anzahl firmen REP 
  printer (i) := empty thesaurus 
PER ;
ROW anzahl firmen THESAURUS VAR fonttables ; 
FOR i FROM 1 UPTO anzahl firmen REP 
  fonttables (i) := empty thesaurus 
PER ;
 
liste (apple,"LASERWRITER","printer.apple.laserwriter","fonttab.apple.laserwriter"); 
liste (canon , "LBP-8"    ,"printer.canon.lbp-8"      ,"fonttab.canon.lbp-8"); 
liste (epson , "SQ 2500"  ,"printer.epson.sq"         ,"fonttab.epson.sq"); 
liste (hp , "HP LASERJET" ,"printer.hp.laserjet"      ,"fonttab.hp.laserjet"); 
liste (hp , "HP LASERJET+" ,"printer.hp.laserjet"      ,"fonttab.hp.laserjet"); 
liste (kyo , "F-1010"     ,"printer.kyocera.f-1010"   ,"fonttab.kyocera.f-1010"); 
liste (kyo , "F-2200"     ,"printer.kyocera.f-1010"   ,"fonttab.kyocera.f-1010"); 
liste (nec , "SILENTWRITER LC-08"      ,"printer.nec.lc-08"
,"fonttab.nec.lc-08"); 

treiber einrichten;
 
PROC liste (TEXT CONST firmenname, druckername , 
                        printername, fonttabname ) : 
  INT VAR firmnum ; 
  IF firmen CONTAINS firmenname 
    THEN firmnum := link (firmen,firmenname) 
    ELSE insert (firmen,firmenname,firmnum) 
  FI; 
  insert (drucker(firmnum), druckername) ; 
  insert (printer(firmnum), printername) ; 
  insert (fonttables(firmnum), fonttabname) ; 
END PROC liste ;
 
PROC treiber einrichten : 
  INT VAR menu phase := 1 ; 
  BOOL VAR installed := FALSE ; 
  BOOL VAR was esc ; 
  INT VAR firmnum, druckernum ;
  TEXT VAR firmenname, druckername, printername, fonttabname ;
 
  pre menu ;
  REP 
    SELECT menu phase OF 
      CASE 1 : menu ("Hauptmenü Tintenstrahl und Laserdrucker", firmen, 
                     "CR: Eingabe        ESC : Installation abrechen", 
                     firmnum, was esc ) ;
               IF was esc 
                 THEN menu phase := 0 
                 ELSE menu phase := 2 ; 
                      firmenname := name (firmen,firmnum) ;
               FI ;
  
      CASE 2 : menu (firmenname + " - Menü", drucker(firmnum),
                     "CR: Eingabe        ESC : Zurück zum Hauptmenü",      
                     druckernum, was esc) ;
               IF was esc 
                 THEN menu phase := 1 
                 ELSE menu phase := 3 ; 
                      druckername := name (drucker(firmnum),druckernum);  
                      printername := name (printer(firmnum),druckernum); 
                      fonttabname := name (fonttables(firmnum),druckernum); 
               FI;
 
      CASE 3 : inst (druckername, printername, fonttabname, installed) ; 
               IF NOT installed THEN menu phase := 1 FI;
    END SELECT 
  UNTIL installed OR abbruch PER ;
  post menu. 
 
  abbruch: 
    menu phase < 1 .
 
  pre menu: 
    line; 
    IF is single task system
      THEN errorstop ("Dieser Treiber arbeitet nur mit Multi-Tasking-EUMEL") 
    FI; 
    IF NOT is system task (myself)
      THEN errorstop ("Die Druckertask muß im Systemzweig angelegt werden") 
    FI; 
    command dialogue (TRUE);
    IF name (myself) <> "PRINTER" 
      THEN putline ("Diese Task heißt nicht ""PRINTER"", sondern """ + 
                    name (myself) + """ !"); 
           IF yes ("Soll die Task in ""PRINTER"" umbenannt werden ?") 
             THEN rename myself ("PRINTER") 
           FI 
    FI. 
 
  is single task system:  (pcb (9) AND 255) = 1.
 
  post menu: 
   IF NOT installed 
    THEN page; 
         putline ("Es ist kein Druckertreiber installiert worden!"); 
         line; 
         putline ("Wenn dieses Installationsprogramm insertiert wurde,");
         putline ("kann es in der Task """ + name (myself) + """ "); 
         putline ("mit 'treiber einrichten' erneut aufgerufen werden."); 
         line; 
   FI. 
 
END PROC treiber einrichten ;
 
PROCEDURE menu (TEXT CONST header, THESAURUS CONST items, TEXT CONST bottom, 
                INT VAR choice, BOOL VAR was esc) : 
  INT VAR anzahl ; 
  page; 
  headline (header) ; 
  show list (items,anzahl) ; 
  bottomline (bottom) ;
  ask user (anzahl,choice,was esc);  
END PROC menu ;
 
PROC headline (TEXT CONST header): 
  cursor (13,1); 
  putline ("E U M E L - Druckertreiber - Installations - Programm"); 
  cursor (40 - LENGTH header DIV 2, 2); 
  IF header <> "" THEN put (header) FI ;
  line (2) 
END PROC headline; 
 
PROC bottomline (TEXT CONST bottom): 
  cursor (1,24); 
  IF bottom <> "" THEN put (""5"" + bottom) FI ;
END PROC bottomline; 
 
PROC show list (THESAURUS CONST items , INT VAR anzahl ) : 
  INT VAR i ; 
  anzahl := highest entry (items);
  FOR i FROM 1 UPTO anzahl REP 
    putline ( text(i) + ".  " + name (items,i) ) ; 
  PER;
END PROC show list ;
 
PROC ask user (INT CONST max choice, INT VAR choice, BOOL VAR was esc): 
  TEXT VAR exit; 
  TEXT VAR inp := "";
  REP 
    cursor (1,23); 
    IF inp = "" 
      THEN put ("Ihre Wahl (Nummer eingeben):")
      ELSE put ("FEHLER! Eingabe korrigieren:")
    FI; 
    editget (inp, ""27"", "", exit); 
    was esc :=  exit = ""27"";
  UNTIL was esc OR ok PER. 
 
  ok: 
    choice := int (inp) ; 
    last conversion ok CAND ( choice > 0 AND choice <= max choice) . 
END PROC ask user; 
 
BOOL PROC is system task (TASK CONST task): 
  TASK VAR tsk := task ; 
  WHILE NOT (tsk = supervisor OR tsk = niltask) REP  
    tsk := father (tsk) ; 
  PER;
  tsk = supervisor 
END PROC is system task ;
 
PROC inst (TEXT CONST druckername, printername, fonttabname, 
           BOOL VAR success) : 
   page ; 
   headline (druckername) ; 
   fetch from archive if necessary ((empty thesaurus 
      + printer name + fonttab name) - all ,success); 
   IF success  AND ok
     THEN page ; 
          putline ("Der Drucker wird insertiert"); 
          insert (printer name) ; 
     ELSE success := FALSE ; 
   FI. 
 
ok: 
  bottomline (" "); 
  yes ("Soll der ausgewählte Drucker insertiert werden"). 
   
END PROC inst ; 
 
PROC fetch from archive if necessary (THESAURUS CONST files, 
                                       BOOL VAR success ):
  BOOL VAR was esc ; 
  THESAURUS VAR thes :: files; 
 
  WHILE highest entry (thes) > 0  REP
    ask for archive;
    IF NOT was esc 
      THEN disable stop ; 
           bottomline ("Bitte warten !  "); 
           reserve archive;
           IF NOT is error 
             THEN IF highest entry (thes / ALL archive) > 0 
                    THEN fetch (thes / ALL archive, archive);
                    ELSE fehler ("Dateien nicht gefunden") 
                  FI; 
                  thes := thes - all;
           FI; 
           IF is error 
             THEN fehler (errormessage);
                  clear error 
           FI; 
           command dialogue (FALSE); 
           release (archive);
           command dialogue (TRUE); 
           enable stop ; 
    FI;
  UNTIL was esc PER; 
  success := highest entry (thes) = 0. 
 
ask for archive:
  headline ("") ;
  putline ("Bitte Archiv mit den Dateien"); 
  TEXT VAR buffer;
  INT VAR index :: 0; 
  REP 
    get (thes, buffer, index); 
    putline ("    " + buffer) 
  UNTIL index = 0 PER; 
  putline ("einlegen !"); 
  bottomline ("CR: Wenn Archiv eingelegt        ESC : Zurück zum Hauptmenü"); 
  cursor (1,24); 
  REP 
    inchar (buffer) ; 
  UNTIL buffer = ""13"" OR buffer = ""27"" PER ; 
  was esc := buffer = ""27"". 
 
reserve archive :
  INT VAR p1, p2;
  archive (" "31" ");
  list (archive);
  IF is error
     THEN buffer := errormessage;
          p1 := pos (buffer, """", 1 ) + 1;
          p2 := pos (buffer, """", p1) - 1;
          IF p1 > 0 AND p2 > 0
             THEN clear error;
                  buffer := subtext (buffer, p1, p2);
                  archive (buffer);
          FI;
  FI.

END PROC fetch from archive if necessary ;

PROC fehler (TEXT CONST fehlermeldung): 
  bottomline (""7"" + fehlermeldung + "   Bitte eine Taste drücken") ; 
  pause ; 
  bottomline (" ") ; 
END PROC fehler;
 
END PACKET laserdrucker inserter;