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