]> arthur.barton.de Git - ngircd-alex.git/blob - src/portab/portab.h
Debine NDEBUG if DEBUG isn't defined to disable all assert() checks as well.
[ngircd-alex.git] / src / portab / portab.h
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * Please read the file COPYING, README and AUTHORS for more information.
10  *
11  * $Id: portab.h,v 1.19 2005/03/30 16:37:02 alex Exp $
12  *
13  * Portability functions and declarations (header for libngbportab).
14  */
15
16
17 #ifndef __PORTAB__
18 #define __PORTAB__
19
20
21 #include "config.h"
22
23 #ifndef DEBUG
24 # define NDEBUG
25 #endif
26
27 #ifdef HAVE_SYS_TYPES_H
28 # include <sys/types.h>
29 #endif
30
31 #ifdef HAVE_INTTYPES_H
32 # include <inttypes.h>
33 # define NGIRC_GOT_INTTYPES
34 #else
35 # ifdef HAVE_STDINT_H
36 #  include <stdint.h>
37 #  define NGIRC_GOT_INTTYPES
38 # endif
39 #endif
40
41 #ifdef HAVE_STDDEF_H
42 # include <stddef.h>
43 #endif
44
45 #ifdef HAVE_STDBOOL_H
46 # include <stdbool.h>
47 #endif
48
49 /* compiler features */
50
51 #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
52 # define PUNUSED(x) __attribute__ ((unused)) x
53 # define UNUSED     __attribute__ ((unused))
54 #else
55 # define PUNUSED(x) x
56 # define UNUSED
57 #endif
58
59 #ifndef PARAMS
60 # if PROTOTYPES
61 #  define PARAMS(args) args
62 # else
63 #  define PARAMS(args) ()
64 # endif
65 #endif
66
67
68 /* keywords */
69 #define LOCAL static
70
71 /* datatypes */
72
73 #ifndef PROTOTYPES
74 # ifndef signed
75 #  define signed
76 # endif
77 #endif
78
79 typedef void POINTER;
80
81 #ifdef NGIRC_GOT_INTTYPES
82 typedef uint8_t UINT8;
83 typedef uint16_t UINT16;
84 typedef uint32_t UINT32;
85 #else
86 typedef unsigned char UINT8;
87 typedef unsigned short UINT16;
88 typedef unsigned int UINT32;
89 #endif
90
91 #ifndef HAVE_STDBOOL_H
92 typedef unsigned char bool;
93 #define true (bool)1
94 #define false (bool)0
95 #endif
96
97 #ifndef NULL
98 #ifdef PROTOTYPES
99 # define NULL (void *)0
100 #else
101 # define NULL 0L
102 #endif
103 #endif
104
105 #undef GLOBAL
106 #define GLOBAL
107
108
109 /* SPLint */
110
111
112 #ifdef S_SPLINT_S
113 #include "splint.h"
114 #endif
115
116
117 /* target constants  */
118
119 #ifndef TARGET_OS
120 #define TARGET_OS "unknown"
121 #endif
122
123 #ifndef TARGET_CPU
124 #define TARGET_CPU "unknown"
125 #endif
126
127 #ifndef TARGET_VENDOR
128 #define TARGET_VENDOR "unknown"
129 #endif
130
131
132 /* configure options */
133
134 #ifndef HAVE_socklen_t
135 #define socklen_t int                   /* u.a. fuer Mac OS X */
136 #endif
137
138 #ifndef HAVE_SNPRINTF
139 extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
140 #endif
141
142 #ifndef HAVE_STRLCAT
143 extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
144 #endif
145
146 #ifndef HAVE_STRLCPY
147 extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
148 #endif
149
150 #ifndef HAVE_VSNPRINTF
151 #include <stdarg.h>
152 extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
153 #endif
154
155 #ifndef PACKAGE_NAME
156 #define PACKAGE_NAME PACKAGE
157 #endif
158
159 #ifndef PACKAGE_VERSION
160 #define PACKAGE_VERSION VERSION
161 #endif
162
163
164 #endif
165
166
167 /* -eof- */