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