home *** CD-ROM | disk | FTP | other *** search
- /*
- std.h
- */
- /* Copyright (c) 1994 Christian F. Tschudin. All rights reserved.
-
- Distributed under the terms of the GNU General Public License
- version 2 of june 1991 as published by the Free Software
- Foundation, Inc.
-
- This file is part of M0.
-
- M0 is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY. No author or distributor accepts responsibility to anyone for
- the consequences of using it or for whether it serves any particular
- purpose or works at all, unless he says so in writing. Refer to the GNU
- General Public License for full details.
-
- Everyone is granted permission to copy, modify and redistribute M0, but
- only under the conditions described in the GNU General Public License.
- A copy of this license is supposed to have been given to you along with
- M0 so you can know your rights and responsibilities. It should be in a
- file named LICENSE. Among other things, the copyright notice and this
- notice must be preserved on all copies. */
-
- #ifndef STD_H
- #define STD_H
-
- /* include files: ----------------------------------------------------------- */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
-
- #ifdef __MSDOS__
- # include <alloc.h>
- # include <mem.h>
- #else
- # include <malloc.h>
- # include <memory.h>
- #endif
-
-
- /* data types: ------------------------------------------------------------- */
-
- typedef unsigned char byte;
-
- #ifdef __MSDOS__
- typedef byte huge *byteptr;
- #define malloc(n) farmalloc(n)
- #define realloc(s,n) farrealloc(s,n)
- #define calloc(n,s) farcalloc(n,s)
- #define free(p) farfree(p)
- #else
- typedef byte *byteptr;
- #endif
-
- typedef short sshort;
-
- /* we want signed and unsigned integers to be (at least) 32 bit wide: */
-
- #ifdef __MSDOS__
- typedef unsigned short ushort;
- typedef unsigned long uint;
- typedef long sint;
- typedef unsigned long uint32;
- #else
- typedef int sint;
- typedef unsigned int uint32;
- #endif
-
- #define swap_short(s) *(s) = (*(s)>>8) | (*(s)<<8)
- #define swap_int(l) *(l) = (*(l)<<24) | ((*(l)&0x0ff00L)<<8) | \
- ((*(l)&0x0ff0000L)>>8) | (0x0ffL&(*(l)>>24));
-
- /* compatibility issues: --------------------------------------------------- */
-
- #ifdef __MSDOS__
- # define LITTLE_ENDIAN
- # define DIRDELIMIT '\\'
- extern long gethostid(); /* in l_compat.c */
- #endif
-
- #ifdef unix
- # define DIRDELIMIT '/'
- # define randomize() srandom((long)time(NULL))
- #endif
-
- #ifdef __ultrix
- # define LITTLE_ENDIAN
- extern byteptr strdup(byteptr s); /* in l_compat.c */
- #endif
-
- #ifdef __alpha__
- # define LITTLE_ENDIAN
- #endif
-
- /* available channels: ---------------------------------------------------- */
-
- #define CHANNEL_CONSOLE /* for all environments */
-
- #ifdef SUNOS4
- # define CHANNEL_NIT
- # define CHANNEL_UDP
- #endif
-
- #ifdef SUNOS5
- #endif
-
- #ifdef __ultrix
- # define CHANNEL_UDP
- #endif
-
- #ifdef __osf__
- # define CHANNEL_UDP
- #endif
-
-
- #endif
-