-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCDLB.DOC
386 lines (236 loc) · 13.7 KB
/
CDLB.DOC
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
cdlb(lib) 05Oct84 cdlb(lib)
NAME
cdlb - Craig's display library
SYNOPSIS
include "cddef"
call cdinit
call cdend
call cdredo
integer minlin, mincol, maxlin, maxcol, lin, numlins
call cdclear
call cdclra ( minlin, mincol, maxlin, maxcol )
call cdclrl ( lin, numlins )
character ch, str()
integer lin, col, int, minwid
real rl
call cdput ( ch, lin, col )
call cdputs ( str, lin, col )
call cdputc ( str, lin )
call cdputn ( int, minwid, lin, col )
call cdputr ( rl, minwid, lin, col )
character cdgfont, cdsngfont, cdnulfont
character cdandfont, cdorfont, cdnotfont
character f, f1, f2
integer att
call cdfont ( f )
f = cdgfont ( 0 )
f = cdsngfont ( att )
f = cdnulfont ( 0 )
f = cdandfont ( f1, f2 )
f = cdorfont ( f1, f2 )
f = cdnotfont ( f1 )
integer lin1, col1, lin2, col2
call cdline ( lin1, col1, lin2, col2 )
call cdbox ( lin1, col1, lin2, col2 )
integer lin, col
call cdmove ( lin, col )
logical stoponinput
call cdplay ( stoponinput )
character pmt(), str(), terms(), termch
integer status, cdgets, maxlen, lin, col, cdgetn, num
status = cdgets ( pmt, lin, col, str, maxlen )
termch = cdgetx ( pmt, lin, col, terms, str, maxlen )
termch = cdgetp ( pmt, lin, col, terms, str, maxlen )
- 1 -
cdlb(lib) 05Oct84 cdlb(lib)
status = cdgetn ( pmt, lin, col, num )
DESCRIPTION
Cdlb is a package of routines to help you write
screen-oriented (non-cpu-bound) programs. Cdlb keeps
track of things in two buffers; one is called the actual
image and the other is called the desired image. The
actual image always is the same as what is actually on
the terminals screen. The actual image is modified to
look like the desired image when cdplay() is called.
Normally, you manipulate the desired image and then call
cdplay() to draw the screen.
Cdlb uses sclb(lib) to find out about terminal dependent
features; it also uses iolb(lib) to perform "raw"
terminal i/o. Terminals that use cdlb programs are
required to:
(1) not be hardcopy terminals
(2) have the ability to do absolute cursor
addressing OR have the ability to do relative
cursor addressing and move the cursor to home
(3) have the ability to clear the screen
1 Descriptions of the routines 1. Descriptions of the routines. _. ____________ __ ___ ________. 1. Descriptions of the routines.
cdinit initializes cdlb. Cdinit() clears the actual
and desired images and must be the first
routine called from cdlb.
cdend terminates cdlb. This routine must be called
before exiting.
cdredo force a complete screen refreash. This
routine clears both the terminals display and
the actual image.
cdclear clears the desired image.
cdclra clears a rectangular area of the desired
image. "Minlin" and "maxlin" are the first
and last lines of the area to clear and
"mincol" and "maxcol" are the first and last
columns of the area to clear.
cdclrl clears one or more lines of the desired
screen image. "Lin" is the first line to
clear and "numlins" is the number of lines to
- 2 -
cdlb(lib) 05Oct84 cdlb(lib)
clear.
cdput puts a character into the desired image. "Ch"
is the character to put on the screen and
"lin" and "col" are the line and column to
put it on.
cdputs puts a string into the desired image. "Str"
is the string to put on the screen and "lin"
and "col" specify the line and column to
place the string.
cdputc puts a string into the desired image,
centered. "Str" is the string to put on the
desired image and "lin" is the line to put it
on.
cdputn puts a number into the desired image. "Int"
is the number and "lin" and "col" specify the
position. "Minwid" specifies the minimum
width and the number is padded with blanks,
if necessary.
cdputr puts a real number into the desired image.
This routine is otherwise similar to
cdputn().
cdfont changes to the desired font. Each character
in the desired image has a font. Changing the
desired font changes the font that new
characters placed in the desired image will
receive.
cdgfont returns the description of the current font.
cdsngfont returns the description of a font which has
just the attribute "att" set. Possible
attributes are ATTRIBUTE_HIGHLIGHT,
ATTRIBUTE_UNDERLINE, ATTRIBUTE_REVERSE,
ATTRIBUTE_BLINK, ATTRIBUTE_GRAPHICS, and
ATTRIBUTE_ALTERNATE.
cdnulfont returns the description of a font that has no
attributes set. This is called the normal
font and it that is in effect when cdinit()
is called.
cdandfont returns the description of a font that has
all attributes that are set in both fonts
"f1" and "f2" at once.
cdorfont returns the description of a font that has
all attributes that are set in either font
"f1" or "f2".
- 3 -
cdlb(lib) 05Oct84 cdlb(lib)
cdnotfont returns the description of a font that has
all the attributes that are not in the font
"f1".
cdline draws a line. The line is drawn from line
"lin1" column "col1" to line "lin2" column
"col2". The line must be either horizontal or
vertical.
cdmove specifies the desired cursor position.
cdbox draws a box defined by the two points.
cdplay optimaly updates the actual image to look
like the desired image.
An important feature to note is that, if
"stoponinput" is .true., the routine checks
every so often whether any new characters
have been typed by the user. If a new
character is available, the routine will stop
updating the screen and return immediately to
allow the main program to process the
character.
cdgets reads a line via the screen. Cdgets() writes
the prompt "pmt" at the position specified by
"lin" and "col" and then reads a line from
the terminal, which is returned in str. A
maximum of "maxlen" characters will be put
into "str", although more may be read.
You can erase characters with either delete
or backspace. You can erase the line with
either control-x or control-u. You can erase
the last word with control-w. You can
redisplay the screen with control-l or
redisplay the line with control-r.
If no string is input, ERR is returned as the
status; otherwise OK.
cdgetx reads a line via the screen, specifying
terminating characters. Characters are read
up to one of the terminator characters in the
string "terms".
Characters are read up to one of the
terminator characters and the terminating
character is returned as the function value.
Otherwise, this is routine is similar to
cdgets().
- 4 -
cdlb(lib) 05Oct84 cdlb(lib)
cdgetp Similar to cdgetx(), this routine uses the
characters in "str" as the default input. The
user can edit the string using delete, ^W,
etc., as with cdgetx() and cdgets().
cdgetn read a number via the screen. Cdgetn()
prompts for a number as in cdgets() and
returns it in num. Cdgets is used. If no
number is input, ERR is returned as the
status; otherwise OK.
2 Helpful hints 2. Helpful hints. _. _______ _____. 2. Helpful hints.
When first learning how to use cdlb, keep it simple.
I.e. don't fool around with fonts or lines.
Sometimes, the screen will get screwed up by a terminal
broadcast or something. Here's one easy way to redraw
the screen:
call cdredo # force a refreash
call cdplay ( .false. ) # draw the screen again
There are really two ways to use cdclear() when you want
to put a different image up on the screen. For example:
call cdinit
<modify the desired image>
call cdplay ( .false. )
call cdclear
<modify the desired image again>
call cdplay ( .false. )
In this example, the first time cdplay() is called, the
screen is updated as expected. The second time cdplay()
is called, the screen is updated by changing what is
already on the screen.
Now another example:
call cdinit
<modify the desired image>
call cdplay ( .false. )
call cdclear
call cdredo # force a redraw
<modify the desired image again>
call cdplay ( .false. )
This example is just like the previous one except the
second time cdplay() is called, the screen is cleared
and the new characters are simply displayed on the clean
screen.
- 5 -
cdlb(lib) 05Oct84 cdlb(lib)
FILES
incl/cdlb - user visible symbols
SEE ALSO
iolb(lib), sclb(lib), termcap(file)
AUTHOR(S)
Craig Leres
BUGS/DEFICIENCIES
The routine names and interfaces should look more like
the Unix "curses" package.
Character attributes are handled in an strange way.
See iolb(lib) and sclb(lib) for more bug lists.
- 6 -
ÿ