1 /* lib.h: declarations for shared routines.
3 Copyright 1992, 1993 Karl Berry
4 Copyright 2007 TeX Users Group
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #include <kpathsea/types.h>
27 /* for original boolean */
30 #define FATAL_PERROR(s) do { perrormod (s); exit (errno); } while (0)
32 extern string concat (string s1, string s2);
33 extern string concat3 (string, string, string);
34 extern string concat4 (string, string, string, string);
35 extern string concat5 (string, string, string, string, string);
36 extern string xstrdup (string s);
37 extern bool same_file_p (string filename1, string filename2);
38 extern string find_suffix (string name);
39 extern string remove_suffix (string name);
40 extern string make_suffix (string s, string suffix);
41 extern string make_prefix (string stem_prefix, string name);
42 extern string extend_filename (string name, string suffix);
43 extern FILE *xfopen (string filename, string mode);
44 extern void xfclose (FILE *, string filename);
45 extern void xfseek (FILE *, long, int, string filename);
46 extern long xftell (FILE *, string filename);
48 extern address xmalloc (unsigned size);
49 extern address xrealloc (address old_address, unsigned new_size);
50 extern address xcalloc (unsigned nelem, unsigned elsize);
52 /* (Re)Allocate N items of type T using xmalloc/xrealloc. */
53 #define XRETALLOC(addr, n, t) ((addr) = (t *) xrealloc (addr, (n) * sizeof(t)))
54 #endif /* not LIB_H */