/usr/include/styx/sysbase0.h is in styx-dev 2.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | /* -------------------------------------------------------------------------- */
/* */
/* [sysbase0.h] Standard Definitions ( Part 0 ) */
/* */
/* Copyright (c) 1993 by D\olle, Manns */
/* -------------------------------------------------------------------------- */
/* File generated by 'ctoh'. Don't change manually. */
#ifndef sysbase0_INCL
#define sysbase0_INCL
#include "styconf0.h"
#include "syscbhdl.h"
#ifdef __cplusplus
extern "C" {
#endif
/* ---------------------- Global Types -------------------------------------- */
#ifdef _MSDOS
typedef long INT;
typedef long LONG_INT;
#define __FAR __far
#define __HUGE __huge
typedef void __HUGE *HugeCPtr;
#else
typedef int INT;
typedef long int LONG_INT;
#define __FAR
#define __HUGE
#define HugeCPtr StdCPtr
#define NewHMem NewMem
#define FreeHMem FreeMem
#endif
typedef void *StdCPtr;
#if !defined( __GNUC__ )
typedef signed char c_int8;
typedef signed short c_int16;
typedef signed long c_int32;
typedef unsigned char c_uint8;
typedef unsigned short c_uint16;
typedef unsigned long c_uint32;
#if defined(STYX_CONFIG_OSMS) && defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64
#define STYX_CONFIG_TINT64
typedef signed __int64 c_int64;
typedef unsigned __int64 c_uint64;
#endif
#else /*__GNUC__*/
#define STYX_CONFIG_TINT64
typedef int8_t c_int8;
typedef int16_t c_int16;
typedef int32_t c_int32;
typedef int64_t c_int64;
typedef u_int8_t c_uint8;
typedef u_int16_t c_uint16;
typedef u_int32_t c_uint32;
typedef u_int64_t c_uint64;
#endif
#define ConcreteImp(Name) struct Name##_imp
#define ConcreteDecl(Name) typedef ConcreteImp(Name) *Name
#define ConcreteType(Name) typedef ConcreteImp(Name) *Name; ConcreteImp(Name)
#define SizeOf(Name) sizeof(ConcreteImp(Name))
#define ExternalType(TYPENAME) ConcreteType(TYPENAME)
#define ExternalDecl(TYPENAME) ConcreteDecl(TYPENAME)
#define AbstractType(TYPENAME) typedef StdCPtr TYPENAME
#define AbstractHugeType( TYPENAME ) \
typedef HugeCPtr TYPENAME
#define Tupel( TYPENAME ) \
struct TYPENAME
AbstractType( Abs_T );
AbstractType( Any_T );
#define ABS_CAST(t,a) ((t)(long)(a))
#define intCAST(a) ABS_CAST(int,a)
/*NOCONVERSION*/
typedef unsigned char c_byte;
typedef unsigned short c_word;
#ifndef __cplusplus
typedef c_byte byte;
typedef c_word word;
#endif
/*NOCONVERSION*/
#define c_bool int
#define C_False 0
#define C_True 1
#ifndef __cplusplus
#define bool c_bool
#define False C_False
#define True C_True
#endif
/*NOCONVERSION*/
typedef c_byte *c_bstring; /* sizeof(long) Bytes Len, Len Bytes */
typedef char *c_string;
#ifndef __cplusplus
typedef c_string string;
#endif
#if defined(WEOF)
typedef wint_t wc_int;
typedef wchar_t wc_char;
typedef wchar_t *wc_string;
#define WCHAR_LITERAL(c) L##c
#else
typedef unsigned long wc_int;
typedef unsigned long wc_char;
typedef unsigned long *wc_string;
#define WCHAR_LITERAL(c) ((unsigned long)c)
#endif
#define OBJ_REF(obj) ( &(obj) )
#define REF_OBJ(objref) ( *(objref) )
#define _ (NULL)
#define STD_BUFFLEN 512
#define ERR_BUFFLEN 4096
#define _NO_DLL_EXPORT_
#if defined( _MSDOS ) || defined( _WIN32 )
#define _DLL_EXPORT_DECL_ extern __declspec( dllexport )
#define _DLL_EXPORT_ __declspec( dllexport )
#define _DLL_IMPORT_ __declspec( dllimport )
#define _C_DECL_ __cdecl
#else
#define _DLL_EXPORT_DECL_ extern
#define _DLL_EXPORT_
#define _DLL_IMPORT_
#define _C_DECL_
#endif
/* -------------------- CommandLine I/O & Exception ------------------------- */
FILE* StdOutFile(void)
#define STDOUT StdOutFile()
/* stdout */
;
FILE* StdErrFile(void)
#define STDERR StdErrFile()
/* stderr */
;
void fprint_raw(FILE* fp, c_string s, size_t size)
/* prints string 's' in a printable form to file 'fp'
'size' >= 0: number of characters to print
*/
;
void prMsg_stdout(c_string s)
/* prints string 's' in a printable form to stdout */
;
void prMsg_stderr(c_string s)
/* prints string 's' in a printable form to stderr */
;
void AbortApp(c_string errmsg)
#define STD_ERREXIT AbortApp("")
/* aborts application with error message 'errmsg' */
;
PHDL_TRAP getTrapHdl(void); /* gets the trap handler */
void setTrapHdl(PHDL_TRAP h_trap)
/* sets a trap handler
( xaron error callback )
*/
;
PHDL_ABORT getErrExitHdl(void); /* gets the abort handler */
void setErrExitHdl(PHDL_ABORT h_abort); /* sets an abort handler */
PHDL_FREEMEM getFreeMemHdl(void)
/* gets the handler to organize free memory from heap */
;
void setFreeMemHdl(PHDL_FREEMEM h_freemem)
/* sets a handler to organize free memory from heap */
;
void initStdFiles(FILE* out, FILE* err); /* overwrites stdout, stderr */
void quitStdFiles(void); /* resets stdout, stderr */
/* -------------------- Thread/Process Synchronisation ---------------------- */
StdCPtr initSem(c_string id, int maxcnt, int initcnt)
/* creates or opens semaphore 'id [NULL]' to synchronize
a maximum of 'maxcnt' concurrent threads
with an initial value of 'initcnt'
RC: semaphore or NULL
non-MS: 'id', 'maxcnt' not used
*/
;
c_bool quitSem(StdCPtr sem)
/* closes and - on OK - destroys semaphore 'sem'
RC: True=OK
*/
;
int waitSem(StdCPtr sem)
/*
waits and enters critical section 'sem' ( blocking )
RC: 1=OK, 0=occupied, -1=error
*/
;
int trySem(StdCPtr sem)
/*
tries to enter critical section 'sem' ( non-blocking )
RC: 1=OK, 0=occupied, -1=error
*/
;
c_bool postSem(StdCPtr sem, int cnt)
/*
leaves critical section 'sem' and releases 'cnt' resources
RC: True=OK
non-MS: 'cnt' not used (=1)
*/
;
/* -------------------- Error Handling -------------------------------------- */
typedef void (*PF_ERROR)(c_bool cond, c_string format, ...);
void ForceCore(void)
/* since we didn't find an appropriate function in the c-lib */
;
PF_ERROR _AssCheck(c_string kind, c_string file, int line)
/* saves assertion type, source position and
returns assert function
*/
;
#define c_assert (*(_AssCheck("Restriction error",__FILE__,__LINE__)))
#define c_bug (*(_AssCheck("Internal error", __FILE__,__LINE__)))
#define C_BUG c_bug(C_False,"")
#ifndef __cplusplus
#define assert c_assert
#define bug c_bug
#define BUG C_BUG
#endif
#define assert0(cond,txt) ((!(cond)) ? (c_assert(C_False,(txt)),0):0)
#define assert1(cond,txt,a1) ((!(cond)) ? (c_assert(C_False,(txt),(a1)),0):0)
#define assert2(cond,txt,a,b) ((!(cond)) ? (c_assert(C_False,(txt),(a),(b)),0):0)
#define bug0(cond,txt) ((!(cond)) ? (c_bug(C_False,(txt)),0):0)
#define bug1(cond,txt,a1) ((!(cond)) ? (c_bug(C_False,(txt),(a1)),0):0)
#define bug2(cond,txt,a,b) ((!(cond)) ? (c_bug(C_False,(txt),(a),(b)),0):0)
#define BUG_NULL(obj) bug0( (StdCPtr)(obj) != (StdCPtr)NULL, \
"Null Object" )
#define BUG_VRNG(val,min,max) bug0( (val) >= (min) && (val) <= (max), \
"Value out of Range" )
#define BUG_RNG0(val,max) BUG_VRNG((val),0,(max)-1)
#define BUG_RNG1(val,max) BUG_VRNG((val),1,(max))
#define BUG_VMIN(val,min) bug0( (val) > (min), "Value below Minimum" )
#define BUG_VEQU(lft,rgt) bug0( (lft) == (rgt), "Values not equal" )
#define BUG_VNEQ(lft,rgt) bug0( (lft) != (rgt), "Values equal" )
#define BUG_MOD0(lft,rgt) bug0( (rgt) > 0 && ! ( (lft) % (rgt) ), \
"Non Zero Modulo" )
/*
Usage of the macros 'assert', 'bug':
assert | bug ( condition, which has to be true,
message format string ( see printf ),
any further parameter, according to the above format string );
*/
/* ---------------------------- System-Init & Quit -------------------------- */
void sysbase_init(void); /* initializes module ( for thread-savety ) */
void sysbase_quit(void); /* terminates module ( for thread-savety ) */
StdCPtr sysbase_sem(void); /* system semaphore ( for thread-savety ) */
/* ---------------------------- Global Macros ------------------------------- */
#define I32_HIGHVAL(v) ( (short)(((long)(v)) >> 16) )
#define I32_LOWVAL(v) ( (short)(((long)(v)) & 0xFFFFL) )
#define SET_I32_VAL(h,l) ( ((((long)(h)) << 16) & 0xFFFF0000L) | \
(((long)(l)) & 0x0000FFFFL) )
#define STR_EMPTY(s) ( (s) == (c_string)NULL || *(s) == '\0' )
#define INRANGE(a,x,b) ( ( (a) <= (x) ) && ( (x) <= (b) ) )
#define ABS(x) ( (x) < 0 ? - (x) : (x) )
#define MAX(a,b) ( (a) < (b) ? (b) : (a) )
#define MIN(a,b) ( (a) < (b) ? ( a ) : (b) )
#define EQSIGN(a,b) ( ( ( (a) <= 0 ) && ( (b) <= 0 ) ) || \
( ( (a) >= 0 ) && ( (b) >= 0 ) ) )
#define FTAB(F,N) fprintf(F,"\n%*s",N,"")
#define FNLIND(F) FTAB(F,indent)
#define FNL(F) fprintf(F,"\n")
#define TAB(N) FTAB(STDOUT,N)
#define NLIND TAB(indent)
#define NL FNL(STDOUT)
#define FPCHR(F,C) fprintf(F,"%c",C)
#define PCHR(C) FPCHR(STDOUT,C)
#define FPNLSNL(F,S) fprintf(F,"\n%s\n",S)
#define PNLSNL(F,S) FPNLSNL(STDOUT,S)
#define HERE fprintf(STDOUT,"File: %s, Line: %d\n",__FILE__,__LINE__)
#ifdef __cplusplus
}
#endif
#endif
|