home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / d / desklib / !DeskLib / h_doc / Core < prev    next >
Encoding:
Text File  |  1996-06-03  |  3.8 KB  |  169 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Core.h
  12.     Author:  Copyright © 1992, 1993, 1994, 1995 Jason Williams, Tim Browse,
  13.                                                 Julian Smith, Sergio Monesi.
  14.     Version: 1.01 
  15.     Purpose: Core definitions used by most of DeskLib
  16.     History: 1.01 (02 Mar 1994)
  17.              1.02 (20 Mar 1995) JS Removed OSCLI if _desklib_DLL is defined.
  18.              1.03 (15 Jul 1995) SM Rmoved OSCLI since Desk_OS_CLI has been added
  19.                                 to KernelSWIs.h
  20.              1.04 (25 Jul 1995) JS Now #includes <stddef.h> rather than 
  21.                                 #defining NULL
  22. */
  23.  
  24.  
  25. #ifndef __Desk_Core_h
  26. #define __Desk_Core_h
  27.  
  28. #ifdef __cplusplus
  29.     extern "C" {
  30. #endif
  31.  
  32.  
  33.  
  34. typedef enum    {
  35.     Desk_bool_FALSE    = 0,
  36.     Desk_FALSE    = 0,
  37.     Desk_bool_TRUE    = 1,
  38.     Desk_TRUE    = 1
  39.     }
  40.     Desk_bool;
  41.  
  42.  
  43. #include <stddef.h>
  44. /*
  45. For NULL, size_t etc
  46. */
  47.  
  48.  
  49. #ifdef __CC_NORCROFT
  50.     #include "kernel.h"
  51.     typedef _kernel_oserror    Desk_os_error;
  52. /*
  53. Defining Desk_os_error in this way means that one can use Desk_os_error
  54. even when a _kernel_oserror is prototyped, which help when interfacing
  55. with non-Desk code.
  56.  
  57. However, it requires "kernel.h".
  58.  */
  59.  
  60. #else
  61.     typedef struct
  62.         {
  63.         int  errnum;
  64.         char errmess[252];
  65.         }
  66.         Desk_os_error;
  67. /*
  68. For users of non-Acorn compilers, which don't come with "kernel.h". The
  69. above fields are identical to those in _kernel_oserror.
  70.  */
  71. #endif
  72.  
  73.  
  74. #define Desk_UNUSED_ARG(x) ((x) = (x))
  75. /*
  76. A simple macro to avoid compiler warnings when you don't actually use
  77. one of the parameters passed to a particular function.
  78. Also useful for conditional compilation where one of the paths doesn't
  79. use a variable.
  80. */
  81.  
  82. #define Desk_UNUSED(x) ((x) = (x))
  83. /*
  84. A simple macro to avoid compiler warnings when you don't actually use
  85. one of the parameters passed to a particular function.
  86. Also useful for conditional compilation where one of the paths doesn't
  87. use a variable.
  88. */
  89.  
  90.  
  91. #ifndef Desk_MAX
  92.  
  93.   #define Desk_MAX(x, y)   ((x) > (y) ? (x) : (y))
  94.   #define Desk_MIN(x, y)   ((x) < (y) ? (x) : (y))
  95. /*
  96. Purpose:  The usual definitions of MAX and MIN. Not quite sure why
  97. the're here actually, but...
  98. */
  99. #endif
  100.  
  101.  
  102.  
  103.  
  104. /* Stuff for SDLS support within Desk sublibraries */
  105.  
  106. #if defined( Desk_SDLS_CLIENT) || defined( _DLL)
  107.   #define Desk__using_SDLS
  108. /*
  109. If defined, compilation is for a DLL client or DLL library. This is
  110. tested for in some of the other Desk header files.
  111. */
  112. #endif
  113.  
  114.  
  115. #if defined( Desk__MODULE_CLIENT) || defined( _DLL)
  116.     #define Desk__Zm
  117. /*
  118. So we know that compilation is with cc -Zm... This affects initialisation
  119. of static data.
  120.  */
  121.  
  122. #endif
  123.  
  124.  
  125. #ifdef _DLL
  126.  
  127. /*
  128. We are compiling a SDLS DLL. Due to DLLLib being rather unfriendly to
  129. other libraries, we have to predefine some things first...
  130.  */
  131.   #define __wimp_h
  132.   #define __os_h
  133.   #include "DLLLib.dll.h"
  134.  
  135.   #define Desk_SDLS_dllEntry( FnName) _dllEntry( FnName)
  136. /*
  137. This is only for use in SDLS libraries, for exporting functions as
  138. function pointers.
  139. */
  140.  
  141.   #define Desk_SDLS_PtrFn( staticextern, returntype, FnName)    \
  142.   extern returntype _dllEntry( FnName) ;                            \
  143.   extern returntype FnName
  144. /*
  145. This is only for use in SDLS libraries, for defining and prototyping
  146. functions which are exported as function pointers.
  147. */
  148.  
  149.  
  150. #else
  151.  
  152.   #define Desk_SDLS_dllEntry( FnName) FnName
  153.  
  154.  
  155.   #define Desk_SDLS_PtrFn( staticextern, returntype, FnName) \
  156.   staticextern returntype FnName
  157.  
  158. #endif
  159.  
  160.  
  161.  
  162.  
  163. #ifdef __cplusplus
  164. }
  165. #endif
  166.  
  167.  
  168. #endif
  169.