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 |
MEMBER_STMT, CONSTRAINT_STMT, ASSIGNMENT_STMT, POSITION_STMT, |
9 |
ORIENTATION_STMT, START_INDEX_STMT } node_type; |
10 |
|
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 |
/* this struct is used for lists of integers */ |
59 |
|
60 |
typedef struct integer_list_tag{ |
61 |
int the_int; |
62 |
struct integer_list_tag* prev; |
63 |
struct integer_list_tag* next; |
64 |
} integer_list; |
65 |
|
66 |
/* here's the master node type. This is the node that will be strung |
67 |
together by the yacc parser. Each statement will an individual |
68 |
node. Block statements will act as branch nodes, pointing to their |
69 |
own set of statement lists.*/ |
70 |
|
71 |
typedef struct node_tag{ |
72 |
node_type type; |
73 |
int index; // needed for atoms, bonds, etc. |
74 |
struct node_tag* next_stmt; // the next statement |
75 |
struct node_tag* prev_stmt; // the previous statement |
76 |
struct node_tag* stmt_list; // the statment list if this is a block. |
77 |
|
78 |
/* this is a union to hold the statement data */ |
79 |
|
80 |
union{ |
81 |
member_data mbr; |
82 |
constraint_data cnstr; |
83 |
assignment_data asmt; |
84 |
position_data pos; |
85 |
orientation_data ort; |
86 |
struct integer_list_tag* il_head; |
87 |
} the_data; |
88 |
|
89 |
} node; |
90 |
|
91 |
|
92 |
|
93 |
#endif |