Redefine the default boolean type to gmx_bool.
[alexxy/gromacs.git] / src / gmxlib / selection / scanner.h
1 /*
2  *
3  *                This source code is part of
4  *
5  *                 G   R   O   M   A   C   S
6  *
7  *          GROningen MAchine for Chemical Simulations
8  *
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.
13
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.
18  *
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.
25  *
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.
28  *
29  * For more info, check our website at http://www.gromacs.org
30  */
31 /*! \internal \file
32  * \brief
33  * Parser/scanner interaction functions.
34  *
35  * This is an implementation header: there should be no need to use it outside
36  * this directory.
37  */
38 #ifndef SELECTION_SCANNER_H
39 #define SELECTION_SCANNER_H
40
41 #include "parser.h"
42
43 struct gmx_ana_indexgrps_t;
44 struct gmx_ana_selcollection_t;
45
46 #ifndef YY_TYPEDEF_YY_SCANNER_T
47 #define YY_TYPEDEF_YY_SCANNER_T
48 typedef void *yyscan_t;
49 #endif
50
51 /** Initializes the selection scanner. */
52 int
53 _gmx_sel_init_lexer(yyscan_t *scannerp, struct gmx_ana_selcollection_t *sc,
54                     gmx_bool bInteractive, int maxnr,
55                     struct gmx_ana_indexgrps_t *grps);
56 /** Frees memory allocated for the selection scanner. */
57 void
58 _gmx_sel_free_lexer(yyscan_t scanner);
59
60 /** Returns TRUE if the scanner is interactive. */
61 gmx_bool
62 _gmx_sel_is_lexer_interactive(yyscan_t scanner);
63 /** Returns the selection collection for the scanner. */
64 struct gmx_ana_selcollection_t *
65 _gmx_sel_lexer_selcollection(yyscan_t scanner);
66 /** Returns the external index groups for the scanner. */
67 struct gmx_ana_indexgrps_t *
68 _gmx_sel_lexer_indexgrps(yyscan_t scanner);
69 /** Returns the number of selections after which the parser should stop. */
70 int
71 _gmx_sel_lexer_exp_selcount(yyscan_t scanner);
72
73 /** Returns a pretty string of the current selection.  */
74 const char *
75 _gmx_sel_lexer_pselstr(yyscan_t scanner);
76 /** Clears the current selection string.  */
77 void
78 _gmx_sel_lexer_clear_pselstr(yyscan_t scanner);
79 /** Clears the method stack in the scanner in error situations. */
80 void
81 _gmx_sel_lexer_clear_method_stack(yyscan_t scanner);
82 /** Notifies the scanner that a complete method expression has been parsed. */
83 void
84 _gmx_sel_finish_method(yyscan_t scanner);
85 /** Initializes the scanner to scan a file. */
86 void
87 _gmx_sel_set_lex_input_file(yyscan_t scanner, FILE *fp);
88 /** Initializes the scanner to scan a string. */
89 void
90 _gmx_sel_set_lex_input_str(yyscan_t scanner, const char *str);
91
92 /** A wrapper for the actual scanner, used by the Bison parser. */
93 int
94 _gmx_sel_yyblex(YYSTYPE *yylval, yyscan_t yyscanner);
95
96 #endif