Debian Codegraph @

utils/autosp/autosp-src/utils.h

raw
1
2 /*
3 utils.h -- header file for autosp, rebar and tex2aspc
4
5 Copyright (c) 2005-15 R. D. Tennent
6 School of Computing, Queen's University, [email protected]
7
8 This program is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2 of the License, or (at your
11 option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16 Public License for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23 #ifdef HAVE_CONFIG_H /* for TeXLive */
24 #include <config.h>
25 #endif
26
27 # define PRIVATE static
28 # include <stdlib.h>
29 # include <string.h>
30 # include <stdio.h>
31 # include <ctype.h>
32
33 # ifdef KPATHSEA
34 # include <kpathsea/getopt.h>
35 # else
36 # include <getopt.h>
37 # endif
38 # include <time.h>
39
40 # define LINE_LEN 1024
41
42 # ifdef HAVE_STDBOOL_H
43 # include <stdbool.h>
44 # else
45 # ifndef HAVE__BOOL
46 # define _Bool signed char
47 # endif
48 # define bool _Bool
49 # define true 1
50 # define false 0
51 # endif
52
53 extern size_t append (char *dst, char **offset, const char *src, size_t n);
54 /* Copies src to *offset and updates *offset accordingly (if possible).
55 * Assumes *offset is dst if offset == NULL.
56 * The src string must be null-terminated.
57 * Execution aborts unless **offset == '\0'.
58 * Returns (original offset - dst) + strlen(src); if >= n, the string was truncated.
59 */
60
61 extern bool prefix (const char *cs, const char *ct); /* is string cs[] a prefix of ct[]? */
62 extern bool suffix (const char *cs, const char *ct); /* is string cs[] a suffix of ct[]? */
63
64 extern int lineno;
65 extern void error (const char msg[]); /* abort with stderr message msg */
66 extern void warning (const char msg[]); /* output warning message msg to stderr */