Tagged files with gromacs 3.0 header and added some license info
[alexxy/gromacs.git] / include / symtab.h
1 /*
2  * $Id$
3  * 
4  *                This source code is part of
5  * 
6  *                 G   R   O   M   A   C   S
7  * 
8  *          GROningen MAchine for Chemical Simulations
9  * 
10  *                        VERSION 3.0
11  * 
12  * Copyright (c) 1991-2001
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  * 
21  * If you want to redistribute modifications, please consider that
22  * scientific software is very special. Version control is crucial -
23  * bugs must be traceable. We will be happy to consider code for
24  * inclusion in the official distribution, but derived work must not
25  * be called official GROMACS. Details are found in the README & COPYING
26  * files - if they are missing, get the official version at www.gromacs.org.
27  * 
28  * To help us fund GROMACS development, we humbly ask that you cite
29  * the papers on the package - you can find them in the top README file.
30  * 
31  * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
32  * 
33  * And Hey:
34  * Giving Russians Opium May Alter Current Situation
35  */
36
37 #ifndef _symtab_h
38 #define _symtab_h
39
40 static char *SRCID_symtab_h = "$Id$";
41 #ifdef HAVE_CONFIG_H
42 #include <config.h>
43 #endif
44
45 #ifdef HAVE_IDENT
46 #ident  "@(#) symtab.h 1.6 12/16/92"
47 #endif /* HAVE_IDENT */
48
49 #include <stdio.h>
50 #include "typedefs.h"
51
52 /*
53  * This module handles symbol table manipulation. All text strings 
54  * needed by an application are allocated only once. All references
55  * to these text strings use handles returned from the put_symtab()
56  * routine. These handles can easily be converted to address independent
57  * values by invoking lookup_symtab(). So when writing structures to
58  * a file which contains text strings, this value can be written in stead
59  * of the text string or its address. This value can easily be converted
60  * back to a text string handle by get_symtab_handle().
61  */
62
63 extern void open_symtab(t_symtab *symtab);
64      /* Initialises the symbol table symtab.
65       */
66
67 extern 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 extern void free_symtab(t_symtab *symtab);
74      /* Frees the space allocated by the symbol table itself */
75
76 extern void done_symtab(t_symtab *symtab);
77      /* Frees the space allocated by the symbol table, including all
78       * entries in it */
79
80 extern char **put_symtab(t_symtab *symtab,char *name);
81      /* Enters a string into the symbol table symtab, if it was not
82       * available, a reference to a copy is returned else a reference 
83       * to the earlier entered value is returned. Strings are trimmed
84       * of spaces.
85       */
86
87 extern int lookup_symtab(t_symtab *symtab,char **name);
88      /* Returns a unique handle for **name, without a memory reference.
89       * It is a failure when name cannot be found in the symbol table,
90       * it should be entered before with put_symtab().
91       */
92
93 extern char **get_symtab_handle(t_symtab *symtab,int name);
94      /* Returns a text string handle for name. Name should be a value
95       * returned from lookup_symtab(). So get_symtab_handle() and 
96       * lookup_symtab() are inverse functions.
97       */
98
99 extern long wr_symtab(FILE *fp,t_symtab *symtab);
100      /* Writes the symbol table symtab to the file, specified by fp.
101       * The function returns the number of bytes written.
102       */
103
104 extern long rd_symtab(FILE *fp,t_symtab *symtab);
105      /* Reads the symbol table symtab from the file, specified by fp.
106       * This will include allocating the needed space. The function 
107       * returns the number of bytes read. The symtab is in the closed
108       * state afterwards, so no strings can be added to it.
109       */
110
111 extern void pr_symtab(FILE *fp,int indent,char *title,t_symtab *symtab);
112      /* This routine prints out a (human) readable representation of 
113       * the symbol table symtab to the file fp. Ident specifies the
114       * number of spaces the text should be indented. Title is used
115       * to print a header text.
116       */
117
118 #endif  /* _symtab_h */