1 |
mmeineke |
377 |
#ifndef __NODE_LIST_H__ |
2 |
|
|
#define __NODE_LIST_H__ |
3 |
|
|
|
4 |
|
|
/* enumerates the different types of nodes the statments can be */ |
5 |
|
|
|
6 |
|
|
typedef enum { GLOBAL_HEAD, COMPONENT_HEAD, |
7 |
|
|
MOLECULE_HEAD, ATOM_HEAD, BOND_HEAD, BEND_HEAD, TORSION_HEAD, |
8 |
|
|
MEMBER_STMT, CONSTRAINT_STMT, ASSIGNMENT_STMT, POSITION_STMT, |
9 |
gezelter |
957 |
ORIENTATION_STMT, ZCONSTRAINT_HEAD, RIGIDBODY_HEAD} node_type; |
10 |
mmeineke |
377 |
|
11 |
|
|
/* a structure to hold the index of the members of a bond, bend, or torsion */ |
12 |
|
|
|
13 |
|
|
typedef struct member_data_tag{ |
14 |
|
|
int a; |
15 |
|
|
int b; |
16 |
|
|
int c; |
17 |
|
|
int d; |
18 |
|
|
} member_data; |
19 |
|
|
|
20 |
|
|
/* a structure to hold constraint information */ |
21 |
|
|
|
22 |
|
|
typedef struct constraint_data_tag{ |
23 |
|
|
double constraint_val; |
24 |
|
|
} constraint_data; |
25 |
|
|
|
26 |
|
|
/* a structure to hold assignment info */ |
27 |
|
|
|
28 |
|
|
typedef enum{ STR_ASSN, INT_ASSN, DOUBLE_ASSN } assign_type; |
29 |
|
|
|
30 |
|
|
typedef union{ |
31 |
|
|
int i_val; |
32 |
|
|
double d_val; |
33 |
|
|
char* str_ptr; |
34 |
|
|
} assignment_value; |
35 |
|
|
|
36 |
|
|
typedef struct assignment_data_tag{ |
37 |
|
|
assign_type type; |
38 |
|
|
char* identifier; // left hand side |
39 |
|
|
assignment_value rhs; // right hand side |
40 |
|
|
} assignment_data; |
41 |
|
|
|
42 |
|
|
/* a structure to hold the position information */ |
43 |
|
|
|
44 |
|
|
typedef struct position_data_tag{ |
45 |
|
|
double x; |
46 |
|
|
double y; |
47 |
|
|
double z; |
48 |
|
|
} position_data; |
49 |
|
|
|
50 |
|
|
/* a structure to hold the orientation information */ |
51 |
|
|
|
52 |
|
|
typedef struct orientation_data_tag{ |
53 |
|
|
double x; |
54 |
|
|
double y; |
55 |
|
|
double z; |
56 |
|
|
} orientation_data; |
57 |
|
|
|
58 |
|
|
/* here's the master node type. This is the node that will be strung |
59 |
|
|
together by the yacc parser. Each statement will an individual |
60 |
|
|
node. Block statements will act as branch nodes, pointing to their |
61 |
|
|
own set of statement lists.*/ |
62 |
|
|
|
63 |
|
|
typedef struct node_tag{ |
64 |
|
|
node_type type; |
65 |
|
|
int index; // needed for atoms, bonds, etc. |
66 |
|
|
struct node_tag* next_stmt; // the next statement |
67 |
|
|
struct node_tag* prev_stmt; // the previous statement |
68 |
|
|
struct node_tag* stmt_list; // the statment list if this is a block. |
69 |
|
|
|
70 |
|
|
/* this is a union to hold the statement data */ |
71 |
|
|
|
72 |
|
|
union{ |
73 |
|
|
member_data mbr; |
74 |
|
|
constraint_data cnstr; |
75 |
|
|
assignment_data asmt; |
76 |
|
|
position_data pos; |
77 |
|
|
orientation_data ort; |
78 |
|
|
} the_data; |
79 |
|
|
|
80 |
|
|
} node; |
81 |
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
#endif |