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