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