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

Comparing ray/src/ogl/gldisp.h (file contents):
Revision 3.2 by greg, Tue Apr 22 11:16:04 1997 UTC vs.
Revision 3.3 by greg, Tue Apr 22 15:44:58 1997 UTC

# Line 12 | Line 12
12   #ifndef int4
13   #define int4            int             /* assume 32-bit integers */
14   #endif
15 #undef  NOPROTO
16 #define NOPROTO         1
15  
16 < #include        "color.h"
16 >                                /* request types */
17 > #define GD_R_ViewSync   0               /* synchronize current view */
18 > #define GD_R_SetView    1               /* set new view parameters */
19 > #define GD_R_AddBg      2               /* add background rectangle */
20 > #define GD_R_DelBg      3               /* delete background rectangle */
21 > #define GD_R_Error      4               /* error to report */
22 > #define GD_R_Init       5               /* initialize connection */
23 > #define GD_NREQ         6               /* number of requests */
24  
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
25                                  /* error codes */
26 < #define GD_ER_UNRECOG   0               /* unrecognized request */
27 < #define GD_ER_ARGTYPE   1               /* argument type mismatch */
28 < #define GD_ER_ARGMISS   2               /* argument(s) missing */
26 > #define GD_OK           0               /* normal return value */
27 > #define GD_E_UNRECOG    1               /* unrecognized request */
28 > #define GD_E_ARGMISS    2               /* missing argument(s) */
29 > #define GD_E_NOMEMOR    3               /* out of memory */
30 > #define GD_E_CONNECT    4               /* can't establish connection */
31 > #define GD_NERRS        5               /* number of errors */
32  
33 < #define GD_NERRS        3               /* number of errors */
33 > extern char     *gdErrMsg[GD_NERRS];    /* our error message list */
34  
35 <                                /* request argument */
35 >                                /* request structure */
36 > #define GD_ARG0         4               /* minimum argument length */
37   typedef struct {
38 <        BYTE            typ;            /* argument type */
39 <        BYTE            atyp;           /* array subtype if typ==GD_TY_ARR */
40 <        union {
41 <                char            n[GD_MAXID];    /* 8-char (max.) id. */
42 <                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;
38 >        short           type;           /* request type */
39 >        unsigned int4   id;             /* unique identifier */
40 >        unsigned int4   alen;           /* argument buffer length */
41 >        unsigned char   args[GD_ARG0];  /* followed by the actual arguments */
42 > } GDrequest;                    /* a GL display request */
43  
44 <                                /* a request and its arguments */
45 < typedef struct gdreq {
46 <        struct gdreq    *next;          /* next request in list */
47 <        short           argc;           /* number of arguments */
48 <        GDarg           argv[1];        /* argument list (expandable) */
49 < }       GDrequest;
44 > typedef struct {
45 >        int     cno;            /* connection number */
46 >        int     xres, yres;     /* display window size (renderable area) */
47 >        int     fdout;          /* send descriptor */
48 >        FILE    *fpin;          /* receive stream */
49 > } GDconnect;            /* display server/client connection */
50  
51 < #define GD_HSIZ         123             /* hash table size (prime) */
52 < extern GDrequest        *gdProTab[GD_HSIZ];     /* registered prototypes */
51 >                                /* argument lengths */
52 > #define GD_L_REAL       5               /* reals are 5 bytes */
53 > #define gdStrLen(s)     (strlen(s)+1)   /* strings are nul-terminated */
54  
94 #define gdHash(a)       ((a)->v.n1 ^ (a)->v.n2)
95
55   #define gdFree(p)       free((MEM_PTR)(p))
56  
57 < typedef struct {
58 <        int     xres, yres;     /* display window size (renderable area) */
59 < } GDserv;                       /* display structure */
57 > extern GDrequest        *gdRecvRequest();
58 > extern GDconnect        *gdOpen();
59 > extern int4     gdGetInt();
60 > extern double   gdGetReal();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines