-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymtab.h
50 lines (42 loc) · 833 Bytes
/
symtab.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef SYMTAB_H
#define SYMTAB_H
#define MAX_SYMBOLS 512
#define SYM_MATRIX 1
#define SYM_VALUE 2
#define SYM_CONSTANTS 3
#define SYM_LIGHT 4
#define SYM_FILE 5
#define SYM_STRING 5
struct constants
{
double r[4];
double g[4];
double b[4];
double red,green,blue;
};
struct light
{
double l[4];
double c[4];
};
typedef struct
{
char *name;
int type;
union{
struct matrix *m;
struct constants *c;
struct light *l;
double value;
} s;
} SYMTAB;
extern SYMTAB symtab[MAX_SYMBOLS];
extern int lastsym;
SYMTAB *lookup_symbol(char *name);
SYMTAB *add_symbol(char *name, int type, void *data);
void print_constants(struct constants *p);
void print_light(struct light *p);
void print_symtab();
SYMTAB *add_symbol(char *name, int type, void *data);
void set_value(SYMTAB *p, double value);
#endif