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