ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/ogl/gldisp.h
Revision: 3.2
Committed: Tue Apr 22 11:16:04 1997 UTC (28 years ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 3.1: +89 -13 lines
Log Message:
first idea

File Contents

# User Rev Content
1 greg 3.1 /* Copyright (c) 1997 Regents of the University of California */
2    
3     /* SCCSid "$SunId$ LBL" */
4    
5     /*
6 greg 3.2 * Header file for OpenGL display process.
7 greg 3.1 */
8    
9 greg 3.2 #ifndef MEM_PTR
10     #define MEM_PTR char *
11     #endif
12     #ifndef int4
13     #define int4 int /* assume 32-bit integers */
14     #endif
15     #undef NOPROTO
16     #define NOPROTO 1
17 greg 3.1
18 greg 3.2 #include "color.h"
19    
20     #define GD_TYPELEN 1 /* a type is 1 byte in length */
21    
22     /* argument types */
23     #define GD_TY_END 0 /* argument list terminator */
24     #define GD_TY_NAM 1 /* 8-byte (max.) identifier */
25     #define GD_TY_INT 2 /* 4-byte integer */
26     #define GD_TY_FLT 3 /* 4-byte IEEE float */
27     #define GD_TY_DBL 4 /* 8-byte IEEE double */
28     #define GD_TY_CLR 5 /* 4-byte RGBE color value */
29     #define GD_TY_ARR 6 /* 5-byte array prefix */
30     #define GD_TY_STR 7 /* nul-terminated string */
31     #define GD_TY_ARG 8 /* 1-byte argument list prefix */
32     #define GD_TY_ERR 9 /* 1-byte error code */
33    
34     #define GD_NTYPES 10 /* number of argument types */
35    
36     /* stream argument lengths */
37     #define GD_ARGLEN {0,8,4,4,8,4,5,-1,1,1}
38     /* array element lengths (0 == unsupported) */
39     #define GD_ELELEN {0,8,4,4,8,4,sizeof(GDarg),sizeof(char *),0,0}
40    
41     #define GD_MAXID 8 /* maximum id. length (must be 8) */
42    
43     /*
44     * A request consists of an argument list, the first of
45     * which is always the request name as an 8-char (max.) string.
46     * The types of the following arguments must match the required
47     * arguments of the display request, or an error will result.
48     *
49     * Only functions return values, and they return them as a argument
50     * list on the client's receiving connection. It is up to the client
51     * program to keep track of its function calls and which values correspond
52     * to which request functions.
53     *
54     * An error is indicated with a special GD_TY_ERR code on the receiving
55     * connection, and usually indicates something fatal.
56     */
57    
58     /* error codes */
59     #define GD_ER_UNRECOG 0 /* unrecognized request */
60     #define GD_ER_ARGTYPE 1 /* argument type mismatch */
61     #define GD_ER_ARGMISS 2 /* argument(s) missing */
62    
63     #define GD_NERRS 3 /* number of errors */
64    
65     /* request argument */
66 greg 3.1 typedef struct {
67 greg 3.2 BYTE typ; /* argument type */
68     BYTE atyp; /* array subtype if typ==GD_TY_ARR */
69     union {
70     char n[GD_MAXID]; /* 8-char (max.) id. */
71     int4 n1, n2; /* used for ID comparison */
72     int4 i; /* 4-byte integer */
73     float f; /* 4-byte IEEE float */
74     double d; /* 8-byte IEEE double */
75     COLR c; /* 4-byte RGBE color */
76     struct array {
77     int4 l; /* length */
78     MEM_PTR p; /* values */
79     } a; /* array */
80     char *s; /* nul-terminated string */
81     } v; /* argument value */
82     } GDarg;
83 greg 3.1
84 greg 3.2 /* a request and its arguments */
85     typedef struct gdreq {
86     struct gdreq *next; /* next request in list */
87     short argc; /* number of arguments */
88     GDarg argv[1]; /* argument list (expandable) */
89     } GDrequest;
90 greg 3.1
91 greg 3.2 #define GD_HSIZ 123 /* hash table size (prime) */
92     extern GDrequest *gdProTab[GD_HSIZ]; /* registered prototypes */
93    
94     #define gdHash(a) ((a)->v.n1 ^ (a)->v.n2)
95    
96     #define gdFree(p) free((MEM_PTR)(p))
97    
98     typedef struct {
99     int xres, yres; /* display window size (renderable area) */
100     } GDserv; /* display structure */