1 /* @(#)standard.h	1.40 13/05/01 Copyright 1985-2013 J. Schilling */
2 /*
3  *	standard definitions
4  *
5  *	This file should be included past:
6  *
7  *	mconfig.h / config.h
8  *	stdio.h
9  *	stdlib.h	(better use schily/stdlib.h)
10  *	unistd.h	(better use schily/unistd.h) needed f. LARGEFILE support
11  *
12  *	If you need stdio.h, you must include it before standard.h
13  *
14  *	Copyright (c) 1985-2013 J. Schilling
15  */
16 /*
17  * The contents of this file are subject to the terms of the
18  * Common Development and Distribution License, Version 1.0 only
19  * (the "License").  You may not use this file except in compliance
20  * with the License.
21  *
22  * See the file CDDL.Schily.txt in this distribution for details.
23  *
24  * When distributing Covered Code, include this CDDL HEADER in each
25  * file and include the License file CDDL.Schily.txt from this distribution.
26  */
27 
28 #ifndef _SCHILY_STANDARD_H
29 #define	_SCHILY_STANDARD_H
30 
31 #ifndef _SCHILY_MCONFIG_H
32 #include <schily/mconfig.h>
33 #endif
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #ifdef	M68000
40 #	ifndef	tos
41 #		define	JOS	1
42 #	endif
43 #endif
44 
45 /*
46  *	fundamental constants
47  */
48 #ifndef	NULL
49 #	define	NULL		0
50 #endif
51 #ifndef	TRUE
52 #	define	TRUE		1
53 #	define	FALSE		0
54 #endif
55 
56 /*
57  *	Program exit codes used with comerr(), comexit() and similar.
58  *
59  *	Exit codes between -2 and -63 are currently available to flag
60  *	program specific error conditions.
61  */
62 #define	EX_BAD			(-1)	/* Default error exit code	    */
63 #define	EX_CLASH		(-64)	/* Exit code used with exit clashes */
64 
65 /*
66  *	standard storage class definitions
67  */
68 #define	GLOBAL	extern
69 #define	IMPORT	extern
70 #define	EXPORT
71 #define	INTERN	static
72 #define	LOCAL	static
73 #define	FAST	register
74 
75 #ifndef	PROTOTYPES
76 #	ifndef	const
77 #		define	const
78 #	endif
79 #	ifndef	signed
80 #		define	signed
81 #	endif
82 #	ifndef	volatile
83 #		define	volatile
84 #	endif
85 #endif	/* PROTOTYPES */
86 
87 /*
88  *	standard type definitions
89  *
90  *	The hidden Schily BOOL definition is used in case we need to deal
91  *	with other BOOL defines on systems we like to port to.
92  */
93 typedef int __SBOOL;
94 typedef int BOOL;
95 #ifdef	JOS
96 #	ifndef	__GNUC__
97 #	define	NO_VOID
98 #	endif
99 #endif
100 #ifdef	NO_VOID
101 #	ifndef	lint
102 		typedef int void;
103 #	endif
104 #endif
105 
106 #if	defined(_INCL_SYS_TYPES_H) || defined(_INCL_TYPES_H) || defined(off_t)
107 #	ifndef	FOUND_OFF_T
108 #	define	FOUND_OFF_T
109 #	endif
110 #endif
111 #if	defined(_INCL_SYS_TYPES_H) || defined(_INCL_TYPES_H) || defined(size_t)
112 #	ifndef	FOUND_SIZE_T
113 #	define	FOUND_SIZE_T
114 #	endif
115 #endif
116 #if	defined(_MSC_VER) && !defined(_SIZE_T_DEFINED)
117 #	undef	FOUND_SIZE_T
118 #endif
119 
120 #ifdef	__never_def__
121 /*
122  * It turns out that we cannot use the folloginw definition because there are
123  * some platforms that do not behave application friendly. These are mainly
124  * BSD-4.4 based systems (which #undef a definition when size_t is available.
125  * We actually removed this code because of a problem with QNX Neutrino.
126  * For this reason, it is important not to include <sys/types.h> directly but
127  * via the Schily SING include files so we know whether it has been included
128  * before we come here.
129  */
130 #if	defined(_SIZE_T)	|| defined(_T_SIZE_)	|| defined(_T_SIZE) || \
131 	defined(__SIZE_T)	|| defined(_SIZE_T_)	|| \
132 	defined(_GCC_SIZE_T)	|| defined(_SIZET_)	|| \
133 	defined(__sys_stdtypes_h) || defined(___int_size_t_h) || defined(size_t)
134 
135 #ifndef	FOUND_SIZE_T
136 #	define	FOUND_SIZE_T	/* We already included a size_t definition */
137 #endif
138 #endif
139 #endif	/* __never_def__ */
140 
141 #ifdef	__cplusplus
142 }
143 #endif
144 
145 #if defined(_JOS) || defined(JOS)
146 #	ifndef	_SCHILY_SCHILY_H
147 #	include <schily/schily.h>
148 #	endif
149 
150 #	ifndef	_SCHILY_JOS_DEFS_H
151 #	include <schily/jos_defs.h>
152 #	endif
153 
154 #	ifndef	_SCHILY_JOS_IO_H
155 #	include <schily/jos_io.h>
156 #	endif
157 #endif
158 
159 #endif	/* _SCHILY_STANDARD_H */
160