/*
    ####             #    #     # #
    #   #            #    #       #          The FreeWare C library for
    #   #  ##   ###  #  # #     # ###             RISC OS machines
    #   # #  # #     # #  #     # #  #   ___________________________________
    #   # ####  ###  ##   #     # #  #
    #   # #        # # #  #     # #  #    Please refer to the accompanying
    ####   ### ####  #  # ##### # ###    documentation for conditions of use
    ________________________________________________________________________

    File:    Core.h
    Author:  Copyright  1992, 1993, 1994 Jason Williams and Tim Browse
    Version: 1.01 (02 Mar 1994)
    Purpose: Core definitions used by most of DeskLib
    Mods:    20 Mar 1995 Julian Smith 
             removed OSCLI if _desklib_DLL is defined.
             15 Jul 1995 Sergio Monesi 
             removed OSCLI since OS_CLI has been added to KernelSWIs.h
             25 Jul 1995 Julian Smith
             Now #includes <stddef.h> rather than #defining NULL
*/


#ifndef __dl_core_h
#define __dl_core_h

#ifdef __cplusplus
extern "C" {
#endif



/* --- Boolean values */
#ifndef BOOL
#define BOOL  unsigned

#define FALSE 0
#define TRUE  1

#define ERROR   1
#define NOERROR 0
#endif


#include <stddef.h>
/*
For NULL, size_t etc
*/


/* Operating system errors (== _kernel_oserror).
 * Conditional compilation to avoid clashes with EasyC's roslib and
 * Acorn's "os.h".
 */

#ifndef __roslib_h
  #ifndef __os_h
    typedef struct
    {
      int  errnum;
      char errmess[252];
    } os_error;
  #endif
#endif


#define UNUSED_ARG(x) ((x) = (x))
/*
A simple macro to avoid compiler warnings when you don't actually use
one of the parameters passed to a particular function.
Also useful for conditional compilation where one of the paths doesn't
use a variable.
*/

#define UNUSED(x) ((x) = (x))
/*
A simple macro to avoid compiler warnings when you don't actually use
one of the parameters passed to a particular function.
Also useful for conditional compilation where one of the paths doesn't
use a variable.
*/


#ifndef MAX

  #define MAX(x,y)   ((x) > (y) ? (x) : (y))
  #define MIN(x,y)   ((x) < (y) ? (x) : (y))
/*
Purpose:  The usual definitions of MAX and MIN.
*/
#endif




/* Stuff for SDLS support within DeskLib sublibraries */

#if defined( _DeskLib_SDLS_CLIENT) || defined( _DLL)
  #define _DeskLib_SDLS
/*
If defined, compilation is for a DLL client or DLL library. This is
tested for in some of the other DeskLib header files.
*/
#endif


#ifdef _DLL

  /* We are compiling a SDLS DLL */
  #define __wimp_h
  #define __os_h
  #include "DLLLib.dll.h"

  #define _DeskLib_SDLS_dllEntry( FnName) _dllEntry( FnName)
/*
This is only for use in SDLS libraries, for exporting functions as
function pointers.
*/

  #define _DeskLib_SDLS_PtrFn( staticextern, returntype, FnName)    \
  extern returntype _dllEntry( FnName) ;                            \
  extern returntype FnName
/*
This is only for use in SDLS libraries, for defining and prototyping
functions which are exported as function pointers.
*/


#else

  #define _DeskLib_SDLS_dllEntry( FnName) FnName


  #define _DeskLib_SDLS_PtrFn( staticextern, returntype, FnName) \
  staticextern returntype FnName

#endif



#ifdef __cplusplus
}
#endif


#endif
