PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/dep/ACE_wrappers/ace/OS_NS_stdlib.h

https://gitlab.com/Kanedias/MangosDeprecated
C Header | 332 lines | 209 code | 71 blank | 52 comment | 20 complexity | b66200682fa4362ec8258f3c6e0d1a4b MD5 | raw file
  1. // -*- C++ -*-
  2. //=============================================================================
  3. /**
  4. * @file OS_NS_stdlib.h
  5. *
  6. * $Id: OS_NS_stdlib.h 81804 2008-05-29 16:12:07Z vzykov $
  7. *
  8. * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
  9. * @author Jesper S. M|ller<stophph@diku.dk>
  10. * @author and a cast of thousands...
  11. *
  12. * Originally in OS.h.
  13. */
  14. //=============================================================================
  15. #ifndef ACE_OS_NS_STDLIB_H
  16. # define ACE_OS_NS_STDLIB_H
  17. # include /**/ "ace/pre.h"
  18. # include "ace/config-all.h"
  19. # if !defined (ACE_LACKS_PRAGMA_ONCE)
  20. # pragma once
  21. # endif /* ACE_LACKS_PRAGMA_ONCE */
  22. #include "ace/os_include/os_stdlib.h"
  23. #include /**/ "ace/ACE_export.h"
  24. #include "ace/Basic_Types.h" /* ACE_UINT64 and intptr_t in inl file */
  25. #if defined (ACE_EXPORT_MACRO)
  26. # undef ACE_EXPORT_MACRO
  27. #endif
  28. #define ACE_EXPORT_MACRO ACE_Export
  29. # if defined (ACE_HAS_BROKEN_R_ROUTINES)
  30. # undef rand_r
  31. # endif /* ACE_HAS_BROKEN_R_ROUTINES */
  32. // We need this for MVS... as well as Linux, etc...
  33. // On Windows, we explicitly set this up as __cdecl so it's correct even
  34. // if building with another calling convention, such as __stdcall.
  35. #if defined (ACE_WIN32) && defined (_MSC_VER)
  36. extern "C" {
  37. typedef int (__cdecl *ACE_COMPARE_FUNC)(const void *, const void *);
  38. }
  39. #else
  40. extern "C" {
  41. typedef int (*ACE_COMPARE_FUNC)(const void *, const void *);
  42. }
  43. #endif /* ACE_WIN32 && _MSC_VER */
  44. ACE_BEGIN_VERSIONED_NAMESPACE_DECL
  45. namespace ACE_OS {
  46. /** @name Non-standard functions
  47. *
  48. * These functions aren't in the standard.
  49. *
  50. */
  51. //@{
  52. ACE_NAMESPACE_INLINE_FUNCTION
  53. void _exit (int status = 0);
  54. ACE_NAMESPACE_INLINE_FUNCTION
  55. void abort (void);
  56. ACE_NAMESPACE_INLINE_FUNCTION
  57. int atexit (ACE_EXIT_HOOK func);
  58. ACE_NAMESPACE_INLINE_FUNCTION
  59. int atoi (const char *s);
  60. # if defined (ACE_HAS_WCHAR)
  61. ACE_NAMESPACE_INLINE_FUNCTION
  62. int atoi (const wchar_t *s);
  63. # endif /* ACE_HAS_WCHAR */
  64. // atop not in spec
  65. # if defined (atop)
  66. # undef atop
  67. # endif /* atop */
  68. ACE_NAMESPACE_INLINE_FUNCTION
  69. void *atop (const char *s);
  70. # if defined (ACE_HAS_WCHAR)
  71. ACE_NAMESPACE_INLINE_FUNCTION
  72. void *atop (const wchar_t *s);
  73. # endif /* ACE_HAS_WCHAR */
  74. ACE_NAMESPACE_INLINE_FUNCTION
  75. void *bsearch (const void *key,
  76. const void *base,
  77. size_t nel,
  78. size_t size,
  79. ACE_COMPARE_FUNC);
  80. extern ACE_Export
  81. void *calloc (size_t elements, size_t sizeof_elements);
  82. extern ACE_Export
  83. void exit (int status = 0);
  84. extern ACE_Export
  85. void free (void *);
  86. ACE_NAMESPACE_INLINE_FUNCTION
  87. char *getenv (const char *symbol);
  88. # if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
  89. ACE_NAMESPACE_INLINE_FUNCTION
  90. wchar_t *getenv (const wchar_t *symbol);
  91. # endif /* ACE_HAS_WCHAR && ACE_WIN32 */
  92. // not in spec
  93. extern ACE_Export
  94. ACE_TCHAR *getenvstrings (void);
  95. // itoa not in spec
  96. /// Converts an integer to a string.
  97. ACE_NAMESPACE_INLINE_FUNCTION
  98. char *itoa (int value, char *string, int radix);
  99. #if defined (ACE_HAS_WCHAR)
  100. /// Converts an integer to a string.
  101. ACE_NAMESPACE_INLINE_FUNCTION
  102. wchar_t *itoa (int value, wchar_t *string, int radix);
  103. #endif /* ACE_HAS_WCHAR */
  104. #if !defined (ACE_HAS_ITOA)
  105. /// Emulated itoa - Converts an integer to a string.
  106. extern ACE_Export
  107. char *itoa_emulation (int value, char *string, int radix);
  108. #endif /* !ACE_HAS_ITOA */
  109. #if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_ITOW)
  110. /// Emulated itow - Converts an integer to a string.
  111. extern ACE_Export
  112. wchar_t *itow_emulation (int value, wchar_t *string, int radix);
  113. #endif /* ACE_HAS_WCHAR && ACE_LACKS_ITOW */
  114. extern ACE_Export
  115. void *malloc (size_t);
  116. ACE_NAMESPACE_INLINE_FUNCTION
  117. ACE_HANDLE mkstemp (char *s);
  118. # if defined (ACE_HAS_WCHAR)
  119. ACE_NAMESPACE_INLINE_FUNCTION
  120. ACE_HANDLE mkstemp (wchar_t *s);
  121. # endif /* ACE_HAS_WCHAR */
  122. #if defined (ACE_LACKS_MKSTEMP)
  123. extern ACE_Export
  124. ACE_HANDLE mkstemp_emulation (ACE_TCHAR * s);
  125. #endif /* ACE_LACKS_MKSTEMP */
  126. #if !defined (ACE_LACKS_MKTEMP)
  127. ACE_NAMESPACE_INLINE_FUNCTION
  128. char *mktemp (char *s);
  129. # if defined (ACE_HAS_WCHAR)
  130. ACE_NAMESPACE_INLINE_FUNCTION
  131. wchar_t *mktemp (wchar_t *s);
  132. # endif /* ACE_HAS_WCHAR */
  133. #else
  134. extern ACE_Export
  135. ACE_TCHAR *mktemp (ACE_TCHAR *s);
  136. #endif /* !ACE_LACKS_MSTEMP */
  137. ACE_NAMESPACE_INLINE_FUNCTION
  138. int putenv (const char *string);
  139. #if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
  140. // Windows is the only platform that supports a wchar_t environment.
  141. // Since other platforms make @a string part of the environment, it's
  142. // a certain memory leak to copy and transform wchar_t to char for
  143. // emulating this, so it's not attempted.
  144. ACE_NAMESPACE_INLINE_FUNCTION
  145. int putenv (const wchar_t *string);
  146. #endif /* ACE_HAS_WCHAR && ACE_WIN32 */
  147. ACE_NAMESPACE_INLINE_FUNCTION
  148. void qsort (void *base,
  149. size_t nel,
  150. size_t width,
  151. ACE_COMPARE_FUNC);
  152. ACE_NAMESPACE_INLINE_FUNCTION
  153. int rand (void);
  154. ACE_NAMESPACE_INLINE_FUNCTION
  155. int rand_r (ACE_RANDR_TYPE &seed);
  156. extern ACE_Export
  157. void *realloc (void *, size_t);
  158. #if !defined (ACE_HAS_WINCE)
  159. # if !defined (ACE_LACKS_REALPATH)
  160. ACE_NAMESPACE_INLINE_FUNCTION
  161. # else
  162. extern ACE_Export
  163. # endif /* !ACE_LACKS_REALPATH */
  164. char *realpath (const char *file_name, char *resolved_name);
  165. # if defined (ACE_HAS_WCHAR)
  166. ACE_NAMESPACE_INLINE_FUNCTION
  167. wchar_t *realpath (const wchar_t *file_name, wchar_t *resolved_name);
  168. # endif /* ACE_HAS_WCHAR */
  169. #endif /* ACE_HAS_WINCE */
  170. // exit_hook and set_exit_hook not in spec
  171. /// Function that is called by <ACE_OS::exit>, if non-null.
  172. extern ACE_Export ACE_EXIT_HOOK exit_hook_;
  173. /// For use by ACE_Object_Manager only, to register its exit hook..
  174. ACE_NAMESPACE_INLINE_FUNCTION
  175. ACE_EXIT_HOOK set_exit_hook (ACE_EXIT_HOOK hook);
  176. ACE_NAMESPACE_INLINE_FUNCTION
  177. void srand (u_int seed);
  178. // not in spec
  179. extern ACE_Export
  180. ACE_TCHAR *strenvdup (const ACE_TCHAR *str);
  181. #if !defined (ACE_LACKS_STRTOD)
  182. /// Converts a string to a double value (char version).
  183. ACE_NAMESPACE_INLINE_FUNCTION
  184. double strtod (const char *s, char **endptr);
  185. #endif /* !ACE_LACKS_STRTOD */
  186. #if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOD)
  187. /// Converts a string to a double value (wchar_t version).
  188. ACE_NAMESPACE_INLINE_FUNCTION
  189. double strtod (const wchar_t *s, wchar_t **endptr);
  190. #endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOD */
  191. /// Converts a string to a long value (char version).
  192. ACE_NAMESPACE_INLINE_FUNCTION
  193. long strtol (const char *s, char **ptr, int base);
  194. #if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOL)
  195. /// Converts a string to a long value (wchar_t version).
  196. ACE_NAMESPACE_INLINE_FUNCTION
  197. long strtol (const wchar_t *s, wchar_t **ptr, int base);
  198. #endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOL */
  199. #if defined (ACE_LACKS_STRTOL)
  200. extern ACE_Export
  201. long strtol_emulation (const char *nptr, char **endptr, int base);
  202. #endif /* ACE_LACKS_STRTOL */
  203. /// Converts a string to an unsigned long value (char version).
  204. ACE_NAMESPACE_INLINE_FUNCTION
  205. unsigned long strtoul (const char *s, char **ptr, int base);
  206. #if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOUL)
  207. /// Converts a string to an unsigned long value (wchar_t version).
  208. ACE_NAMESPACE_INLINE_FUNCTION
  209. unsigned long strtoul (const wchar_t *s, wchar_t **ptr, int base);
  210. #endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */
  211. #if defined (ACE_LACKS_STRTOUL)
  212. extern ACE_Export
  213. unsigned long strtoul_emulation (const char *nptr,
  214. char **endptr,
  215. int base);
  216. #endif /* ACE_LACKS_STRTOUL */
  217. /// Converts a string to a 64 bit int value (char version).
  218. ACE_NAMESPACE_INLINE_FUNCTION
  219. ACE_UINT64 strtoull (const char *s, char **ptr, int base);
  220. #if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOULL)
  221. /// Converts a string to a 64 bit int value (wchar_t version).
  222. ACE_NAMESPACE_INLINE_FUNCTION
  223. ACE_UINT64 strtoull (const wchar_t *s, wchar_t **ptr, int base);
  224. #endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */
  225. #if defined (ACE_LACKS_STRTOULL)
  226. extern ACE_Export
  227. ACE_UINT64 strtoull_emulation (const char *nptr,
  228. char **endptr,
  229. int base);
  230. #endif /* ACE_LACKS_STRTOULL */
  231. ACE_NAMESPACE_INLINE_FUNCTION
  232. int system (const ACE_TCHAR *s);
  233. /// Get the name of the current program
  234. ///
  235. /// Originally from NetBSD, now found in *BSD, Cygwin, Darwin, etc.
  236. ACE_NAMESPACE_INLINE_FUNCTION
  237. const char *getprogname ();
  238. #if !defined (ACE_HAS_GETPROGNAME)
  239. extern ACE_Export
  240. const char *getprogname_emulation ();
  241. #endif /* !ACE_HAS_GETPROGNAME */
  242. /// Set the name of the current program
  243. ///
  244. /// Originally from NetBSD, now found in *BSD, Cygwin, Darwin, etc.
  245. ACE_NAMESPACE_INLINE_FUNCTION
  246. void setprogname (const char* name);
  247. #if !defined (ACE_HAS_SETPROGNAME)
  248. extern ACE_Export
  249. void setprogname_emulation (const char* name);
  250. #endif /* !ACE_HAS_SETPROGNAME */
  251. } /* namespace ACE_OS */
  252. ACE_END_VERSIONED_NAMESPACE_DECL
  253. # if defined (ACE_HAS_INLINED_OSCALLS)
  254. # if defined (ACE_INLINE)
  255. # undef ACE_INLINE
  256. # endif /* ACE_INLINE */
  257. # define ACE_INLINE inline
  258. # include "ace/OS_NS_stdlib.inl"
  259. # endif /* ACE_HAS_INLINED_OSCALLS */
  260. # include /**/ "ace/post.h"
  261. #endif /* ACE_OS_NS_STDLIB_H */