| 1 |
/* FILE: basics.h |
| 2 |
* PURPOSE: basic definitions |
| 3 |
* AUTHOR: Piet Tutelaers |
| 4 |
* (see README for license) |
| 5 |
*/ |
| 6 |
|
| 7 |
#ifdef HAVE_CONFIG_H |
| 8 |
#include "c-auto.h" |
| 9 |
#endif |
| 10 |
|
| 11 |
#ifndef NOBASICS |
| 12 |
|
| 13 |
#if defined(KPATHSEA) |
| 14 |
# include <kpathsea/config.h> |
| 15 |
# include <kpathsea/c-pathch.h> |
| 16 |
# include <kpathsea/c-fopen.h> |
| 17 |
# define PATHSEP ENV_SEP |
| 18 |
# define DIRSEP DIR_SEP |
| 19 |
# define RB FOPEN_RBIN_MODE |
| 20 |
# define WB FOPEN_WBIN_MODE |
| 21 |
# if defined(DOSISH) |
| 22 |
# define ESCAPECHAR '!' |
| 23 |
# define RECURSIVE "!!" |
| 24 |
# endif /* DOSISH */ |
| 25 |
# define basename ps2pk_basename |
| 26 |
#elif defined(MSDOS) || defined(WIN32) |
| 27 |
# define PATHSEP ';' |
| 28 |
# define DIRSEP '\\' |
| 29 |
# define ESCAPECHAR '!' |
| 30 |
# define RECURSIVE "!!" |
| 31 |
# define PSRES_NAME "psres.dpr" |
| 32 |
# define RB "rb" |
| 33 |
# define WB "wb" |
| 34 |
#endif |
| 35 |
|
| 36 |
#ifndef PATHSEP |
| 37 |
#define PATHSEP ':' |
| 38 |
#endif |
| 39 |
|
| 40 |
#ifndef DIRSEP |
| 41 |
#define DIRSEP '/' |
| 42 |
#endif |
| 43 |
|
| 44 |
#ifndef ESCAPECHAR |
| 45 |
#define ESCAPECHAR '\\' |
| 46 |
#endif |
| 47 |
|
| 48 |
#ifndef RECURSIVE |
| 49 |
#define RECURSIVE "//" |
| 50 |
#endif |
| 51 |
|
| 52 |
/* TeX PS Resource database name */ |
| 53 |
#ifndef PSRES_NAME |
| 54 |
#define PSRES_NAME "PSres.upr" |
| 55 |
#endif |
| 56 |
|
| 57 |
#ifndef RB |
| 58 |
#define RB "r" |
| 59 |
#endif |
| 60 |
|
| 61 |
#ifndef WB |
| 62 |
#define WB "w" |
| 63 |
#endif |
| 64 |
|
| 65 |
#ifndef MAXPATHLEN |
| 66 |
#define MAXPATHLEN 256 |
| 67 |
#endif |
| 68 |
|
| 69 |
#ifndef MAXSTRLEN |
| 70 |
#define MAXSTRLEN 256 |
| 71 |
#endif |
| 72 |
|
| 73 |
#ifndef IS_DIR_SEP |
| 74 |
#define IS_DIR_SEP(c) ((c) == DIRSEP) |
| 75 |
#endif |
| 76 |
|
| 77 |
#define NOBASICS |
| 78 |
#endif |
| 79 |
|
| 80 |
#include <stdarg.h> |
| 81 |
|
| 82 |
#if defined __GNUC__ && __GNUC__ >=3 |
| 83 |
__attribute__((__noreturn__)) |
| 84 |
#elif defined _MSC_VER && 1200 <= _MSC_VER |
| 85 |
__declspec (noreturn) |
| 86 |
#endif |
| 87 |
void fatal(const char *fmt, ...); |
| 88 |
void msg(const char *fmt, ...); |
| 89 |
|
| 90 |
extern char *encfile, *afmfile; |
| 91 |
|
| 92 |
/* For debugging purposes it is handy to have a fopen() function that |
| 93 |
* shows which files are opened. |
| 94 |
*/ |
| 95 |
|
| 96 |
#include <stdio.h> |
| 97 |
#include <stdlib.h> |
| 98 |
#include <sys/types.h> /* struct stat */ |
| 99 |
#include <sys/stat.h> /* stat() */ |