]> arthur.barton.de Git - ngircd-alex.git/blob - src/portab/portab.h
Add Doxygen @file documentation to each source and header file
[ngircd-alex.git] / src / portab / portab.h
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2010 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
12
13 #ifndef __PORTAB__
14 #define __PORTAB__
15
16 /**
17  * @file
18  * Portability functions and declarations (header)
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 /* datatypes */
69
70 #ifndef PROTOTYPES
71 # ifndef signed
72 #  define signed
73 # endif
74 #endif
75
76 typedef void POINTER;
77
78 #ifdef NGIRC_GOT_INTTYPES
79 typedef uint8_t UINT8;
80 typedef uint16_t UINT16;
81 typedef uint32_t UINT32;
82 #else
83 typedef unsigned char UINT8;
84 typedef unsigned short UINT16;
85 typedef unsigned int UINT32;
86 #endif
87
88 #ifndef HAVE_STDBOOL_H
89 typedef unsigned char bool;
90 #define true (bool)1
91 #define false (bool)0
92 #endif
93
94 #ifndef NULL
95 #ifdef PROTOTYPES
96 # define NULL (void *)0
97 #else
98 # define NULL 0L
99 #endif
100 #endif
101
102 #ifdef NeXT
103 #define S_IRUSR 0000400         /* read permission, owner */
104 #define S_IWUSR 0000200         /* write permission, owner */
105 #define S_IRGRP 0000040         /* read permission, group */
106 #define S_IROTH 0000004         /* read permission, other */
107 #define ssize_t int
108 #endif
109
110 #undef GLOBAL
111 #define GLOBAL
112
113
114 /* SPLint */
115
116
117 #ifdef S_SPLINT_S
118 #include "splint.h"
119 #endif
120
121
122 /* target constants  */
123
124 #ifndef TARGET_OS
125 #define TARGET_OS "unknown"
126 #endif
127
128 #ifndef TARGET_CPU
129 #define TARGET_CPU "unknown"
130 #endif
131
132 #ifndef TARGET_VENDOR
133 #define TARGET_VENDOR "unknown"
134 #endif
135
136
137 /* configure options */
138
139 #ifndef HAVE_socklen_t
140 typedef int socklen_t;                  /* for Mac OS X, amongst others */
141 #endif
142
143 #ifndef HAVE_SNPRINTF
144 extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
145 #endif
146
147 #ifndef HAVE_STRLCAT
148 extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
149 #endif
150
151 #ifndef HAVE_STRLCPY
152 extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
153 #endif
154
155 #ifndef HAVE_STRDUP
156 extern char * strdup PARAMS(( const char *s ));
157 #endif
158
159 #ifndef HAVE_STRTOK_R
160 extern char * strtok_r PARAMS((char *str, const char *delim, char **saveptr));
161 #endif
162
163 #ifndef HAVE_VSNPRINTF
164 #include <stdarg.h>
165 extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
166 #endif
167
168 #ifndef PACKAGE_NAME
169 #define PACKAGE_NAME PACKAGE
170 #endif
171
172 #ifndef PACKAGE_VERSION
173 #define PACKAGE_VERSION VERSION
174 #endif
175
176
177 #endif
178
179
180 /* -eof- */