--- ray/src/rt/aed.c 1990/01/08 15:15:15 1.6 +++ ray/src/rt/aed.c 2004/03/30 16:13:00 2.6 @@ -1,22 +1,19 @@ -/* Copyright (c) 1987 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: aed.c,v 2.6 2004/03/30 16:13:00 schorsch Exp $"; #endif - /* * aed.c - driver for AED 512 terminal. - * - * 2/2/87 */ +#include "copyright.h" + #include +#include "rterror.h" +#include "color.h" #include "driver.h" -#include "color.h" - /* AED command characters */ #define AEDFMT "1888N" /* Format string to send to AED */ @@ -56,12 +53,22 @@ static char SCCSid[] = "$SunId$ LBL"; #define COMHT 16 /* height of command line */ #define COMCW 63 /* maximum chars on command line */ -int aed_close(), aed_clear(), aed_paintr(), - aed_getcur(), aed_comout(), aed_errout(); +static void aed_errout(char*); +static void longwait(int t); +static void aedgetcap(int *xp, int *yp); +static void aedsetcap(int x, int y); +static dr_newcolrf_t anewcolr; +static void aedcoord(int x, int y); +static dr_closef_t aed_close; +static dr_clearf_t aed_clear; +static dr_paintrf_t aed_paintr; +static dr_getcurf_t aed_getcur; +static dr_comoutf_t comout; + static struct driver aed_driver = { aed_close, aed_clear, aed_paintr, aed_getcur, - aed_comout, NULL, + aed_comout, NULL, NULL, 1.0, NCOLS, NROWS }; @@ -71,7 +78,7 @@ aed_init(name, id) /* open AED */ char *name, *id; { if (ttyset(&aed_driver, fileno(stdin)) < 0) { /* set tty driver */ - stderr_v("cannot access terminal\n"); + eputs("cannot access terminal\n"); return(NULL); } command(RST); /* reset AED */ @@ -87,21 +94,27 @@ char *name, *id; command(SCP); byte('+'); byte(0); byte(1); make_gmap(GAMMA); /* make color map */ - errvec = aed_errout; /* set error vector */ - cmdvec = aed_errout; - if (wrnvec != NULL) - wrnvec = aed_errout; + erract[USER].pf = /* set error vector */ + erract[SYSTEM].pf = + erract[INTERNAL].pf = + erract[CONSISTENCY].pf = aed_errout; + erract[COMMAND].pf = aed_errout; + if (erract[WARNING].pf != NULL) + erract[WARNING].pf = aed_errout; return(&aed_driver); } -static -aed_close() /* close AED */ +static void +aed_close(void) /* close AED */ { - errvec = stderr_v; /* reset error vector */ - cmdvec = NULL; - if (wrnvec != NULL) - wrnvec = stderr_v; + erract[USER].pf = /* reset error vector */ + erract[SYSTEM].pf = + erract[INTERNAL].pf = + erract[CONSISTENCY].pf = eputs; + erract[COMMAND].pf = NULL; + if (erract[WARNING].pf != NULL) + erract[WARNING].pf = wputs; aedsetcap(0, 0); /* go to bottom */ command(SEC); byte(WHT); /* white text */ @@ -122,12 +135,11 @@ int x, y; } -static +static void aed_paintr(col, xmin, ymin, xmax, ymax) /* paint a rectangle */ COLOR col; int xmin, ymin, xmax, ymax; { - extern int anewcolr(); int ndx; ndx = get_pixel(col, anewcolr); /* calls anewcolr() */ @@ -155,7 +167,7 @@ int *xp, *yp; } -static +static void aed_comout(out) /* output to command line */ register char *out; { @@ -198,7 +210,7 @@ register char *out; } -static +static void aed_errout(msg) /* print an error message */ char *msg; { @@ -212,7 +224,7 @@ char *msg; * aedsetcap - sets AED's current access pointer to (x, y). */ -static +static void aedsetcap(x, y) register int x, y; { @@ -224,7 +236,7 @@ register int x, y; * aedcoord - puts out an (x, y) coordinate in AED 8 bit format. */ -static +static void aedcoord(x, y) register int x, y; { @@ -234,7 +246,7 @@ register int x, y; } -static +static void aedgetcap(xp, yp) /* get cursor postion */ int *xp, *yp; { @@ -250,7 +262,7 @@ int *xp, *yp; } -static +static void anewcolr(index, r, g, b) /* enter a color into our table */ int index; int r, g, b; @@ -265,7 +277,7 @@ int r, g, b; } -static +static void longwait(t) /* longer wait */ int t; {