/*
    ####             #    #     # #
    #   #            #    #       #          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, 1995 Jason Williams, Tim Browse,
                                                Julian Smith, Sergio Monesi.
    Version: 1.01 
    Purpose: Core definitions used by most of DeskLib
    History: 1.01 (02 Mar 1994)
             1.02 (20 Mar 1995) JS Removed OSCLI if _desklib_DLL is defined.
             1.03 (15 Jul 1995) SM Rmoved OSCLI since Desk_OS_CLI has been added
                                to KernelSWIs.h
             1.04 (25 Jul 1995) JS Now #includes <stddef.h> rather than 
                                #defining NULL
*/


#ifndef __Desk_Core_h
#define __Desk_Core_h

#ifdef __cplusplus
	extern "C" {
#endif



typedef enum	{
	Desk_bool_FALSE	= 0,
	Desk_FALSE	= 0,
	Desk_bool_TRUE	= 1,
	Desk_TRUE	= 1
	}
	Desk_bool;


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


#ifdef __CC_NORCROFT
	#include "kernel.h"
	typedef _kernel_oserror	Desk_os_error;
/*
Defining Desk_os_error in this way means that one can use Desk_os_error
even when a _kernel_oserror is prototyped, which help when interfacing
with non-Desk code.

However, it requires "kernel.h".
 */

#else
	typedef struct
		{
		int  errnum;
		char errmess[252];
		}
		Desk_os_error;
/*
For users of non-Acorn compilers, which don't come with "kernel.h". The
above fields are identical to those in _kernel_oserror.
 */
#endif


#define Desk_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 Desk_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 Desk_MAX

  #define Desk_MAX(x, y)   ((x) > (y) ? (x) : (y))
  #define Desk_MIN(x, y)   ((x) < (y) ? (x) : (y))
/*
Purpose:  The usual definitions of MAX and MIN. Not quite sure why
the're here actually, but...
*/
#endif




/* Stuff for SDLS support within Desk sublibraries */

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


#if defined( Desk__MODULE_CLIENT) || defined( _DLL)
	#define Desk__Zm
/*
So we know that compilation is with cc -Zm... This affects initialisation
of static data.
 */

#endif


#ifdef _DLL

/*
We are compiling a SDLS DLL. Due to DLLLib being rather unfriendly to
other libraries, we have to predefine some things first...
 */
  #define __wimp_h
  #define __os_h
  #include "DLLLib.dll.h"

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

  #define Desk_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 Desk_SDLS_dllEntry( FnName) FnName


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

#endif




#ifdef __cplusplus
}
#endif


#endif
