summaryrefslogtreecommitdiff
path: root/system/ruc-terminal/unknown/src/SETUP.ELA
blob: 3e2f3e7700e76846d4df2566d0cd1d47a6cd38a1 (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
PACKET setup DEFINES setup :         (* 02.03.86, M.Staubermann *) 
 
LET separator  = "|" , 
    old option mark = " " , (* ""16"" , *)
    choice mark = ""15"" , 
    end mark   = ""14"" , 
    left       = ""8"" , 
    right      = ""2"" , 
    bottom     = ""6""21""0"" , 
    clr line   = ""13""5"" ,
    home       = ""1"" ;
 
PROC selektor (TEXT CONST options, INT VAR option number,BOOL CONST warten) :
 TEXT VAR zeichen ;
 INT VAR i , 
         last separator pos , 
         new separator pos := 0 ,
         old option := option number , 
         max options := 0 ;
 REP 
  new separator pos := pos (options, separator, new separator pos +1) ; 
  max options INCR 1 
 UNTIL new separator pos = 0 PER ;
 out (""13"") ; 
 REP 
  i := 0 ; 
  last separator pos := 0 ;
  REP 
   i INCR 1 ;
   new separator pos := pos (options, separator, last separator pos + 1) ; 
   IF new separator pos = 0 
      THEN new separator pos := LENGTH options + 1 
   FI ;
   IF i = option number
      THEN out (choice mark) 
   ELIF i = old option 
      THEN out (old option mark) 
   ELSE out (end mark) 
   FI ; 
   out subtext (options, last separator pos + 1, new separator pos - 1) ; 
   out (end mark) ;
   last separator pos := new separator pos 
  UNTIL last separator pos = LENGTH options + 1 PER ;
  out (""13"") ;
  IF warten 
     THEN inchar (zeichen) ; 
          IF zeichen = ""27"" 
             THEN option number := old option 
          ELIF zeichen = left AND option number = 1 
             THEN option number := max options 
          ELIF zeichen = left 
             THEN option number DECR 1 
          ELIF zeichen = right AND option number = max options 
             THEN option number := 1 
          ELIF zeichen = right 
             THEN option number INCR 1 
          FI 
  ELSE zeichen := ""13"" 
  FI
 UNTIL zeichen = ""13"" OR zeichen = ""27"" PER 
ENDPROC selektor ; 
 
LET std datenbits = 4 , (* 8 *) 
    std stopbits  = 1 , (* 1.0 *) 
    std flowmode  = 1 , (* xon/xoff *) 
    std parity    = 1 , (* no parity *) 
    std fixed     = 4 , (* RTS ON, DTR ON *) 
 
    setup text    = "Ende|Kanal|Baudrate|Datenbits|Stopbits|Parity|Fluákontrolle", 
    ende text     = "Žndern|Abbruch" , 
    kanal text    = "2|3" , 
    datenbits text= "5|6|7|8" , 
    stopbits text = "1.0|1.5|2.0" , 
    parity text   = "no|even|odd" , 
    fixed text    = "DTR OFF/RTS OFF|DTR OFF/RTS ON|DTR ON/RTS OFF|DTR ON/RTS ON" , 
    flowmode text = "xon/xoff|dtr|rts/cts|dtr/rts/cts|fixed" ; 
 
INT VAR old session := 0 ; 
ROW 2 INT VAR datenbits, stopbits, parity, flowmode , fixed ; 
ROW 2 REAL VAR baudrates ; 
 
PROC init params : 
 datenbits := ROW 2 INT:(std datenbits , std datenbits) ; 
 stopbits  := ROW 2 INT:(std stopbits , std stopbits) ; 
 parity    := ROW 2 INT:(std parity , std parity) ; 
 flowmode  := ROW 2 INT:(std flowmode , std flowmode) ; 
 fixed     := ROW 2 INT:(std fixed, std fixed) ; 
 baudrates := ROW 2REAL:(baudrate (channelb), baudrate (channela)) ;
ENDPROC init params ; 
 
PROC setup :
 INT VAR kanal := aktueller kanal , 
         setup choice := 1 ; 
 BOOL VAR x dtr, x rts, x auto dtr, x cts ; 
 page ;
 init setup (kanal, setup choice) ; 
 select setup choice ; 
 cursor (1, 19) ; 
 setup choice := 2 ; 
 selektor (ende text, setup choice, TRUE) ; 
 out (bottom) ;
 IF setup choice = 1 
    THEN kanal := 1 ; 
         x flowmode ; 
         setup (kanal bool, x parity, x stopbits, x datenbits, 
                x dtr, x rts, x auto dtr, x cts) ; 
         baudrate (kanal bool, baudrates (kanal)) ; 
         kanal := 2 ; 
         x flowmode ; 
         setup (kanal bool, x parity, x stopbits, x datenbits, 
                x dtr, x rts, x auto dtr, x cts) ; 
         baudrate (kanal bool, baudrates (kanal)) 
 FI . 
 
x flowmode : 
 x dtr := FALSE ; 
 x rts := FALSE ; 
 SELECT flowmode (kanal) OF 
  CASE 1 : x auto dtr := FALSE ; (* XON/XOFF *) 
           x cts      := FALSE 
  CASE 2 : x auto dtr := TRUE ;  (* DTR *)
           x cts      := FALSE 
  CASE 3 : x auto dtr := FALSE ; (* RTS/CTS *)
           x cts      := TRUE 
  CASE 4 : x auto dtr := TRUE  ; (* RTS/CTS/DTR *) 
           x cts      := TRUE 
  CASE 5 : x auto dtr := FALSE ; (* fixed *) 
           x cts      := FALSE ; 
           SELECT fixed (kanal) OF 
            CASE 1 : x dtr := FALSE ; (* wie XON/XOFF *)
                     x rts := FALSE 
            CASE 2 : x dtr := FALSE ; (* RTS=1 *) 
                     x rts := TRUE 
            CASE 3 : x dtr := TRUE ;  (* DTR=1 *)
                     x rts := FALSE 
            CASE 4 : x dtr := TRUE ;  (* RTS=1,DTR=1 *) 
                     x rts := TRUE 
           ENDSELECT 
ENDSELECT. 
 
x parity : 
 SELECT parity (kanal) OF 
  CASE 2 : even parity 
  CASE 3 : odd parity 
  OTHERWISE no parity 
 ENDSELECT. 
 
x stopbits : 
 SELECT stopbits (kanal) OF 
  CASE 2 : 1.5 
  CASE 3 : 2.0 
  OTHERWISE 1.0 
 ENDSELECT. 
 
x datenbits : 
 datenbits (kanal) + 4. 
 
select setup choice : 
 REP 
  cursor (1, 5) ; 
  selektor (setup text, setup choice, TRUE) ; 
  SELECT setup choice OF 
   CASE 1 : LEAVE select setup choice 
   CASE 2 : select kanal choice 
   CASE 3 : select baudrate choice 
   CASE 4 : select datenbits choice 
   CASE 5 : select stopbits choice 
   CASE 6 : select parity choice 
   CASE 7 : select flowmode choice 
  ENDSELECT 
 PER . 
 
select kanal choice : 
 INT VAR save kanal := kanal ; 
 cursor (1, 7) ; 
 selektor (kanal text, kanal, TRUE) ; 
 init setup (kanal, setup choice) .
 
select baudrate choice : 
 cursor (1, 9) ; 
 TEXT VAR t := text (baudrates (kanal)) + "    " ; 
 out (" ") ;
 editget (t) ; 
 baudrates (kanal) := real (t) . 
 
select datenbits choice : 
 cursor (1, 11) ; 
 selektor (datenbits text, datenbits (kanal), TRUE) . 
 
select stopbits choice : 
 cursor (1, 13) ; 
 selektor (stopbits text, stopbits (kanal), TRUE) . 
 
select parity choice : 
 cursor (1, 15) ; 
 selektor (parity text, parity (kanal), TRUE).
 
select flowmode choice : 
 cursor (1, 17) ; 
 selektor (flowmode text, flowmode (kanal), TRUE) ; 
 IF flowmode (kanal) = 5 
    THEN cursor (1, 19) ; 
         selektor (fixed text, fixed (kanal), TRUE) ; 
         out (clr line) 
 FI . 
 
aktueller kanal : 
 IF channel = 2 THEN 1 
 ELIF channel = 3 THEN 2 
 ELSE 1 
 FI . 
 
kanal bool : 
 IF kanal = 1 THEN channel b ELSE channel a FI . 
 
ENDPROC setup ; 
 
PROC init setup (INT VAR kanal, setup choice) :
 IF session <> old session 
    THEN init params ; 
         old session := session 
 FI ;
 out (home) ; 
 putline (" ----------------------------- V 2 4 - S E T U P ---------------------------") ; 
 line ; 
 putline (" Verlassen 'ESC', Aussuchen 'LEFT' und 'RIGHT', Einstellen 'RETURN'") ; 
 line ; 
 selektor (setup text, setup choice, FALSE) ; 
 line ; 
 line ; 
 selektor (kanal text, kanal, FALSE) ; 
 line ; 
 line ; 
 out (" ") ; put (baudrates (kanal)) ; out ("     ") ;
 line ; 
 line ; 
 selektor (datenbits text, datenbits (kanal), FALSE) ; 
 line ; 
 line ; 
 selektor (stopbits text, stopbits (kanal), FALSE) ; 
 line ; 
 line ; 
 selektor (parity text, parity (kanal), FALSE) ; 
 line ; 
 line ; 
 selektor (flowmode text, flowmode (kanal), FALSE) ; 
 line ; 
 line ; 
 line ; 
 line ;
 putline (" --------------------------------------------------------------------------") ; 
 out (home) . 
ENDPROC init setup ;
 
ENDPACKET setup ;