diff options
Diffstat (limited to 'dviware/dvitops/util.h')
-rw-r--r-- | dviware/dvitops/util.h | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/dviware/dvitops/util.h b/dviware/dvitops/util.h new file mode 100644 index 0000000000..e63b605a53 --- /dev/null +++ b/dviware/dvitops/util.h @@ -0,0 +1,163 @@ +/* $Header: /usr/jjc/dvitops/RCS/util.h,v 1.7 90/10/16 07:53:45 jjc Exp $ */ + +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <math.h> +#include <time.h> +#include <errno.h> +#ifdef HAVE_MEMORY_H +#include <memory.h> +#endif /* HAVE_MEMORY_H */ + +#include "config.h" + +#ifndef DPI +#define DPI 300 +#endif + +#ifdef EBCDIC +#define XCHAR atoe +#endif + +#ifdef XCHAR +#define STRXCHAR(s) { char *p_; \ +for (p_ = s; *p_ != '\0'; p_++) *p_ = XCHAR(*p_); } +#else +#define STRXCHAR(s) /* as nothing */ +#endif + +#ifndef XCHAR +#define XCHAR(c) (c) +#endif + +#ifndef FOPEN_RB +#define FOPEN_RB(file) (fopen((file), "r")) +#endif + +#ifndef NORMAL_EXIT_CODE +#define NORMAL_EXIT_CODE 0 +#endif + +#ifndef WARNING_EXIT_CODE +#define WARNING_EXIT_CODE 1 +#endif + +#ifndef ERROR_EXIT_CODE +#define ERROR_EXIT_CODE 2 +#endif + +#ifndef FATAL_ERROR_EXIT_CODE +#define FATAL_ERROR_EXIT_CODE 3 +#endif + +#ifdef BROKEN_PROTO +#ifndef PROTO +#define PROTO +#endif +#define PROMOTED_UNSIGNED_CHAR unsigned char +#else +#define PROMOTED_UNSIGNED_CHAR int +#endif + +#ifdef STDARG +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#ifndef SEEK_CUR +#define SEEK_CUR 1 +#endif +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif +#ifndef SEEK_END +#define SEEK_END 2 +#endif +#ifdef PROTO +int abs(int); +char *getenv(char *); +int atoi(const char *); +long atol(const char *); +char *calloc(size_t, size_t); +void exit(int); +void free(char *); +char *getenv(char *); +char *malloc(size_t); +void qsort(char *, int, int, int (*)()); +char *realloc(char *, size_t); +double atof(const char *); +int getopt(int argc, char **argv, char *opts); +FILE *xfopen(char *filename, int is_binary, char *area_list, +char *extension); +#ifdef NEED_MEM_FUNCTIONS +int memcmp(char *, char *, int); +char *memcpy(char *, char *, int); +char *memset(char *, int, int); +#endif /* NEED_MEM_FUNCTIONS */ +time_t time(time_t *); +#ifdef NEED_STRTOK +char *strtok(char *, char *); +#endif +#ifdef CASE_INSENSITIVE_FILENAMES +int stricmp(char *, char *); +#endif +#else +int abs(); +char *getenv(); +double atof(); +int atoi(); +long atol(); +char *calloc(); +void exit(); +void free(); +char *getenv(); +char *malloc(); +void qsort(); +char *realloc(); +double atof(); +long atol(); +int getopt(); +FILE *xfopen(); +#ifdef NEED_MEM_FUNCTIONS +int memcmp(); +char *memcpy(); +char *memset(); +#endif /* NEED_MEM_FUNCTIONS */ +void qsort(); +time_t time(); +#ifdef NEED_STRTOK +char *strtok(); +#endif +#ifdef CASE_INSENSITIVE_FILENAMES +int stricmp(); +#endif +#endif + +extern int opterr; +extern int optind; +extern int optopt; +extern char *optarg; + +#define TRUE 1 +#define FALSE 0 + +#ifdef __FILE__ +#define cant_happen() message(FATAL_ERROR, "internal error: %s, line %d",\ +__FILE__, __LINE__) +#else +#define cant_happen() message(FATAL_ERROR, "internal error") +#endif + +#define out_of_memory() message(FATAL_ERROR, "out of memory") + +enum message_type {INFORMATION = 0, WARNING = 1, ERROR = 2, FATAL_ERROR = 3 }; + +extern enum message_type history; +extern char *program_name; + +#ifdef STDARG +void message(enum message_type, char *,...); +#else +void message(); +#endif |