]> arthur.barton.de Git - ngircd-alex.git/blob - src/portab/portab.h
Remove INT, LONG, BOOLEAN, STATIC, CONST, CHAR datatypes.
[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.18 2005/03/19 18:43:50 fw 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 #ifdef HAVE_SYS_TYPES_H
24 # include <sys/types.h>
25 #endif
26
27 #ifdef HAVE_INTTYPES_H
28 # include <inttypes.h>
29 # define NGIRC_GOT_INTTYPES
30 #else
31 # ifdef HAVE_STDINT_H
32 #  include <stdint.h>
33 #  define NGIRC_GOT_INTTYPES
34 # endif
35 #endif
36
37 #ifdef HAVE_STDDEF_H
38 # include <stddef.h>
39 #endif
40
41 #ifdef HAVE_STDBOOL_H
42 # include <stdbool.h>
43 #endif
44
45 /* compiler features */
46
47 #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
48 # define PUNUSED(x) __attribute__ ((unused)) x
49 # define UNUSED     __attribute__ ((unused))
50 #else
51 # define PUNUSED(x) x
52 # define UNUSED
53 #endif
54
55 #ifndef PARAMS
56 # if PROTOTYPES
57 #  define PARAMS(args) args
58 # else
59 #  define PARAMS(args) ()
60 # endif
61 #endif
62
63
64 /* keywords */
65 #define LOCAL static
66
67 /* datatypes */
68
69 #ifndef PROTOTYPES
70 # ifndef signed
71 #  define signed
72 # endif
73 #endif
74
75 typedef void POINTER;
76
77 #ifdef NGIRC_GOT_INTTYPES
78 typedef uint8_t UINT8;
79 typedef uint16_t UINT16;
80 typedef uint32_t UINT32;
81 #else
82 typedef unsigned char UINT8;
83 typedef unsigned short UINT16;
84 typedef unsigned int UINT32;
85 #endif
86
87 #ifndef HAVE_STDBOOL_H
88 typedef unsigned char bool;
89 #define true (bool)1
90 #define false (bool)0
91 #endif
92
93 #ifndef NULL
94 #ifdef PROTOTYPES
95 # define NULL (void *)0
96 #else
97 # define NULL 0L
98 #endif
99 #endif
100
101 #undef GLOBAL
102 #define GLOBAL
103
104
105 /* SPLint */
106
107
108 #ifdef S_SPLINT_S
109 #include "splint.h"
110 #endif
111
112
113 /* target constants  */
114
115 #ifndef TARGET_OS
116 #define TARGET_OS "unknown"
117 #endif
118
119 #ifndef TARGET_CPU
120 #define TARGET_CPU "unknown"
121 #endif
122
123 #ifndef TARGET_VENDOR
124 #define TARGET_VENDOR "unknown"
125 #endif
126
127
128 /* configure options */
129
130 #ifndef HAVE_socklen_t
131 #define socklen_t int                   /* u.a. fuer Mac OS X */
132 #endif
133
134 #ifndef HAVE_SNPRINTF
135 extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
136 #endif
137
138 #ifndef HAVE_STRLCAT
139 extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
140 #endif
141
142 #ifndef HAVE_STRLCPY
143 extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
144 #endif
145
146 #ifndef HAVE_VSNPRINTF
147 #include <stdarg.h>
148 extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
149 #endif
150
151 #ifndef PACKAGE_NAME
152 #define PACKAGE_NAME PACKAGE
153 #endif
154
155 #ifndef PACKAGE_VERSION
156 #define PACKAGE_VERSION VERSION
157 #endif
158
159
160 #endif
161
162
163 /* -eof- */