Fix malformed CUDA version macro check
[alexxy/gromacs.git] / include / symtab.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2004, 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.
11  *
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.
16  *
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.
21  *
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.
26  *
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.
34  *
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.
37  */
38
39 #ifndef _symtab_h
40 #define _symtab_h
41
42 #include <stdio.h>
43 #include "visibility.h"
44 #include "typedefs.h"
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 /*
51  * This module handles symbol table manipulation. All text strings
52  * needed by an application are allocated only once. All references
53  * to these text strings use handles returned from the put_symtab()
54  * routine. These handles can easily be converted to address independent
55  * values by invoking lookup_symtab(). So when writing structures to
56  * a file which contains text strings, this value can be written in stead
57  * of the text string or its address. This value can easily be converted
58  * back to a text string handle by get_symtab_handle().
59  */
60
61 GMX_LIBGMX_EXPORT
62 void open_symtab(t_symtab *symtab);
63 /* Initialises the symbol table symtab.
64  */
65
66 GMX_LIBGMX_EXPORT
67 void close_symtab(t_symtab *symtab);
68 /* Undoes the effect of open_symtab(), after invoking this function,
69  * no value can be added to the symbol table, only values can be
70  * retrieved using get_symtab().
71  */
72
73 void free_symtab(t_symtab *symtab);
74 /* Frees the space allocated by the symbol table itself */
75
76 GMX_LIBGMX_EXPORT
77 void done_symtab(t_symtab *symtab);
78 /* Frees the space allocated by the symbol table, including all
79  * entries in it */
80
81 GMX_LIBGMX_EXPORT
82 char **put_symtab(t_symtab *symtab, const char *name);
83 /* Enters a string into the symbol table symtab, if it was not
84  * available, a reference to a copy is returned else a reference
85  * to the earlier entered value is returned. Strings are trimmed
86  * of spaces.
87  */
88
89 int lookup_symtab(t_symtab *symtab, char **name);
90 /* Returns a unique handle for **name, without a memory reference.
91  * It is a failure when name cannot be found in the symbol table,
92  * it should be entered before with put_symtab().
93  */
94
95 char **get_symtab_handle(t_symtab *symtab, int name);
96 /* Returns a text string handle for name. Name should be a value
97  * returned from lookup_symtab(). So get_symtab_handle() and
98  * lookup_symtab() are inverse functions.
99  */
100
101 long wr_symtab(FILE *fp, t_symtab *symtab);
102 /* Writes the symbol table symtab to the file, specified by fp.
103  * The function returns the number of bytes written.
104  */
105
106 long rd_symtab(FILE *fp, t_symtab *symtab);
107 /* Reads the symbol table symtab from the file, specified by fp.
108  * This will include allocating the needed space. The function
109  * returns the number of bytes read. The symtab is in the closed
110  * state afterwards, so no strings can be added to it.
111  */
112
113 GMX_LIBGMX_EXPORT
114 void pr_symtab(FILE *fp, int indent, const char *title, t_symtab *symtab);
115 /* This routine prints out a (human) readable representation of
116  * the symbol table symtab to the file fp. Ident specifies the
117  * number of spaces the text should be indented. Title is used
118  * to print a header text.
119  */
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif  /* _symtab_h */