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