/*      standard.h                               28.02.95       */
/*
/  --------------------------------------------------------------
/  Copyright (C) 1993: Michael Braun
/                      Kaetinger Muehlenweg 103 A
/                      D-28816 Stuhr
/  --------------------------------------------------------------
/
/    header file for all c programs
/
*/


/************************/
/*  include files       */
/************************/

/* common include files */
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <signal.h>
#include <errno.h>
#include <time.h>

#if 0
#include <ctype.h>   darf nicht verwendet werden !!
                     (siehe config.h und memo_hnd.c)
#endif
     


/* operating system dependant include files */

#if (ACT_OP_SYSTEM == MS_DOS)
#include <stdlib.h>
#include <io.h>
#include <bios.h>
#include <malloc.h>
#include <conio.h>
#include <fcntl.h>
#include <dos.h>
#include <sys\types.h>
#include <sys\stat.h>
#endif


#if (ACT_OP_SYSTEM == OS_9)
#include <stdlib.h>
#include <io.h>
#include <sgstat.h> 
#include <inet/stat.h> 
#include <dir.h> 
#include <direct.h> 
#endif


#if (UNIX)

#ifndef CLOCKS_PER_SEC
#define CLOCKS_PER_SEC CLOCKS_PER_SECOND    /* e.g. UNIX_SVR4 */
#endif

#if (ACT_OP_SYSTEM != UNIX_SVR4)
#include <stdlib.h>
#else
   extern char *getenv (const char *name);
#endif

#if ((ACT_OP_SYSTEM == SCO_UNIX) && (WITH_WINCH == 3))
#define _IBCS2                   /* fuer ioctl (..., TIOCGWINSZ,...) */
#endif

#include <malloc.h>
#include <termio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <setjmp.h>
#include <dirent.h> 

/* labs ist sonst eine function definiert in stdlib.h und math.h */
#ifndef labs
#define labs abs
#endif

#ifndef const
#define const   /* nix */
#endif

#endif


/************************/
/* toupper / tolower    */
/************************/

/* switch (toupper(-nn)) bereitet unerklaerliche probleme, ferner sind     */
/* die return values der macros bzw. library-functionen sind fuer negative */
/* argumente fragwuerdig. deshalb beutze ich meine eigenen funktionen.     */
/* gleiches gilt auch fuer die is... functions (siehe auch memo_hnd.c).    */

#undef toupper
#undef tolower
#undef isdigit
#undef isxdigit
#undef isprint
#undef isspace

/* we use new function names to avoid linker conflicts */
#define toupper  mb_toupper
#define tolower  mb_tolower
#define isdigit  mb_isdigit
#define isxdigit mb_isxdigit
#define isprint  mb_isprint
#define isspace  mb_isspace


/************************/
/* often used macros    */
/************************/

#define _F_PTR(s,o) ( (void far *) ( ((unsigned long)(s) << 16u) + (o) ) )

#ifndef lengthof
#define lengthof(A) (sizeof(A)/sizeof(A[0]))
#endif

#ifndef min
#define min(a,b)        (((a) < (b)) ? (a) : (b))
#endif

#ifndef max
#define max(a,b)        (((a) > (b)) ? (a) : (b))
#endif


/************************/
/* often used defines   */
/************************/

#ifndef FALSE
#define FALSE 0
#endif

#ifndef TRUE
#define TRUE  1
#endif

#ifndef byte
#define byte  unsigned char
#endif

#ifndef word
#define word  unsigned short
#endif

#ifndef dword
#define dword unsigned long
#endif

#ifndef NULL
#define NULL 0
#endif


/************************/
/*  public variables    */
/************************/

#undef pubext
#ifdef _GLOBAL_
#define pubext
#else
#define pubext extern
#endif


/* Modification History */
/* 20.11.92 - file erzeugt */
/* 04.12.92 - ACT_OP_SYSTEM */
/* 19.12.92 - include malloc.h */
/* 21.12.92 - min, max */
/* 25.08.93 - Fallunterscheidung der Unix'e abgewandelt */
/* 29.08.93 - ms-dos: sys\types.h, sys\stat.h */
/* 30.08.93 - os/9  : modes.h, stat.h, unix: sys/stat.h */
/* 01.09.93 - #define NULL 0 */
/* 13.09.93 - UNIX_SVR4: prototype getenv() */
/* 13.09.93 - dirent.h */
/* 07.12.93 - define const (nix) */
/* 18.05.94 - macro lengthof mit #ifndef */
/* 04.07.94 - mb_isspace */
/* 21.07.94 - SCO_UNIX: _IBCS2 */
/* 28.02.95 - CLOCKS_PER_SEC(OND) */
