Commit | Line | Data |
---|---|---|
805e021f CE |
1 | /* |
2 | * Copyright 2000, International Business Machines Corporation and others. | |
3 | * All Rights Reserved. | |
4 | * | |
5 | * This software has been released under the terms of the IBM Public | |
6 | * License. For details, see the LICENSE file in the top-level source | |
7 | * directory or online at http://www.openafs.org/dl/license10.html | |
8 | */ | |
9 | ||
10 | /* | |
11 | * Description: | |
12 | * Implementation of the gator dumb window facility. | |
13 | * | |
14 | *------------------------------------------------------------------------*/ | |
15 | ||
16 | #include <afsconfig.h> | |
17 | #include <afs/param.h> | |
18 | ||
19 | #include <roken.h> | |
20 | ||
21 | #include "gtxdumbwin.h" /*Interface definition */ | |
22 | ||
23 | int dumb_debug; /*Is debugging turned on? */ | |
24 | static char mn[] = "gator_dumbwindows"; /*Module name */ | |
25 | ||
26 | /* | |
27 | * Version of standard operations for a dumb window. | |
28 | */ | |
29 | struct gwinops dumb_gwinops = { | |
30 | gator_dumbgwin_box, | |
31 | gator_dumbgwin_clear, | |
32 | gator_dumbgwin_destroy, | |
33 | gator_dumbgwin_display, | |
34 | gator_dumbgwin_drawline, | |
35 | gator_dumbgwin_drawrectangle, | |
36 | gator_dumbgwin_drawchar, | |
37 | gator_dumbgwin_drawstring, | |
38 | gator_dumbgwin_invert, | |
39 | gator_dumbgwin_getchar, | |
40 | gator_dumbgwin_getdimensions, | |
41 | gator_dumbgwin_wait, | |
42 | }; | |
43 | ||
44 | struct gwinbaseops gator_dumb_gwinbops = { | |
45 | gator_dumbgwin_create, | |
46 | gator_dumbgwin_cleanup | |
47 | }; | |
48 | ||
49 | /* | |
50 | * Macros to map pixel positions to row & column positions. | |
51 | * (Note: for now, they are the identity function!!) | |
52 | */ | |
53 | #define GATOR_MAP_X_TO_COL(w, x) (x) | |
54 | #define GATOR_MAP_Y_TO_LINE(w, y) (y) | |
55 | ||
56 | /*------------------------------------------------------------------------ | |
57 | * gator_dumbgwin_init | |
58 | * | |
59 | * Description: | |
60 | * Initialize the dumb window package. | |
61 | * | |
62 | * Arguments: | |
63 | * int adebug: Is debugging turned on? | |
64 | * | |
65 | * Returns: | |
66 | * 0 on success, | |
67 | * Error value otherwise. | |
68 | * | |
69 | * Environment: | |
70 | * Nothing interesting. | |
71 | * | |
72 | * Side Effects: | |
73 | * As advertised. | |
74 | *------------------------------------------------------------------------*/ | |
75 | ||
76 | int | |
77 | gator_dumbgwin_init(int adebug) | |
78 | { /*gator_dumbgwin_init */ | |
79 | ||
80 | static char rn[] = "gator_dumbgwin_init"; /*Routine name */ | |
81 | ||
82 | /* | |
83 | * Remember if we'll be doing debugging, init dumb and clear the | |
84 | * standard screen. | |
85 | */ | |
86 | dumb_debug = adebug; | |
87 | ||
88 | if (dumb_debug) | |
89 | fprintf(stderr, "[%s:%s] Called\n", mn, rn); | |
90 | ||
91 | /* | |
92 | * We always return success here. | |
93 | */ | |
94 | return (0); | |
95 | ||
96 | } /*gator_dumbgwin_init */ | |
97 | ||
98 | /*------------------------------------------------------------------------ | |
99 | * gator_dumbgwin_create | |
100 | * | |
101 | * Description: | |
102 | * Create a dumb window. | |
103 | * | |
104 | * Arguments: | |
105 | * struct gator_dumbgwin_params *params : Ptr to creation parameters. | |
106 | * | |
107 | * Returns: | |
108 | * Ptr to the created dumb window if successful, | |
109 | * Null ptr otherwise. | |
110 | * | |
111 | * Environment: | |
112 | * Nothing interesting. | |
113 | * | |
114 | * Side Effects: | |
115 | * As advertised. | |
116 | *------------------------------------------------------------------------*/ | |
117 | ||
118 | struct gwin * | |
119 | gator_dumbgwin_create(void *rock) | |
120 | { /*gator_dumbgwin_create */ | |
121 | ||
122 | static char rn[] = "gator_dumbgwin_create"; /*Routine name */ | |
123 | if (dumb_debug) | |
124 | fprintf(stderr, "[%s:%s] Called\n", mn, rn); | |
125 | ||
126 | /* | |
127 | * Return failure here, fill this routine in at some point. | |
128 | */ | |
129 | return (NULL); | |
130 | ||
131 | } /*gator_dumbgwin_create */ | |
132 | ||
133 | /*------------------------------------------------------------------------ | |
134 | * gator_dumbgwin_cleanup | |
135 | * | |
136 | * Description: | |
137 | * Create a dumb window. | |
138 | * | |
139 | * Arguments: | |
140 | * struct gwin *gwp : Ptr to base window. | |
141 | * | |
142 | * Returns: | |
143 | * 0 on success, | |
144 | * Error value otherwise. | |
145 | * | |
146 | * Environment: | |
147 | * Nothing interesting. | |
148 | * | |
149 | * Side Effects: | |
150 | * As advertised. | |
151 | *------------------------------------------------------------------------*/ | |
152 | ||
153 | int | |
154 | gator_dumbgwin_cleanup(struct gwin *gwp) | |
155 | { /*gator_dumbgwin_cleanup */ | |
156 | ||
157 | static char rn[] = "gator_dumbgwin_cleanup"; /*Routine name */ | |
158 | ||
159 | if (dumb_debug) | |
160 | fprintf(stderr, "[%s:%s] Called\n", mn, rn); | |
161 | ||
162 | /* | |
163 | * Return success here, fill this routine in at some point. | |
164 | */ | |
165 | return (0); | |
166 | ||
167 | } /*gator_dumbgwin_cleanup */ | |
168 | ||
169 | /*------------------------------------------------------------------------ | |
170 | * gator_dumbgwin_box | |
171 | * | |
172 | * Description: | |
173 | * Draw a box around the given dumb window. | |
174 | * | |
175 | * Arguments: | |
176 | * struct gwin *gwp : Ptr to the dumb window to draw | |
177 | * a box around. | |
178 | * | |
179 | * Returns: | |
180 | * 0 on success, | |
181 | * Error value otherwise. | |
182 | * | |
183 | * Environment: | |
184 | * Nothing interesting. | |
185 | * | |
186 | * Side Effects: | |
187 | * As advertised. | |
188 | *------------------------------------------------------------------------*/ | |
189 | ||
190 | int | |
191 | gator_dumbgwin_box(struct gwin *gwp) | |
192 | { /*gator_dumbgwin_box */ | |
193 | ||
194 | static char rn[] = "gator_dumbgwin_box"; /*Routine name */ | |
195 | ||
196 | if (dumb_debug) | |
197 | fprintf(stderr, "[%s:%s] Called\n", mn, rn); | |
198 | ||
199 | /* | |
200 | * Return success here, fill in the routine at some point. | |
201 | */ | |
202 | return (0); | |
203 | ||
204 | } /*gator_dumbgwin_box */ | |
205 | ||
206 | /*------------------------------------------------------------------------ | |
207 | * gator_dumbgwin_clear | |
208 | * | |
209 | * Description: | |
210 | * Clear out the given dumb window. | |
211 | * | |
212 | * Arguments: | |
213 | * struct gwin *gwp : Ptr to the dumb window to clear out. | |
214 | * | |
215 | * Returns: | |
216 | * 0 on success, | |
217 | * Error value otherwise. | |
218 | * | |
219 | * Environment: | |
220 | * Nothing interesting. | |
221 | * | |
222 | * Side Effects: | |
223 | * As advertised. | |
224 | *------------------------------------------------------------------------*/ | |
225 | ||
226 | int | |
227 | gator_dumbgwin_clear(struct gwin *gwp) | |
228 | { /*gator_dumbgwin_clear */ | |
229 | ||
230 | static char rn[] = "gator_dumbgwin_clear"; /*Routine name */ | |
231 | ||
232 | if (dumb_debug) | |
233 | fprintf(stderr, "[%s:%s] Called\n", mn, rn); | |
234 | ||
235 | /* | |
236 | * Return success, fill in this routine at some point. | |
237 | */ | |
238 | return (0); | |
239 | ||
240 | } /*gator_dumbgwin_clear */ | |
241 | ||
242 | /*------------------------------------------------------------------------ | |
243 | * gator_dumbgwin_destroy | |
244 | * | |
245 | * Description: | |
246 | * Destroy the given dumb window. | |
247 | * | |
248 | * Arguments: | |
249 | * struct gwin *gwp : Ptr to the dumb window to destroy. | |
250 | * | |
251 | * Returns: | |
252 | * 0 on success, | |
253 | * Error value otherwise. | |
254 | * | |
255 | * Environment: | |
256 | * Nothing interesting. | |
257 | * | |
258 | * Side Effects: | |
259 | * As advertised. | |
260 | *------------------------------------------------------------------------*/ | |
261 | ||
262 | int | |
263 | gator_dumbgwin_destroy(struct gwin *gwp) | |
264 | { /*gator_dumbgwin_destroy */ | |
265 | ||
266 | static char rn[] = "gator_dumbgwin_destroy"; /*Routine name */ | |
267 | ||
268 | if (dumb_debug) | |
269 | fprintf(stderr, "[%s:%s] Called", mn, rn); | |
270 | ||
271 | return (0); | |
272 | ||
273 | } /*gator_dumbgwin_destroy */ | |
274 | ||
275 | /*------------------------------------------------------------------------ | |
276 | * gator_dumbgwin_display | |
277 | * | |
278 | * Description: | |
279 | * Display/redraw the given dumb window. | |
280 | * | |
281 | * Arguments: | |
282 | * struct gwin *gwp : Ptr to the dumb window to draw. | |
283 | * | |
284 | * Returns: | |
285 | * 0 on success, | |
286 | * Error value otherwise. | |
287 | * | |
288 | * Environment: | |
289 | * Nothing interesting. | |
290 | * | |
291 | * Side Effects: | |
292 | * As advertised. | |
293 | *------------------------------------------------------------------------*/ | |
294 | ||
295 | int | |
296 | gator_dumbgwin_display(struct gwin *gwp) | |
297 | { /*gator_dumbgwin_display */ | |
298 | ||
299 | static char rn[] = "gator_dumbgwin_display"; /*Routine name */ | |
300 | ||
301 | if (dumb_debug) | |
302 | fprintf(stderr, "[%s:%s] Called\n", mn, rn); | |
303 | ||
304 | /* | |
305 | * Return success, fill in this routine at some point. | |
306 | */ | |
307 | return (0); | |
308 | ||
309 | } /*gator_dumbgwin_display */ | |
310 | ||
311 | /*------------------------------------------------------------------------ | |
312 | * gator_dumbgwin_drawline | |
313 | * | |
314 | * Description: | |
315 | * Draw a line between two points in the given dumb | |
316 | * window. | |
317 | * | |
318 | * Arguments: | |
319 | * struct gwin *gwp : Ptr to the dumb window in which | |
320 | * the line is to be drawn. | |
321 | * struct gwin_lineparams *params : Ptr to other params. | |
322 | * | |
323 | * Returns: | |
324 | * 0 on success, | |
325 | * Error value otherwise. | |
326 | * | |
327 | * Environment: | |
328 | * Nothing interesting. | |
329 | * | |
330 | * Side Effects: | |
331 | * As advertised. | |
332 | *------------------------------------------------------------------------*/ | |
333 | ||
334 | int | |
335 | gator_dumbgwin_drawline(struct gwin *gwp, struct gwin_lineparams *params) | |
336 | { /*gator_dumbgwin_drawline */ | |
337 | ||
338 | static char rn[] = "gator_dumbgwin_drawline"; /*Routine name */ | |
339 | ||
340 | if (dumb_debug) | |
341 | fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn, | |
342 | rn); | |
343 | ||
344 | /* | |
345 | * Return success, fill in this routine at some point. | |
346 | */ | |
347 | return (0); | |
348 | ||
349 | } /*gator_dumbgwin_drawline */ | |
350 | ||
351 | /*------------------------------------------------------------------------ | |
352 | * gator_dumbgwin_drawrectangle | |
353 | * | |
354 | * Description: | |
355 | * Draw a rectangle in the given dumb window. | |
356 | * | |
357 | * Arguments: | |
358 | * struct gwin *gwp : Ptr to the dumb window in which | |
359 | * the rectangle is to be drawn. | |
360 | * struct gwin_rectparams *params : Ptr to other params. | |
361 | * | |
362 | * Returns: | |
363 | * 0 on success, | |
364 | * Error value otherwise. | |
365 | * | |
366 | * Environment: | |
367 | * Nothing interesting. | |
368 | * | |
369 | * Side Effects: | |
370 | * As advertised. | |
371 | *------------------------------------------------------------------------*/ | |
372 | ||
373 | int | |
374 | gator_dumbgwin_drawrectangle(struct gwin *gwp, struct gwin_rectparams *params) | |
375 | { /*gator_dumbgwin_drawrectangle */ | |
376 | ||
377 | static char rn[] = "gator_dumbgwin_drawrectangle"; /*Routine name */ | |
378 | ||
379 | if (dumb_debug) | |
380 | fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn, | |
381 | rn); | |
382 | ||
383 | /* | |
384 | * Return success, fill in this routine at some point. | |
385 | */ | |
386 | return (0); | |
387 | ||
388 | } /*gator_dumbgwin_drawrectangle */ | |
389 | ||
390 | /*------------------------------------------------------------------------ | |
391 | * gator_dumbgwin_drawchar | |
392 | * | |
393 | * Description: | |
394 | * Draw a character in the given dumb window. | |
395 | * | |
396 | * Arguments: | |
397 | * struct gwin *gwp : Ptr to the dumb window in which | |
398 | * the character is to be drawn. | |
399 | * struct gwin_charparams *params : Ptr to other params. | |
400 | * | |
401 | * Returns: | |
402 | * 0 on success, | |
403 | * Error value otherwise. | |
404 | * | |
405 | * Environment: | |
406 | * Nothing interesting. | |
407 | * | |
408 | * Side Effects: | |
409 | * As advertised. | |
410 | *------------------------------------------------------------------------*/ | |
411 | ||
412 | int | |
413 | gator_dumbgwin_drawchar(struct gwin *gwp, struct gwin_charparams *params) | |
414 | { /*gator_dumbgwin_drawchar */ | |
415 | ||
416 | static char rn[] = "gator_dumbgwin_drawchar"; /*Routine name */ | |
417 | ||
418 | if (dumb_debug) | |
419 | fprintf(stderr, "[%s:%s] Called\n", mn, rn); | |
420 | ||
421 | /* | |
422 | * Return success, fill in this routine at some point. | |
423 | */ | |
424 | return (0); | |
425 | ||
426 | } /*gator_dumbgwin_drawchar */ | |
427 | ||
428 | /*------------------------------------------------------------------------ | |
429 | * gator_dumbgwin_drawstring | |
430 | * | |
431 | * Description: | |
432 | * Draw a string in the given dumb window. | |
433 | * | |
434 | * Arguments: | |
435 | * struct gwin *gwp : Ptr to the dumb window in which | |
436 | * the string is to be drawn. | |
437 | * struct gwin_strparams *params : Ptr to other params. | |
438 | * | |
439 | * Returns: | |
440 | * 0 on success, | |
441 | * Error value otherwise. | |
442 | * | |
443 | * Environment: | |
444 | * Nothing interesting. | |
445 | * | |
446 | * Side Effects: | |
447 | * As advertised. | |
448 | *------------------------------------------------------------------------*/ | |
449 | ||
450 | int | |
451 | gator_dumbgwin_drawstring(struct gwin *gwp, struct gwin_strparams *params) | |
452 | { /*gator_dumbgwin_drawstring */ | |
453 | ||
454 | static char rn[] = "gator_dumbgwin_drawstring"; /*Routine name */ | |
455 | ||
456 | if (dumb_debug) | |
457 | fprintf(stderr, "[%s:%s] Called\n", mn, rn); | |
458 | ||
459 | /* | |
460 | * Return success, fill in this routine at some point. | |
461 | */ | |
462 | return (0); | |
463 | ||
464 | } /*gator_dumbgwin_drawstring */ | |
465 | ||
466 | /*------------------------------------------------------------------------ | |
467 | * gator_dumbgwin_invert | |
468 | * | |
469 | * Description: | |
470 | * Invert a region in the given dumb window. | |
471 | * | |
472 | * Arguments: | |
473 | * struct gwin *gwp : Ptr to the dumb window in which | |
474 | * the inverted region lies. | |
475 | * struct gwin_invparams *params : Ptr to other params. | |
476 | * | |
477 | * Returns: | |
478 | * 0 on success, | |
479 | * Error value otherwise. | |
480 | * | |
481 | * Environment: | |
482 | * Nothing interesting. | |
483 | * | |
484 | * Side Effects: | |
485 | * As advertised. | |
486 | *------------------------------------------------------------------------*/ | |
487 | ||
488 | int | |
489 | gator_dumbgwin_invert(struct gwin *gwp, struct gwin_invparams *params) | |
490 | { /*gator_dumbgwin_invert */ | |
491 | ||
492 | static char rn[] = "gator_dumbgwin_invert"; /*Routine name */ | |
493 | ||
494 | if (dumb_debug) | |
495 | fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn, | |
496 | rn); | |
497 | ||
498 | /* | |
499 | * Return success, fill in this routine at some point. | |
500 | */ | |
501 | return (0); | |
502 | ||
503 | } /*gator_dumbgwin_invert */ | |
504 | ||
505 | /*------------------------------------------------------------------------ | |
506 | * gator_dumbgwin_getchar | |
507 | * | |
508 | * Description: | |
509 | * Pick up a character from the given window. | |
510 | * | |
511 | * Arguments: | |
512 | * struct gwin *gwp : Ptr to the dumb window to listen to. | |
513 | * | |
514 | * Returns: | |
515 | * Value of the character read, | |
516 | * -1 otherwise. | |
517 | * | |
518 | * Environment: | |
519 | * Nothing interesting. | |
520 | * | |
521 | * Side Effects: | |
522 | * As advertised. | |
523 | *------------------------------------------------------------------------*/ | |
524 | ||
525 | int | |
526 | gator_dumbgwin_getchar(struct gwin *gwp) | |
527 | { /*gator_dumbgwin_getchar */ | |
528 | ||
529 | static char rn[] = "gator_dumbgwin_getchar"; /*Routine name */ | |
530 | ||
531 | if (dumb_debug) | |
532 | fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn, | |
533 | rn); | |
534 | ||
535 | return (-1); | |
536 | ||
537 | } /*gator_dumbgwin_getchar */ | |
538 | ||
539 | /*------------------------------------------------------------------------ | |
540 | * gator_dumbgwin_getdimensions | |
541 | * | |
542 | * Description: | |
543 | * Get the window's X,Y dimensions. | |
544 | * | |
545 | * Arguments: | |
546 | * struct gwin *gwp : Ptr to the dumb window to examine. | |
547 | * struct gwin_sizeparams *aparms : Ptr to size params to set. | |
548 | * | |
549 | * Returns: | |
550 | * 0 if successful, | |
551 | * -1 otherwise. | |
552 | * | |
553 | * Environment: | |
554 | * Nothing interesting. | |
555 | * | |
556 | * Side Effects: | |
557 | * As advertised. | |
558 | *------------------------------------------------------------------------*/ | |
559 | ||
560 | int | |
561 | gator_dumbgwin_getdimensions(struct gwin *gwp, struct gwin_sizeparams *aparms) | |
562 | { /*gator_dumbgwin_getdimensions */ | |
563 | ||
564 | static char rn[] = "gator_dumbgwin_getdimensions"; /*Routine name */ | |
565 | ||
566 | if (dumb_debug) | |
567 | fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn, | |
568 | rn); | |
569 | ||
570 | return (-1); | |
571 | ||
572 | } /*gator_dumbgwin_getdimensions */ | |
573 | ||
574 | /*------------------------------------------------------------------------ | |
575 | * gator_dumbgwin_wait | |
576 | * | |
577 | * Description: | |
578 | * Wait until input is available. | |
579 | * | |
580 | * Arguments: | |
581 | * struct gwin *gwp : Ptr to the dumb window to wait on. | |
582 | * | |
583 | * Returns: | |
584 | * 0 if successful, | |
585 | * -1 otherwise. | |
586 | * | |
587 | * Environment: | |
588 | * Nothing interesting. | |
589 | * | |
590 | * Side Effects: | |
591 | * As advertised. | |
592 | *------------------------------------------------------------------------*/ | |
593 | ||
594 | int | |
595 | gator_dumbgwin_wait(struct gwin *gwp) | |
596 | { /*gator_dumbgwin_wait */ | |
597 | ||
598 | static char rn[] = "gator_dumbgwin_wait"; /*Routine name */ | |
599 | ||
600 | if (dumb_debug) | |
601 | fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn, | |
602 | rn); | |
603 | ||
604 | return (-1); | |
605 | ||
606 | } /*gator_dumbgwin_wait */ |