ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/calcomp.h
Revision: 1.4
Committed: Tue Apr 23 12:43:13 1991 UTC (33 years ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 1.3: +1 -1 lines
Log Message:
added ':' defines for constant expressions

File Contents

# User Rev Content
1 greg 1.1 /* Copyright (c) 1986 Regents of the University of California */
2    
3     /* SCCSid "$SunId$ LBL" */
4    
5     /*
6     * calcomp.h - header file for expression parser.
7     *
8     */
9     /* EPNODE types */
10     #define VAR 1
11     #define NUM 2
12     #define UMINUS 3
13     #define CHAN 4
14     #define FUNC 5
15     #define ARG 6
16     #define TICK 7
17     #define SYM 8
18 greg 1.4 /* also: '+', '-', '*', '/', '^', '=', ':' */
19 greg 1.1
20     typedef struct {
21     char *fname; /* function name */
22     int nargs; /* # of required arguments */
23     double (*f)(); /* pointer to function */
24     } LIBR; /* a library function */
25    
26     typedef struct epnode {
27     int type; /* node type */
28     struct epnode *sibling; /* next child this level */
29     union {
30     struct epnode *kid; /* first child */
31     double num; /* number */
32     char *name; /* symbol name */
33     int chan; /* channel number */
34     long tick; /* timestamp */
35     struct vardef {
36     char *name; /* variable name */
37     int nlinks; /* number of references */
38     struct epnode *def; /* definition */
39     LIBR *lib; /* library definition */
40     struct vardef *next; /* next in hash list */
41     } *ln; /* link */
42     } v; /* value */
43     } EPNODE; /* an expression node */
44    
45     typedef struct vardef VARDEF; /* a variable definition */
46    
47     extern double eval(), varvalue(), chanvalue(), funvalue();
48     extern double argument(), getnum();
49     extern double (*eoper[])();
50     extern int getinum();
51     extern char *getname(), *argfun();
52     extern EPNODE *eparse(), *ekid(), *dlookup(), *dpop(), *dfirst(), *dnext();
53     extern EPNODE *getdefn(), *getchan();
54     extern EPNODE *getE1(), *getE2(), *getE3(), *getE4(), *getE5(), *rconst();
55     extern VARDEF *varinsert(), *varlookup(), *argf();
56     extern LIBR *liblookup();
57     extern long eclock;
58     extern int nextc;
59     extern int errno;
60    
61     #define evalue(ep) (*eoper[(ep)->type])(ep)