4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
27 * Green Red Orange Magenta Azure Cyan Skyblue
33 static char *SRCID_symtab_h
= "$Id$";
36 #ident "@(#) symtab.h 1.6 12/16/92"
37 #endif /* HAVE_IDENT */
43 * This module handles symbol table manipulation. All text strings
44 * needed by an application are allocated only once. All references
45 * to these text strings use handles returned from the put_symtab()
46 * routine. These handles can easily be converted to address independent
47 * values by invoking lookup_symtab(). So when writing structures to
48 * a file which contains text strings, this value can be written in stead
49 * of the text string or its address. This value can easily be converted
50 * back to a text string handle by get_symtab_handle().
53 extern void open_symtab(t_symtab
*symtab
);
54 /* Initialises the symbol table symtab.
57 extern void close_symtab(t_symtab
*symtab
);
58 /* Undoes the effect of open_symtab(), after invoking this function,
59 * no value can be added to the symbol table, only values can be
60 * retrieved using get_symtab().
63 extern void free_symtab(t_symtab
*symtab
);
64 /* Frees the space allocated by the symbol table itself */
66 extern void done_symtab(t_symtab
*symtab
);
67 /* Frees the space allocated by the symbol table, including all
70 extern char **put_symtab(t_symtab
*symtab
,char *name
);
71 /* Enters a string into the symbol table symtab, if it was not
72 * available, a reference to a copy is returned else a reference
73 * to the earlier entered value is returned. Strings are trimmed
77 extern int lookup_symtab(t_symtab
*symtab
,char **name
);
78 /* Returns a unique handle for **name, without a memory reference.
79 * It is a failure when name cannot be found in the symbol table,
80 * it should be entered before with put_symtab().
83 extern char **get_symtab_handle(t_symtab
*symtab
,int name
);
84 /* Returns a text string handle for name. Name should be a value
85 * returned from lookup_symtab(). So get_symtab_handle() and
86 * lookup_symtab() are inverse functions.
89 extern long wr_symtab(FILE *fp
,t_symtab
*symtab
);
90 /* Writes the symbol table symtab to the file, specified by fp.
91 * The function returns the number of bytes written.
94 extern long rd_symtab(FILE *fp
,t_symtab
*symtab
);
95 /* Reads the symbol table symtab from the file, specified by fp.
96 * This will include allocating the needed space. The function
97 * returns the number of bytes read. The symtab is in the closed
98 * state afterwards, so no strings can be added to it.
101 extern void pr_symtab(FILE *fp
,int indent
,char *title
,t_symtab
*symtab
);
102 /* This routine prints out a (human) readable representation of
103 * the symbol table symtab to the file fp. Ident specifies the
104 * number of spaces the text should be indented. Title is used
105 * to print a header text.
108 #endif /* _symtab_h */