00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PARSETREE_H
00022 #define PARSETREE_H
00023
00024 #include "SymbolTable.h"
00025 #include "AtomParser.h"
00026
00029 class symbol_data {
00030 private:
00031 void make_space(void);
00032 void free_space(void);
00033
00037 int free_sval;
00038
00039 public:
00040 SymbolTableElement::symtype type;
00041 double *dval;
00042 int *ival;
00043 char **sval;
00044 int num;
00045
00046 symbol_data(SymbolTableElement::symtype new_type, int new_num);
00047 ~symbol_data(void);
00048 void convert(SymbolTableElement::symtype totype);
00049 };
00050
00051
00053 class ParseTree {
00054 private:
00055 SymbolTable *table;
00056 atomparser_node *tree;
00057 int *selected_array;
00058 int num_selected;
00059 void *context;
00060
00061 public:
00062 VMDApp *app;
00063 ParseTree(VMDApp *vmdapp, SymbolTable *, atomparser_node *);
00064 ~ParseTree(void);
00065 void use_context(void *ctxt) { context = ctxt; }
00066 int evaluate(int num_atoms, int *flgs);
00067 int find_recursion(const char *head);
00068
00069 private:
00070 void eval_compare(atomparser_node *node, int num, int *flgs);
00071 symbol_data *eval_mathop(atomparser_node *node, int num, int *flgs);
00072 symbol_data *eval_key( atomparser_node *node, int num, int *flgs);
00073 void eval_stringfctn( atomparser_node *node, int num, int *flgs);
00074 void eval_within(atomparser_node *node, int num, int *flgs);
00075 void eval_exwithin(atomparser_node *node, int num, int *flgs);
00076 void eval_pbwithin(atomparser_node *node, int num, int *flgs);
00077 void eval_single(atomparser_node *node, int num, int *flgs);
00078 void eval_same(atomparser_node *node, int num, int *flgs);
00079 void eval_within_bonds(atomparser_node *node, int num, int *flgs);
00080 void eval_k_nearest(atomparser_node *node, int num, int *flgs);
00081 void find_rings(int num, int *flgs, int *others, int minringsize, int maxringsize);
00082 void eval_maxringsize(atomparser_node *node, int num, int *flgs);
00083 void eval_ringsize(atomparser_node *node, int num, int *flgs);
00084 symbol_data *eval(atomparser_node *node, int num, int *flgs);
00085 void eval_find_recursion(atomparser_node *, int *, hash_t *);
00086 };
00087
00088 #endif
00089