2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2009, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012,2013, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
39 * \brief Handling of selection parser symbol table.
41 * This is an implementation header: there should be no need to use it outside
44 #ifndef SELECTION_SYMREC_H
45 #define SELECTION_SYMREC_H
48 struct gmx_ana_selmethod_t;
50 /** Defines the type of the symbol. */
53 SYMBOL_RESERVED, /**< The symbol is a reserved keyword. */
54 SYMBOL_VARIABLE, /**< The symbol is a variable. */
55 SYMBOL_METHOD, /**< The symbol is a selection method. */
56 SYMBOL_POS /**< The symbol is a position keyword. */
59 /** Symbol table for the selection parser. */
60 typedef struct gmx_sel_symtab_t gmx_sel_symtab_t;
61 /** Single symbol for the selection parser. */
62 typedef struct gmx_sel_symrec_t gmx_sel_symrec_t;
64 /** Returns the name of a symbol. */
66 _gmx_sel_sym_name(gmx_sel_symrec_t *sym);
67 /** Returns the type of a symbol. */
69 _gmx_sel_sym_type(gmx_sel_symrec_t *sym);
70 /** Returns the method associated with a \ref SYMBOL_METHOD symbol. */
71 struct gmx_ana_selmethod_t *
72 _gmx_sel_sym_value_method(gmx_sel_symrec_t *sym);
73 /** Returns the method associated with a \ref SYMBOL_VARIABLE symbol. */
75 _gmx_sel_sym_value_var(gmx_sel_symrec_t *sym);
77 /** Creates a new symbol table. */
79 _gmx_sel_symtab_create(gmx_sel_symtab_t **tabp);
80 /** Frees all memory allocated for a symbol table. */
82 _gmx_sel_symtab_free(gmx_sel_symtab_t *tab);
83 /** Finds a symbol by name. */
85 _gmx_sel_find_symbol(gmx_sel_symtab_t *tab, const char *name, gmx_bool bExact);
86 /** Finds a symbol by name. */
88 _gmx_sel_find_symbol_len(gmx_sel_symtab_t *tab, const char *name, size_t len,
90 /** Returns the first symbol of a given type. */
92 _gmx_sel_first_symbol(gmx_sel_symtab_t *tab, e_symbol_t type);
93 /** Returns the next symbol of a given type. */
95 _gmx_sel_next_symbol(gmx_sel_symrec_t *after, e_symbol_t type);
96 /** Adds a new variable symbol. */
98 _gmx_sel_add_var_symbol(gmx_sel_symtab_t *tab, const char *name,
99 struct t_selelem *sel);
100 /** Adds a new method symbol. */
102 _gmx_sel_add_method_symbol(gmx_sel_symtab_t *tab, const char *name,
103 struct gmx_ana_selmethod_t *method);