home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 January / Chip_1997-01_cd.bin / ms95 / disk22 / dir04 / f012850.re_ / f012850.re
Text File  |  1996-04-02  |  6KB  |  198 lines

  1. /*----------------------------------------------------------------------+
  2. |                                    |
  3. |  Copyright (1992) Bentley Systems, Inc., All rights reserved.        |
  4. |                                    |
  5. |  "MicroStation", "MDL", and "MicroCSL" are trademarks of Bentley    |
  6. |  Systems, Inc.                            |
  7. |                                    |
  8. |  Limited permission is hereby granted to reproduce and modify this    |
  9. |  copyrighted material provided that the resulting code is used only     |
  10. |  in conjunction with Bentley Systems products under the terms of the    |
  11. |  license agreement provided therein, and that this notice is retained    |
  12. |  in its entirety in any such reproduction or modification.        |
  13. |                                    |
  14. +----------------------------------------------------------------------*/
  15. /*----------------------------------------------------------------------+
  16. |                                    |
  17. |   Current Revision:                            |
  18. |   $Workfile:   stdlib.h  $
  19. |   $Revision:   6.3  $  $Date:   07 Mar 1995 12:22:02  $
  20. |                                    |
  21. +----------------------------------------------------------------------*/
  22.  
  23. #if !defined (mdl)
  24. #error This file is intended for MDL only
  25. #endif
  26.  
  27. #if !defined (__stdlibH__)
  28. #define __stdlibH__
  29.  
  30. #include     "widechar.h"
  31.  
  32. /*----------------------------------------------------------------------+
  33. |                                    |
  34. |   Defines                                |
  35. |                                    |
  36. +----------------------------------------------------------------------*/
  37.  
  38. /*  const and volatile are not supported by the MDL compiler */
  39. #if !defined (const)
  40. #   define  const
  41. #   define  volatile
  42. #endif
  43.  
  44. /*  The function call "exit (EXIT_FAILURE)" causes MicroStation to
  45.     unload the MDL program and display a message. The function call
  46.     "exit (EXIT_SUCCESS)" causes MicroStation to unload the MDL program
  47.     without displaying a message.
  48. */
  49. #define EXIT_FAILURE 1
  50. #define EXIT_SUCCESS 0
  51.  
  52. /*----------------------------------------------------------------------+
  53. |                                    |
  54. |   Typedefs                                |
  55. |                                    |
  56. +----------------------------------------------------------------------*/
  57.  
  58. #if !defined (__SIZE_T)
  59. #    define __SIZE_T
  60.      typedef unsigned int size_t;
  61. #endif
  62.  
  63. #if !defined (__DIV_T)
  64. #    define __DIV_T
  65.  
  66. typedef struct
  67.     {
  68.     int        quot;    /* quotient */
  69.     int        rem;    /* remainder */
  70.     } div_t;
  71.  
  72. typedef struct
  73.     {
  74.      long   quot;    /* quotient */
  75.      long   rem;    /* remainder */
  76.      } ldiv_t;
  77.  
  78. #endif
  79.  
  80. #if !defined (RAND_MAX)
  81. #   if defined (hp700) || defined (sparc) || defined (macintosh) || \
  82.        defined (winNT) || defined (rs6000) || defined (sgimips) || \
  83.        defined(SolarisX86) || defined (os2)
  84. #       define RAND_MAX        32767
  85. #   elif defined (clipper)
  86. #    define RAND_MAX        (2029052025-1)
  87. #   elif defined (pm386) || defined (vax)
  88. #    define RAND_MAX        2147483647
  89. #   else
  90. #    error RAND_MAX is not defined for this platform
  91. #   endif
  92. #endif
  93.  
  94. /*----------------------------------------------------------------------+
  95. |                                    |
  96. |   Functions                               |
  97. |                                    |
  98. +----------------------------------------------------------------------*/
  99.  
  100. double         atof (const char *);
  101. int         atoi (const char *);
  102. long int     atol (const char *);
  103. double         strtod (const char *, char **);
  104. long int     strtol (const char *, char **, int);
  105. unsigned long strtoul(const char *, char **, int);
  106. int         rand (void);
  107. void         srand (unsigned int);
  108. void        *calloc(size_t, size_t);
  109. void        *malloc(size_t);
  110. void        *realloc(void *, size_t);
  111. void         free (void *);
  112.  
  113. void         abort (void);
  114. void         exit (int);
  115.  
  116. /*  atexit is not currently supported by MDL. See the function
  117.     mdlSystem_setFunction for information on setting up
  118.     an UNLOAD user hook.
  119. */
  120.  
  121. char        *getenv(const char *);
  122.     
  123. /*  putenv is only available on systems where the underlying
  124.     operating system supports it.  It is not an ANSI-standard 
  125.     function.  MDL programs should use mdlSystem_putenv or one of 
  126.     the mdlSystem_ cfgVar symbols.
  127. */
  128. int         putenv (char *);
  129.     
  130.  
  131. /*  The function "system" is not available.
  132.     
  133.     The function system was added in MicroStation release 4.2.
  134.     See mdlExternal_startProgram and mdlExternal_wait for equivalent
  135.     functionality for starting external programs.  See the 
  136.     mdlSystem_start... functions for starting ther MDL programs.
  137. */
  138.  
  139. /*  The function qsort was added in MicroStation release 4.2.
  140.     See the functions mdlUtil_quickSort, mdlUtil_sortDoubles,
  141.     mdlUtil_sortLongs, and mdlUtil_sortStrings for replacements for
  142.     qsort.  mdlUtil_sortDoubles, mdlUtil_sortLongs, mdlUtil_sortStrings
  143.     are all faster the qsort since they do not use any MDL code to
  144.     perform the sort.
  145. */
  146. void         qsort (void *baseP, size_t members, size_t sizeMember,
  147.             int (*compareFunc)(void *, void *));
  148.  
  149. /* The function bsearch was added in MicroStation release 4.2 */
  150. void        *bsearch (void *key, void *base, size_t members,
  151.             size_t sizeMember, int (*compareFunc)(void *, void *));
  152.  
  153. int         abs (int);
  154.  
  155. /*  div and ldiv are not supported because MDL does not support returning
  156.     structures. */
  157. #if 0
  158. div_t         div (int, int);
  159. ldiv_t         ldiv (long int, long int);
  160. #endif
  161.  
  162. long int     labs(long int);
  163.  
  164. /*  Common extensions */
  165. char        *getcwd (char *bufP, size_t size);
  166. int         access (char *pathP, int mode);
  167. int         mblen(const char *, size_t);
  168.  
  169. int mbtowc        /* <= # of bytes converted, -1 means error */
  170. (
  171. MSWideChar  *wchar,    /* <= ptr to wide char */
  172. char        *mbchar,    /* => ptr to mb char to convert */
  173. size_t          maxLen    /* => max bytes of multibyte char */
  174. );
  175.  
  176. int wctomb        /* <= # of bytes stored, -1 means error */
  177. (
  178. char        *mbchar,    /* <= buffer to store converted mb char */
  179. int         wchar    /* => wide char to convert */
  180. );
  181.  
  182. size_t    mbstowcs    /* <= # of wide characters stored in wcs */
  183. (
  184. MSWideChar  *wcs,     /* <= converted wide character string */
  185. char         *mbs,     /* => multibyte character string to convert */
  186. size_t         n        /* => number of characters in wcs */
  187. );
  188.  
  189. size_t    wcstombs    /* <= # of bytes stored in mbs */
  190. (
  191. char         *mbs,    /* <= converted multibyte character string */
  192. MSWideChar  *wcs,    /* => wide character string to convert */
  193. size_t         n        /* => number of bytes in mbs */
  194. );
  195.  
  196. #endif
  197.  
  198.