source: trunk/tools/wrc/utils.h@ 10367

Last change on this file since 10367 was 8596, checked in by sandervl, 23 years ago

KSO: compile fix

File size: 2.1 KB
Line 
1/*
2 * Utility routines' prototypes etc.
3 *
4 * Copyright 1998 Bertho A. Stultiens (BS)
5 *
6 */
7
8#ifndef __WRC_UTILS_H
9#define __WRC_UTILS_H
10
11#ifndef __WRC_WRCTYPES_H
12#include "wrctypes.h"
13#endif
14
15#include <stddef.h> /* size_t */
16
17#if defined(__DEBUG_ALLOC__) && defined(__IBMC__)
18void *_xmalloc(size_t, char*, int);
19void *_xrealloc(void *, size_t, char*, int);
20char *_xstrdup(const char *, char*, int);
21#define xmalloc(a) _xmalloc(a, __FILE__, __LINE__)
22#define xrealloc(a, b) _xrealloc(a, b, __FILE__, __LINE__)
23#define xstrdup(a) _xstrdup(a, __FILE__, __LINE__)
24#else
25void *xmalloc(size_t);
26void *xrealloc(void *, size_t);
27char *xstrdup(const char *str);
28#endif
29
30int pperror(const char *s, ...) __attribute__((format (printf, 1, 2)));
31int ppwarning(const char *s, ...) __attribute__((format (printf, 1, 2)));
32int yyerror(const char *s, ...) __attribute__((format (printf, 1, 2)));
33int yywarning(const char *s, ...) __attribute__((format (printf, 1, 2)));
34void internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4)));
35void error(const char *s, ...) __attribute__((format (printf, 1, 2)));
36void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
37void chat(const char *s, ...) __attribute__((format (printf, 1, 2)));
38
39char *dup_basename(const char *name, const char *ext);
40char *dupwstr2cstr(const short *str);
41short *dupcstr2wstr(const char *str);
42int compare_name_id(name_id_t *n1, name_id_t *n2);
43string_t *convert_string(const string_t *str, enum str_e type);
44void set_language(unsigned short lang, unsigned short sublang);
45
46#if defined(__IBMC__) || defined(__IBMCPP__)
47#undef strcasecmp
48INT WINAPI strcasecmp(LPCSTR p1, LPCSTR p2);
49
50/* Borrowed from Apache NT Port and PHP */
51
52extern char *ap_php_optarg;
53extern int ap_php_optind;
54extern int ap_php_opterr;
55extern int ap_php_optopt;
56int ap_php_getopt(int argc, char* const *argv, const char *optstr);
57
58#define getopt ap_php_getopt
59#define optarg ap_php_optarg
60#define optind ap_php_optind
61#define opterr ap_php_opterr
62#define optopt ap_php_optopt
63
64#endif
65
66#endif
Note: See TracBrowser for help on using the repository browser.