3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
9 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
10 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
11 * Copyright (c) 2001-2009, The GROMACS development team,
12 * check out http://www.gromacs.org for more information.
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * If you want to redistribute modifications, please consider that
20 * scientific software is very special. Version control is crucial -
21 * bugs must be traceable. We will be happy to consider code for
22 * inclusion in the official distribution, but derived work must not
23 * be called official GROMACS. Details are found in the README & COPYING
24 * files - if they are missing, get the official version at www.gromacs.org.
26 * To help us fund GROMACS development, we humbly ask that you cite
27 * the papers on the package - you can find them in the top README file.
29 * For more info, check our website at http://www.gromacs.org
32 * \brief Handling of selection parser symbol table.
34 * This is an implementation header: there should be no need to use it outside
37 #ifndef SELECTION_SYMREC_H
38 #define SELECTION_SYMREC_H
41 struct gmx_ana_selmethod_t
;
43 /** Defines the type of the symbol. */
46 SYMBOL_RESERVED
, /**< The symbol is a reserved keyword. */
47 SYMBOL_VARIABLE
, /**< The symbol is a variable. */
48 SYMBOL_METHOD
, /**< The symbol is a selection method. */
49 SYMBOL_POS
, /**< The symbol is a position keyword. */
52 /** Symbol table for the selection parser. */
53 typedef struct gmx_sel_symtab_t gmx_sel_symtab_t
;
54 /** Single symbol for the selection parser. */
55 typedef struct gmx_sel_symrec_t gmx_sel_symrec_t
;
57 /** Returns the name of a symbol. */
59 _gmx_sel_sym_name(gmx_sel_symrec_t
*sym
);
60 /** Returns the type of a symbol. */
62 _gmx_sel_sym_type(gmx_sel_symrec_t
*sym
);
63 /** Returns the method associated with a \ref SYMBOL_METHOD symbol. */
64 struct gmx_ana_selmethod_t
*
65 _gmx_sel_sym_value_method(gmx_sel_symrec_t
*sym
);
66 /** Returns the method associated with a \ref SYMBOL_VARIABLE symbol. */
68 _gmx_sel_sym_value_var(gmx_sel_symrec_t
*sym
);
70 /** Creates a new symbol table. */
72 _gmx_sel_symtab_create(gmx_sel_symtab_t
**tabp
);
73 /** Frees all memory allocated for a symbol table. */
75 _gmx_sel_symtab_free(gmx_sel_symtab_t
*tab
);
76 /** Finds a symbol by name. */
78 _gmx_sel_find_symbol(gmx_sel_symtab_t
*tab
, const char *name
, bool bExact
);
79 /** Finds a symbol by name. */
81 _gmx_sel_find_symbol_len(gmx_sel_symtab_t
*tab
, const char *name
, size_t len
,
83 /** Returns the first symbol of a given type. */
85 _gmx_sel_first_symbol(gmx_sel_symtab_t
*tab
, e_symbol_t type
);
86 /** Returns the next symbol of a given type. */
88 _gmx_sel_next_symbol(gmx_sel_symrec_t
*after
, e_symbol_t type
);
89 /** Adds a new variable symbol. */
91 _gmx_sel_add_var_symbol(gmx_sel_symtab_t
*tab
, const char *name
,
92 struct t_selelem
*sel
);
93 /** Adds a new method symbol. */
95 _gmx_sel_add_method_symbol(gmx_sel_symtab_t
*tab
, const char *name
,
96 struct gmx_ana_selmethod_t
*method
);