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-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.
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 Generic string handling functions.
57 #include "visibility.h"
58 #include "gmx_header_config.h"
60 /*#include "typedefs.h"*/
61 #include "types/simple.h"
63 /* Suppress Cygwin compiler warnings from using newlib version of
87 #define COMMENTSIGN ';'
90 int continuing(char *s);
93 char *fgets2(char *s, int n, FILE *stream);
96 void strip_comment (char *line);
98 int break_line (char *line,
103 void upstring (char *str);
106 void ltrim (char *str);
109 void rtrim (char *str);
112 void trim (char *str);
115 void nice_header (FILE *out, const char *fn);
118 int gmx_strcasecmp_min(const char *str1, const char *str2);
120 int gmx_strncasecmp_min(const char *str1, const char *str2, int n);
121 /* This funny version of strcasecmp, is not only case-insensitive,
122 * but also ignores '-' and '_'.
126 int gmx_strcasecmp(const char *str1, const char *str2);
128 int gmx_strncasecmp(const char *str1, const char *str2, int n);
131 char *gmx_strdup(const char *src);
132 char *gmx_strndup(const char *src, int n);
134 /* Magic hash initialization number from Dan J. Bernstein. */
135 extern const unsigned int
136 gmx_string_hash_init;
138 /* Return a hash of the string according to Dan J. Bernsteins algorithm.
139 * On the first invocation for a new string, use the constant
140 * gmx_string_hash_init for the second argument. If you want to create a hash
141 * corresponding to several concatenated strings, provide the returned hash
142 * value as hash_init for the second string, etc.
145 gmx_string_fullhash_func(const char *s, unsigned int hash_init);
147 /* Identical to gmx_string_fullhash_func, except that
148 * this routine only uses characters for which isalnum(c) is true,
149 * and all characters are converted to upper case.
152 gmx_string_hash_func(const char *s, unsigned int hash_init);
154 /** Pattern matcing with wildcards. */
156 int gmx_wcmatch(const char *pattern, const char *src);
158 /** Return value for gmx_wcmatch() when there is no match. */
159 #define GMX_NO_WCMATCH 1
162 /* this is our implementation of strsep, the thread-safe replacement for
165 char *gmx_strsep(char **stringp, const char *delim);
169 char *wrap_lines(const char *buf, int line_width, int indent,
170 gmx_bool bIndentFirst);
171 /* wraps lines at 'linewidth', indenting all following
172 * lines by 'indent' spaces. A temp buffer is allocated and returned,
173 * which can be disposed of if no longer needed.
174 * If !bIndentFirst, then the first line will not be indented, only
175 * the lines that are created due to wapping.
179 char **split(char sep, char *str);
180 /* Implementation of the well-known Perl function split */
182 gmx_large_int_t str_to_large_int_t(const char *str, char **endptr);
184 #ifdef GMX_NATIVE_WINDOWS
185 #define snprintf _snprintf
192 #endif /* _string2_h */