ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/driver.h
(Generate patch)

Comparing ray/src/rt/driver.h (file contents):
Revision 1.2 by greg, Wed Apr 19 22:01:38 1989 UTC vs.
Revision 2.7 by greg, Fri Jun 27 06:53:22 2003 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1987 Regents of the University of California */
2 <
3 < /* SCCSid "$SunId$ LBL" */
4 <
1 > /* RCSid $Id$ */
2   /*
3   *  driver.h - header file for interactive device drivers.
7 *
8 *     2/2/87
4   */
5 + #ifndef _RAD_DRIVER_H_
6 + #define _RAD_DRIVER_H_
7 + #ifdef __cplusplus
8 + extern "C" {
9 + #endif
10  
11   struct driver {                         /* driver functions */
12 <        int  (*close)();                        /* close device */
13 <        int  (*clear)();                        /* clear device */
14 <        int  (*paintr)();                       /* paint rectangle */
12 >        void  (*close)();                       /* close device */
13 >        void  (*clear)();                       /* clear device */
14 >        void  (*paintr)();                      /* paint rectangle */
15          int  (*getcur)();                       /* get cursor position */
16 <        int  (*comout)();                       /* command line output */
17 <        int  (*comin)();                        /* command line input */
16 >        void  (*comout)();                      /* command line output */
17 >        void  (*comin)();                       /* command line input */
18 >        void  (*flush)();                       /* flush output */
19 >        double  pixaspect;                      /* pixel aspect ratio */
20          int  xsiz, ysiz;                        /* device size */
21          int  inpready;                          /* input ready on device */
22   };
23 <
24 < extern int  stderr_v();                 /* error vectors */
25 < extern int  (*wrnvec)(), (*errvec)(), (*cmdvec)();
24 <
25 < extern struct driver  *comm_init();     /* stream interface */
23 >                                        /* magic numbers for verification */
24 > #define COM_SENDM               0x6f37
25 > #define COM_RECVM               0x51da
26                                          /* stream commands */
27   #define COM_CLEAR               0
28   #define COM_PAINTR              1
29   #define COM_GETCUR              2
30   #define COM_COMOUT              3
31   #define COM_COMIN               4
32 < #define NREQUESTS               5       /* number of valid requests */
32 > #define COM_FLUSH               5
33 > #define NREQUESTS               6       /* number of valid requests */
34  
35 < struct device {                         /* interactive device */
35 > extern struct device {                  /* interactive device */
36          char  *name;                            /* device name */
37          char  *descrip;                         /* description */
38          struct driver  *(*init)();              /* initialize device */
39 < };
39 > }  devtable[];                          /* supported devices */
40  
41 < extern struct device  devtable[];       /* supported devices */
41 > extern char  dev_default[];             /* default device name */
42  
43   #define  MB1            ('\n')          /* mouse button 1 */
44   #define  MB2            ('\r')          /* mouse button 2 */
45   #define  MB3            (' ')           /* mouse button 3 */
46   #define  ABORT          ('C'-'@')       /* abort key */
47  
47 #define  MAXRES         4000            /* preposterous display resolution */
48
48   /*
49   *  struct driver *
50 < *  dname_init(name)
51 < *  char  *name;
50 > *  dname_init(name, id)
51 > *  char  *name, *id;
52   *  {
53   *      Initialize device and return pointer to driver
54   *      functions.  Returns NULL if an error occurred.
55 < *      The name string is used to identify the client.
55 > *      The name string identifies the driver,
56 > *      and the id string identifies the client.
57   *      A device can be open by at most one client.
58 < *      Be verbose in error reports; call stderr_v().
59 < *      If device has its own error output, set errvec,
60 < *      cmdvec and wrnvec.
58 > *      Be verbose in error reports; call eputs().
59 > *      If device has its own error output, set erract.
60   *  }
61   *  (*dev->close)()
62   *  {
# Line 74 | Line 73 | extern struct device  devtable[];      /* supported devices
73   *  int  xmin, ymin, xmax, ymax;
74   *  {
75   *      Paint a half-open rectangle from (xmin,ymin) to (xmax,ymax)
76 < *      with the color col.  Can call repaint() if necessary.
76 > *      with the color col.
77   *  }
78   *  (*dev->getcur)(xp, yp)
79   *  int  *xp, *yp;
# Line 91 | Line 90 | extern struct device  devtable[];      /* supported devices
90   *      string ends with '\n', the message is considered complete,
91   *      and the next call can erase it.
92   *  }
93 < *  (*dev->comin)(in)
94 < *  char  *in;
93 > *  (*dev->comin)(in, prompt)
94 > *  char  *in, *prompt;
95   *  {
96 < *      Read an edited input string from the command line.  If
97 < *      an unrecognized control character is entered, terminate
98 < *      input and return the string with only that character.
99 < *      The input string should not contain a newline.
100 < *      Must work in consort with comout.
96 > *      Print a prompt then read an edited input command line
97 > *      assuming the in buffer is big enough.  Unless prompt is NULL,
98 > *      the driver may substitute its own rview command.  This is
99 > *      the most reliable way to repaint areas of the screen.
100 > *      If the user enters an unrecognized control character,
101 > *      terminate input and return the string with only that character.
102 > *      The input string should not contain a newline.  The routines in
103 > *      editline.c may be useful.  Comin must work in consort with comout.
104   *  }
105 + *  (*dev->flush)()
106 + *  {
107 + *      Flush output to the display.  This is guaranteed to be called
108 + *      frequently enough to keep the display up to date.
109 + *      This is an ideal time to check for device input.
110 + *      This function can be NULL for devices that don't need it.
111 + *  }
112   *  xsiz, ysiz
113   *      The maximum allowable x and y dimensions.  If any
114   *      size is allowable, these should be set to MAXRES.
# Line 108 | Line 117 | extern struct device  devtable[];      /* supported devices
117   *      when characters are ready on the input.  (Often easiest
118   *      to check for input during calls to paintr.)
119   */
120 +
121 +                                        /* defined in editline.c */
122 + extern void     editline(char *buf, int (*c_get)(), void (*s_put)());
123 + extern void     tocombuf(char *b, struct driver *d);
124 + extern int      fromcombuf(char *b, struct driver *d);
125 +                                        /* defined in devcomm.c */
126 + extern struct driver    *slave_init(char *dname, char *id);
127 + extern struct driver    *comm_init(char *dname, char *id);
128 +                                        /* defined in colortab.c */
129 + extern int      new_ctab(int ncolors);
130 + extern int      get_pixel(COLOR col, void (*set_pixel)());
131 + extern void     make_gmap(double gam);
132 + extern void     set_cmap(BYTE *rmap, BYTE *gmap, BYTE *bmap);
133 + extern void     map_color(BYTE rgb[3], COLOR col);
134 +
135 +
136 + #ifdef __cplusplus
137 + }
138 + #endif
139 + #endif /* _RAD_DRIVER_H_ */
140 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines