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