/* ---------------------------------------------------------------------- */
/*                   Copyright (C) 1991 by Natuerlich!                    */
/*                      This file is copyrighted!                         */
/*                Refer to the documentation for details.                 */
/* ---------------------------------------------------------------------- */
#ifndef __DEFINES__
# define __DEFINES__

# define UE__          'u', 'e'   /* or ue character */
# define INCOMPATIBLE  0U
# define VERSION       2U

# define DVERSION      (VERSION | (INCOMPATIBLE << 8))
# define ASMREVISION   0   /* was 2.0 */
# define LINKREVISION  0   /* was 2.0 */
# define LIBREVISION   0   /* was 2.0 */

                                          /* object read compatibility */
# if VERSION                                          
# define OBJ_READ_COMP (1 | (INCOMPATIBLE << 8))  
# define LIB_READ_COMP (1 | (INCOMPATIBLE << 8))  
#else
# define OBJ_READ_COMP 0
# define LIB_READ_COMP 0
#endif

# define AUTHOR        'N','a','t',UE__,'r','l','i','c','h','!'
# define ORGANIZATION  'M','u','l','l','e',' ',                  \
                       'S','o','f','t','w','a','r','e',' ',      \
                       'D','e','s','i','g','n'      /* just for fun */


/* ----------------------------------------------------------
    This define file is supposed to be used for global hacks   
    to the source code (like turning debugging on) and ad-     
    justments to various operating systems or machineries.     
                                                              
    anyway some/most/all of this can be triggered my compiler  
    command line defines as well.                              
   ---------------------------------------------------------- */
# include "natdefs.h"

#if __TCPLUSPLUS__ || __STDC__
# define __NSTDC__  1
#endif


# if ! __NSTDC__
#  define signed
# endif

# if VERSION
#  define lint             1
# endif

# ifndef VERY_PRETTY
#  define VERY_PRETTY      1
# endif

# ifndef DEBUG                   /* for make friends */
#  define DEBUG            0
# endif

# ifndef EXPERIMENTAL            /* non-portable, useless code  */
#  define EXPERIMENTAL     0
# endif

# ifndef DORECLAIM               /* try to reclaim old expr ? */
#  define DORECLAIM        1
# endif

# if ! VERSION
#  define register
#  ifndef STATISTICS
#   define STATISTICS      1     /* USE ONLY WITH version SET to 0 */
#  endif
# else
#  ifdef STATISTICS
#   error "No statistix with version > 0"
#  endif
# endif


# include "localdef.h"

# if MACHINERY == MOTOROLA
#  undef  BIGENDIAN
#  define BIGENDIAN        0
#  ifndef WORD_EVEN
#   define WORD_EVEN       1
#  endif
# endif

# if MACHINERY == INTEL
#  define SUCKER           INTEL
#  undef  BIGENDIAN
#  define BIGENDIAN        1
#  ifndef WORD_EVEN
#   define WORD_EVEN       0
#  endif
# endif

# if MACHINERY != SUCKER || ! defined( __HUGE__) /* well.... */
#  define huge
# endif


# if OS == TOS                       /* Set some compiler pecularities */
#  if __TURBOC__
#   ifndef PHILOSOPHICAL_PROBLEM
#    define PHILOSOPHICAL_PROBLEM  0
#   endif
#   ifndef LATEPLUSPLUS
#    define LATEPLUSPLUS  0
#   endif
#   ifndef STSIZE
#    define STSIZE        4
#   endif
#   ifndef CANCONCAT
#    define CANCONCAT     1
#   endif
#  endif
#  ifndef WITHNOISY
#   define WITHNOISY      1         /* reminisce the good ol' times */
#  endif
# endif

# if OS == MSDOS
#  if __TCPLUSPLUS__
#   ifndef PHILOSOPHICAL_PROBLEM
#    define PHILOSOPHICAL_PROBLEM  1
#   endif
#   ifndef LATEPLUSPLUS
#    define LATEPLUSPLUS  1
#   endif
#   ifndef STSIZE
#    define STSIZE        2
#   endif
#   ifndef CANCONCAT
#    define CANCONCAT     1
#   endif
#  else
#   if __TURBOC__
#    ifndef PHILOSOPHICAL_PROBLEM
#     define PHILOSOPHICAL_PROBLEM  0
#    endif
#    ifndef LATEPLUSPLUS
#     define LATEPLUSPLUS  1
#    endif
#    ifndef STSIZE
#     define STSIZE        2
#    endif
#    ifndef CANCONCAT
#     define CANCONCAT     1
#    endif
#   endif
#  endif
# endif

# if OS == UNIX               /* this is for gcc */
#  ifndef PHILOSOPHICAL_PROBLEM
#   define PHILOSOPHICAL_PROBLEM  0
#  endif
#  ifndef LATEPLUSPLUS
#   define LATEPLUSPLUS  1
#  endif
#  ifndef STSIZE
#   define STSIZE        2
#  endif
#  ifndef CANCONCAT
#   define CANCONCAT     1
#  endif
# endif

# if OS == AMIGA
#  ifndef PHILOSOPHICAL_PROBLEM
#   define PHILOSOPHICAL_PROBLEM  1
#  endif
#  ifndef LATEPLUSPLUS
#   define LATEPLUSPLUS  1
#  endif
#  ifndef STSIZE
#   define STSIZE        2
#  endif
#  ifndef CANCONCAT
#   define CANCONCAT     2
#  endif
# endif

#define byte   unsigned _BYTE
#define word   unsigned _WORD
#define lword  unsigned _LONG
#define sbyte  signed   _BYTE
#define sword  signed   _WORD
#define slword signed   _LONG

/* -------------------------------------------------------------- */
/* Now trying to do this really portably come the definitions for */
/* the various compilers, operating systems and machinery.        */
/* File I/O on a binary level is unfortunately not very portable  */
/* so you have to manually declare some flags for OPEN & CREAT    */
/*                So far UNIX, MSDOS && TOS work.                 */
/* -------------------------------------------------------------- */
# if OS == TOS
#  define OPEN_W       0
#  define OPEN_R       1
#  define OPEN_RW      2
#  define CREAT_RW     0

#  define DIRSLASH     '\\'        /* for ye olde TOS machinery     */
#  define Xtolower( x) (((x) >= 'A' && (x) <= 'Z') ? (x) + 32 : (x))
#  define LOWERFILE    1
#  if __TURBOC__
#   define OSBIND      <tos.h>
#  else
#   define OSBIND      <osbind.h>
#  endif
#  define Fkreate( pathname, mode)  Fcreate( pathname, 0)
# else                                 /* for the rest of the world */
#  define OSBIND        "xosbind.h"    /* ..like this dog is portable.. */
# endif

# ifndef BCOPYTHERE
#  ifndef SUN
#   include <string.h>
#  endif
#  define bcopy( a, b, c) memcpy( (void *) (b), (void *) (a), (c))
#  define bzero( a, b)    memset( (void *) (a), 0, (b))
# endif

# ifndef _TO_UPPER_
extern byte            _uptable[];
#  define _TO_UPPER_   1
# endif

# define to_upper( c)      (_uptable[ (c)])

# if MSDOS && INTEL       /* This shit neccessary for INTEL */
#  define add_offset(p, o) \
        MK_FP(FP_SEG( p) + ((o) >> 4), FP_OFF( p) + ((o) & 0xF))
#  define get_ADDR( p)  (((lword) FP_SEG( p) << 4) + FP_OFF( p))
# else
#  define add_offset( p, o) ((char *) (p) + (o))
#  define get_ADDR( p)  ((lword) (p))
# endif

# if (__TURBOC__ || __TCPLUSPLUS__) && VERY_PRETTY
#  pragma warn -rvl     /* instead of very pretty                      */
#  pragma warn -pia     /* Don't want those if( foo = bar) warnings    */
#  pragma warn -pro     /* Also we don't care about prototypes anymore */
#  pragma warn +sig     /* (used to, but that's all over now)          */
#  pragma warn +use
#  pragma warn +stv
#  pragma warn +amb
#  pragma warn +amp
# endif

# define NMALLOC_H   "nmalloc.h"   /* predefine this */
/* ---------------------------------------------------------- */
/* If U do something to the source, here's your claim 2 fame  */
/* ---------------------------------------------------------- */
# define PORTED  OS != TOS && OS != MSDOS && OS != UNIX
# if PORTED            /* **-Port #3-** */
#  define PORTER  'y','o','u','r',' ','n','a','m','e'
# endif

# define ESTREAM      stdout
#endif
