Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / gtx / dumbwindows.c
blob3237de4ff768a609a832f72e6b40f65695ea62f0
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
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 */
11 * Description:
12 * Implementation of the gator dumb window facility.
14 *------------------------------------------------------------------------*/
16 #include <afsconfig.h>
17 #include <afs/param.h>
20 #include "gtxdumbwin.h" /*Interface definition */
21 #include <stdio.h> /*Standard I/O package */
22 #include <errno.h>
24 int dumb_debug; /*Is debugging turned on? */
25 static char mn[] = "gator_dumbwindows"; /*Module name */
28 * Version of standard operations for a dumb window.
30 struct gwinops dumb_gwinops = {
31 gator_dumbgwin_box,
32 gator_dumbgwin_clear,
33 gator_dumbgwin_destroy,
34 gator_dumbgwin_display,
35 gator_dumbgwin_drawline,
36 gator_dumbgwin_drawrectangle,
37 gator_dumbgwin_drawchar,
38 gator_dumbgwin_drawstring,
39 gator_dumbgwin_invert,
40 gator_dumbgwin_getchar,
41 gator_dumbgwin_getdimensions,
42 gator_dumbgwin_wait,
45 struct gwinbaseops gator_dumb_gwinbops = {
46 gator_dumbgwin_create,
47 gator_dumbgwin_cleanup
51 * Macros to map pixel positions to row & column positions.
52 * (Note: for now, they are the identity function!!)
54 #define GATOR_MAP_X_TO_COL(w, x) (x)
55 #define GATOR_MAP_Y_TO_LINE(w, y) (y)
57 /*------------------------------------------------------------------------
58 * gator_dumbgwin_init
60 * Description:
61 * Initialize the dumb window package.
63 * Arguments:
64 * int adebug: Is debugging turned on?
66 * Returns:
67 * 0 on success,
68 * Error value otherwise.
70 * Environment:
71 * Nothing interesting.
73 * Side Effects:
74 * As advertised.
75 *------------------------------------------------------------------------*/
77 int
78 gator_dumbgwin_init(int adebug)
79 { /*gator_dumbgwin_init */
81 static char rn[] = "gator_dumbgwin_init"; /*Routine name */
84 * Remember if we'll be doing debugging, init dumb and clear the
85 * standard screen.
87 dumb_debug = adebug;
89 if (dumb_debug)
90 fprintf(stderr, "[%s:%s] Called\n", mn, rn);
93 * We always return success here.
95 return (0);
97 } /*gator_dumbgwin_init */
99 /*------------------------------------------------------------------------
100 * gator_dumbgwin_create
102 * Description:
103 * Create a dumb window.
105 * Arguments:
106 * struct gator_dumbgwin_params *params : Ptr to creation parameters.
108 * Returns:
109 * Ptr to the created dumb window if successful,
110 * Null ptr otherwise.
112 * Environment:
113 * Nothing interesting.
115 * Side Effects:
116 * As advertised.
117 *------------------------------------------------------------------------*/
119 struct gwin *
120 gator_dumbgwin_create(void *rock)
121 { /*gator_dumbgwin_create */
123 static char rn[] = "gator_dumbgwin_create"; /*Routine name */
124 if (dumb_debug)
125 fprintf(stderr, "[%s:%s] Called\n", mn, rn);
128 * Return failure here, fill this routine in at some point.
130 return (NULL);
132 } /*gator_dumbgwin_create */
134 /*------------------------------------------------------------------------
135 * gator_dumbgwin_cleanup
137 * Description:
138 * Create a dumb window.
140 * Arguments:
141 * struct gwin *gwp : Ptr to base window.
143 * Returns:
144 * 0 on success,
145 * Error value otherwise.
147 * Environment:
148 * Nothing interesting.
150 * Side Effects:
151 * As advertised.
152 *------------------------------------------------------------------------*/
155 gator_dumbgwin_cleanup(struct gwin *gwp)
156 { /*gator_dumbgwin_cleanup */
158 static char rn[] = "gator_dumbgwin_cleanup"; /*Routine name */
160 if (dumb_debug)
161 fprintf(stderr, "[%s:%s] Called\n", mn, rn);
164 * Return success here, fill this routine in at some point.
166 return (0);
168 } /*gator_dumbgwin_cleanup */
170 /*------------------------------------------------------------------------
171 * gator_dumbgwin_box
173 * Description:
174 * Draw a box around the given dumb window.
176 * Arguments:
177 * struct gwin *gwp : Ptr to the dumb window to draw
178 * a box around.
180 * Returns:
181 * 0 on success,
182 * Error value otherwise.
184 * Environment:
185 * Nothing interesting.
187 * Side Effects:
188 * As advertised.
189 *------------------------------------------------------------------------*/
192 gator_dumbgwin_box(struct gwin *gwp)
193 { /*gator_dumbgwin_box */
195 static char rn[] = "gator_dumbgwin_box"; /*Routine name */
197 if (dumb_debug)
198 fprintf(stderr, "[%s:%s] Called\n", mn, rn);
201 * Return success here, fill in the routine at some point.
203 return (0);
205 } /*gator_dumbgwin_box */
207 /*------------------------------------------------------------------------
208 * gator_dumbgwin_clear
210 * Description:
211 * Clear out the given dumb window.
213 * Arguments:
214 * struct gwin *gwp : Ptr to the dumb window to clear out.
216 * Returns:
217 * 0 on success,
218 * Error value otherwise.
220 * Environment:
221 * Nothing interesting.
223 * Side Effects:
224 * As advertised.
225 *------------------------------------------------------------------------*/
228 gator_dumbgwin_clear(struct gwin *gwp)
229 { /*gator_dumbgwin_clear */
231 static char rn[] = "gator_dumbgwin_clear"; /*Routine name */
233 if (dumb_debug)
234 fprintf(stderr, "[%s:%s] Called\n", mn, rn);
237 * Return success, fill in this routine at some point.
239 return (0);
241 } /*gator_dumbgwin_clear */
243 /*------------------------------------------------------------------------
244 * gator_dumbgwin_destroy
246 * Description:
247 * Destroy the given dumb window.
249 * Arguments:
250 * struct gwin *gwp : Ptr to the dumb window to destroy.
252 * Returns:
253 * 0 on success,
254 * Error value otherwise.
256 * Environment:
257 * Nothing interesting.
259 * Side Effects:
260 * As advertised.
261 *------------------------------------------------------------------------*/
264 gator_dumbgwin_destroy(struct gwin *gwp)
265 { /*gator_dumbgwin_destroy */
267 static char rn[] = "gator_dumbgwin_destroy"; /*Routine name */
269 if (dumb_debug)
270 fprintf(stderr, "[%s:%s] Called", mn, rn);
272 return (0);
274 } /*gator_dumbgwin_destroy */
276 /*------------------------------------------------------------------------
277 * gator_dumbgwin_display
279 * Description:
280 * Display/redraw the given dumb window.
282 * Arguments:
283 * struct gwin *gwp : Ptr to the dumb window to draw.
285 * Returns:
286 * 0 on success,
287 * Error value otherwise.
289 * Environment:
290 * Nothing interesting.
292 * Side Effects:
293 * As advertised.
294 *------------------------------------------------------------------------*/
297 gator_dumbgwin_display(struct gwin *gwp)
298 { /*gator_dumbgwin_display */
300 static char rn[] = "gator_dumbgwin_display"; /*Routine name */
302 if (dumb_debug)
303 fprintf(stderr, "[%s:%s] Called\n", mn, rn);
306 * Return success, fill in this routine at some point.
308 return (0);
310 } /*gator_dumbgwin_display */
312 /*------------------------------------------------------------------------
313 * gator_dumbgwin_drawline
315 * Description:
316 * Draw a line between two points in the given dumb
317 * window.
319 * Arguments:
320 * struct gwin *gwp : Ptr to the dumb window in which
321 * the line is to be drawn.
322 * struct gwin_lineparams *params : Ptr to other params.
324 * Returns:
325 * 0 on success,
326 * Error value otherwise.
328 * Environment:
329 * Nothing interesting.
331 * Side Effects:
332 * As advertised.
333 *------------------------------------------------------------------------*/
336 gator_dumbgwin_drawline(struct gwin *gwp, struct gwin_lineparams *params)
337 { /*gator_dumbgwin_drawline */
339 static char rn[] = "gator_dumbgwin_drawline"; /*Routine name */
341 if (dumb_debug)
342 fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn,
343 rn);
346 * Return success, fill in this routine at some point.
348 return (0);
350 } /*gator_dumbgwin_drawline */
352 /*------------------------------------------------------------------------
353 * gator_dumbgwin_drawrectangle
355 * Description:
356 * Draw a rectangle in the given dumb window.
358 * Arguments:
359 * struct gwin *gwp : Ptr to the dumb window in which
360 * the rectangle is to be drawn.
361 * struct gwin_rectparams *params : Ptr to other params.
363 * Returns:
364 * 0 on success,
365 * Error value otherwise.
367 * Environment:
368 * Nothing interesting.
370 * Side Effects:
371 * As advertised.
372 *------------------------------------------------------------------------*/
375 gator_dumbgwin_drawrectangle(struct gwin *gwp, struct gwin_rectparams *params)
376 { /*gator_dumbgwin_drawrectangle */
378 static char rn[] = "gator_dumbgwin_drawrectangle"; /*Routine name */
380 if (dumb_debug)
381 fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn,
382 rn);
385 * Return success, fill in this routine at some point.
387 return (0);
389 } /*gator_dumbgwin_drawrectangle */
391 /*------------------------------------------------------------------------
392 * gator_dumbgwin_drawchar
394 * Description:
395 * Draw a character in the given dumb window.
397 * Arguments:
398 * struct gwin *gwp : Ptr to the dumb window in which
399 * the character is to be drawn.
400 * struct gwin_charparams *params : Ptr to other params.
402 * Returns:
403 * 0 on success,
404 * Error value otherwise.
406 * Environment:
407 * Nothing interesting.
409 * Side Effects:
410 * As advertised.
411 *------------------------------------------------------------------------*/
414 gator_dumbgwin_drawchar(struct gwin *gwp, struct gwin_charparams *params)
415 { /*gator_dumbgwin_drawchar */
417 static char rn[] = "gator_dumbgwin_drawchar"; /*Routine name */
419 if (dumb_debug)
420 fprintf(stderr, "[%s:%s] Called\n", mn, rn);
423 * Return success, fill in this routine at some point.
425 return (0);
427 } /*gator_dumbgwin_drawchar */
429 /*------------------------------------------------------------------------
430 * gator_dumbgwin_drawstring
432 * Description:
433 * Draw a string in the given dumb window.
435 * Arguments:
436 * struct gwin *gwp : Ptr to the dumb window in which
437 * the string is to be drawn.
438 * struct gwin_strparams *params : Ptr to other params.
440 * Returns:
441 * 0 on success,
442 * Error value otherwise.
444 * Environment:
445 * Nothing interesting.
447 * Side Effects:
448 * As advertised.
449 *------------------------------------------------------------------------*/
452 gator_dumbgwin_drawstring(struct gwin *gwp, struct gwin_strparams *params)
453 { /*gator_dumbgwin_drawstring */
455 static char rn[] = "gator_dumbgwin_drawstring"; /*Routine name */
457 if (dumb_debug)
458 fprintf(stderr, "[%s:%s] Called\n", mn, rn);
461 * Return success, fill in this routine at some point.
463 return (0);
465 } /*gator_dumbgwin_drawstring */
467 /*------------------------------------------------------------------------
468 * gator_dumbgwin_invert
470 * Description:
471 * Invert a region in the given dumb window.
473 * Arguments:
474 * struct gwin *gwp : Ptr to the dumb window in which
475 * the inverted region lies.
476 * struct gwin_invparams *params : Ptr to other params.
478 * Returns:
479 * 0 on success,
480 * Error value otherwise.
482 * Environment:
483 * Nothing interesting.
485 * Side Effects:
486 * As advertised.
487 *------------------------------------------------------------------------*/
490 gator_dumbgwin_invert(struct gwin *gwp, struct gwin_invparams *params)
491 { /*gator_dumbgwin_invert */
493 static char rn[] = "gator_dumbgwin_invert"; /*Routine name */
495 if (dumb_debug)
496 fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn,
497 rn);
500 * Return success, fill in this routine at some point.
502 return (0);
504 } /*gator_dumbgwin_invert */
506 /*------------------------------------------------------------------------
507 * gator_dumbgwin_getchar
509 * Description:
510 * Pick up a character from the given window.
512 * Arguments:
513 * struct gwin *gwp : Ptr to the dumb window to listen to.
515 * Returns:
516 * Value of the character read,
517 * -1 otherwise.
519 * Environment:
520 * Nothing interesting.
522 * Side Effects:
523 * As advertised.
524 *------------------------------------------------------------------------*/
527 gator_dumbgwin_getchar(struct gwin *gwp)
528 { /*gator_dumbgwin_getchar */
530 static char rn[] = "gator_dumbgwin_getchar"; /*Routine name */
532 if (dumb_debug)
533 fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn,
534 rn);
536 return (-1);
538 } /*gator_dumbgwin_getchar */
540 /*------------------------------------------------------------------------
541 * gator_dumbgwin_getdimensions
543 * Description:
544 * Get the window's X,Y dimensions.
546 * Arguments:
547 * struct gwin *gwp : Ptr to the dumb window to examine.
548 * struct gwin_sizeparams *aparms : Ptr to size params to set.
550 * Returns:
551 * 0 if successful,
552 * -1 otherwise.
554 * Environment:
555 * Nothing interesting.
557 * Side Effects:
558 * As advertised.
559 *------------------------------------------------------------------------*/
562 gator_dumbgwin_getdimensions(struct gwin *gwp, struct gwin_sizeparams *aparms)
563 { /*gator_dumbgwin_getdimensions */
565 static char rn[] = "gator_dumbgwin_getdimensions"; /*Routine name */
567 if (dumb_debug)
568 fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn,
569 rn);
571 return (-1);
573 } /*gator_dumbgwin_getdimensions */
575 /*------------------------------------------------------------------------
576 * gator_dumbgwin_wait
578 * Description:
579 * Wait until input is available.
581 * Arguments:
582 * struct gwin *gwp : Ptr to the dumb window to wait on.
584 * Returns:
585 * 0 if successful,
586 * -1 otherwise.
588 * Environment:
589 * Nothing interesting.
591 * Side Effects:
592 * As advertised.
593 *------------------------------------------------------------------------*/
596 gator_dumbgwin_wait(struct gwin *gwp)
597 { /*gator_dumbgwin_wait */
599 static char rn[] = "gator_dumbgwin_wait"; /*Routine name */
601 if (dumb_debug)
602 fprintf(stderr, "[%s:%s] This routine is currently a no-op\n", mn,
603 rn);
605 return (-1);
607 } /*gator_dumbgwin_wait */