OS_NS_stdlib.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   OS_NS_stdlib.h
00006  *
00007  *  OS_NS_stdlib.h,v 1.12 2005/10/28 16:14:54 ossama Exp
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00010  *  @author Jesper S. M|ller<stophph@diku.dk>
00011  *  @author and a cast of thousands...
00012  *
00013  *  Originally in OS.h.
00014  */
00015 //=============================================================================
00016 
00017 #ifndef ACE_OS_NS_STDLIB_H
00018 # define ACE_OS_NS_STDLIB_H
00019 
00020 # include /**/ "ace/pre.h"
00021 
00022 # include "ace/config-all.h"
00023 
00024 # if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 #  pragma once
00026 # endif /* ACE_LACKS_PRAGMA_ONCE */
00027 
00028 #include "ace/os_include/os_stdlib.h"
00029 #include "ace/ACE_export.h"
00030 
00031 #if defined (ACE_EXPORT_MACRO)
00032 #  undef ACE_EXPORT_MACRO
00033 #endif
00034 #define ACE_EXPORT_MACRO ACE_Export
00035 
00036 # if defined (ACE_HAS_BROKEN_R_ROUTINES)
00037 #   undef rand_r
00038 # endif /* ACE_HAS_BROKEN_R_ROUTINES */
00039 
00040 // We need this for MVS... as well as Linux, etc...
00041 // On Windows, we explicitly set this up as __cdecl so it's correct even
00042 // if building with another calling convention, such as __stdcall.
00043 #if defined (ACE_WIN32) && defined (_MSC_VER)
00044 extern "C" {
00045   typedef int (__cdecl *ACE_COMPARE_FUNC)(const void *, const void *);
00046 }
00047 #else
00048 extern "C" {
00049   typedef int (*ACE_COMPARE_FUNC)(const void *, const void *);
00050 }
00051 #endif /* ACE_WIN32 && _MSC_VER */
00052 
00053 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00054 
00055 namespace ACE_OS {
00056 
00057   /** @name Non-standard functions
00058    *
00059    *  These functions aren't in the standard.
00060    *
00061    */
00062   //@{
00063 
00064 
00065   ACE_NAMESPACE_INLINE_FUNCTION
00066   void _exit (int status = 0);
00067 
00068   ACE_NAMESPACE_INLINE_FUNCTION
00069   void abort (void);
00070 
00071   ACE_NAMESPACE_INLINE_FUNCTION
00072   int atexit (ACE_EXIT_HOOK func);
00073 
00074   ACE_NAMESPACE_INLINE_FUNCTION
00075   int atoi (const char *s);
00076 
00077 # if defined (ACE_HAS_WCHAR)
00078   ACE_NAMESPACE_INLINE_FUNCTION
00079   int atoi (const wchar_t *s);
00080 # endif /* ACE_HAS_WCHAR */
00081 
00082   // atop not in spec
00083 # if defined (atop)
00084 #   undef atop
00085 # endif /* atop */
00086 
00087   ACE_NAMESPACE_INLINE_FUNCTION
00088   void *atop (const char *s);
00089 
00090 # if defined (ACE_HAS_WCHAR)
00091   ACE_NAMESPACE_INLINE_FUNCTION
00092   void *atop (const wchar_t *s);
00093 # endif /* ACE_HAS_WCHAR */
00094 
00095   ACE_NAMESPACE_INLINE_FUNCTION
00096   void *bsearch (const void *key,
00097                  const void *base,
00098                  size_t nel,
00099                  size_t size,
00100                  ACE_COMPARE_FUNC);
00101 
00102   extern ACE_Export
00103   void *calloc (size_t elements, size_t sizeof_elements);
00104 
00105   extern ACE_Export
00106   void exit (int status = 0);
00107 
00108   extern ACE_Export
00109   void free (void *);
00110 
00111   ACE_NAMESPACE_INLINE_FUNCTION
00112   char *getenv (const char *symbol);
00113 
00114 #   if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
00115   ACE_NAMESPACE_INLINE_FUNCTION
00116   wchar_t *getenv (const wchar_t *symbol);
00117 #   endif /* ACE_HAS_WCHAR && ACE_WIN32 */
00118 
00119   // not in spec
00120   extern ACE_Export
00121   ACE_TCHAR *getenvstrings (void);
00122 
00123   // itoa not in spec
00124   /// Converts an integer to a string.
00125   ACE_NAMESPACE_INLINE_FUNCTION
00126   char *itoa (int value, char *string, int radix);
00127 
00128 #if defined (ACE_HAS_WCHAR)
00129   /// Converts an integer to a string.
00130   ACE_NAMESPACE_INLINE_FUNCTION
00131   wchar_t *itoa (int value, wchar_t *string, int radix);
00132 #endif /* ACE_HAS_WCHAR */
00133 
00134 #if !defined (ACE_HAS_ITOA)
00135   /// Emulated itoa - Converts an integer to a string.
00136   extern ACE_Export
00137   char *itoa_emulation (int value, char *string, int radix);
00138 #endif /* !ACE_HAS_ITOA */
00139 
00140 #if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_ITOW)
00141   /// Emulated itow - Converts an integer to a string.
00142   extern ACE_Export
00143   wchar_t *itow_emulation (int value, wchar_t *string, int radix);
00144 #endif /* ACE_HAS_WCHAR && ACE_LACKS_ITOW */
00145 
00146   extern ACE_Export
00147   void *malloc (size_t);
00148 
00149   ACE_NAMESPACE_INLINE_FUNCTION
00150   ACE_HANDLE mkstemp (char *s);
00151 
00152 #  if defined (ACE_HAS_WCHAR)
00153   ACE_NAMESPACE_INLINE_FUNCTION
00154   ACE_HANDLE mkstemp (wchar_t *s);
00155 #  endif /* ACE_HAS_WCHAR */
00156 
00157 #if defined (ACE_LACKS_MKSTEMP)
00158   extern ACE_Export
00159   ACE_HANDLE mkstemp_emulation (ACE_TCHAR * s);
00160 #endif /* ACE_LACKS_MKSTEMP */
00161 
00162 #if !defined (ACE_LACKS_MKTEMP)
00163   ACE_NAMESPACE_INLINE_FUNCTION
00164   char *mktemp (char *s);
00165 
00166 #  if defined (ACE_HAS_WCHAR)
00167   ACE_NAMESPACE_INLINE_FUNCTION
00168   wchar_t *mktemp (wchar_t *s);
00169 #  endif /* ACE_HAS_WCHAR */
00170 #else
00171   extern ACE_Export
00172   ACE_TCHAR *mktemp (ACE_TCHAR *s);
00173 #endif /* !ACE_LACKS_MSTEMP */
00174 
00175   ACE_NAMESPACE_INLINE_FUNCTION
00176   int putenv (const char *string);
00177 
00178 #if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
00179   // Windows is the only platform that supports a wchar_t environment.
00180   // Since other platforms make @a string part of the environment, it's
00181   // a certain memory leak to copy and transform wchar_t to char for
00182   // emulating this, so it's not attempted.
00183   ACE_NAMESPACE_INLINE_FUNCTION
00184   int putenv (const wchar_t *string);
00185 #endif /* ACE_HAS_WCHAR && ACE_WIN32 */
00186 
00187   ACE_NAMESPACE_INLINE_FUNCTION
00188   void qsort (void *base,
00189               size_t nel,
00190               size_t width,
00191               ACE_COMPARE_FUNC);
00192 
00193   ACE_NAMESPACE_INLINE_FUNCTION
00194   int rand (void);
00195 
00196   ACE_NAMESPACE_INLINE_FUNCTION
00197   int rand_r (ACE_RANDR_TYPE &seed);
00198 
00199   extern ACE_Export
00200   void *realloc (void *, size_t);
00201 
00202 #if !defined (ACE_HAS_WINCE)
00203 #  if !defined (ACE_LACKS_REALPATH)
00204   ACE_NAMESPACE_INLINE_FUNCTION
00205 #  else
00206   extern ACE_Export
00207 #  endif /* !ACE_LACKS_REALPATH */
00208   char *realpath (const char *file_name, char *resolved_name);
00209 
00210 #  if defined (ACE_HAS_WCHAR)
00211   ACE_NAMESPACE_INLINE_FUNCTION
00212   wchar_t *realpath (const wchar_t *file_name, wchar_t *resolved_name);
00213 #  endif /* ACE_HAS_WCHAR */
00214 #endif /* ACE_HAS_WINCE */
00215 
00216   // exit_hook and set_exit_hook not in spec
00217   /// Function that is called by <ACE_OS::exit>, if non-null.
00218   extern ACE_Export ACE_EXIT_HOOK exit_hook_;
00219 
00220   /// For use by ACE_Object_Manager only, to register its exit hook..
00221   ACE_NAMESPACE_INLINE_FUNCTION
00222   ACE_EXIT_HOOK set_exit_hook (ACE_EXIT_HOOK hook);
00223 
00224   ACE_NAMESPACE_INLINE_FUNCTION
00225   void srand (u_int seed);
00226 
00227   // not in spec
00228   ACE_NAMESPACE_INLINE_FUNCTION
00229   ACE_TCHAR *strenvdup (const ACE_TCHAR *str);
00230 
00231 #if !defined (ACE_LACKS_STRTOD)
00232   /// Converts a string to a double value (char version).
00233   ACE_NAMESPACE_INLINE_FUNCTION
00234   double strtod (const char *s, char **endptr);
00235 #endif /* !ACE_LACKS_STRTOD */
00236 
00237 #if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOD)
00238   /// Converts a string to a double value (wchar_t version).
00239   ACE_NAMESPACE_INLINE_FUNCTION
00240   double strtod (const wchar_t *s, wchar_t **endptr);
00241 #endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOD */
00242 
00243   /// Converts a string to a long value (char version).
00244   ACE_NAMESPACE_INLINE_FUNCTION
00245   long strtol (const char *s, char **ptr, int base);
00246 
00247 #if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOL)
00248   /// Converts a string to a long value (wchar_t version).
00249   ACE_NAMESPACE_INLINE_FUNCTION
00250   long strtol (const wchar_t *s, wchar_t **ptr, int base);
00251 #endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOL */
00252 
00253 #if defined (ACE_LACKS_STRTOL)
00254   extern ACE_Export
00255   long strtol_emulation (const char *nptr, char **endptr, int base);
00256 #endif /* ACE_LACKS_STRTOL */
00257 
00258   /// Converts a string to an unsigned long value (char version).
00259   ACE_NAMESPACE_INLINE_FUNCTION
00260   unsigned long strtoul (const char *s, char **ptr, int base);
00261 
00262 #if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOUL)
00263   /// Converts a string to an unsigned long value (wchar_t version).
00264   ACE_NAMESPACE_INLINE_FUNCTION
00265   unsigned long strtoul (const wchar_t *s, wchar_t **ptr, int base);
00266 #endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */
00267 
00268 #if defined (ACE_LACKS_STRTOUL)
00269   extern ACE_Export
00270   unsigned long strtoul_emulation (const char *nptr,
00271                                    char **endptr,
00272                                    int base);
00273 #endif /* ACE_LACKS_STRTOUL */
00274 
00275   ACE_NAMESPACE_INLINE_FUNCTION
00276   int system (const ACE_TCHAR *s);
00277 
00278 } /* namespace ACE_OS */
00279 
00280 ACE_END_VERSIONED_NAMESPACE_DECL
00281 
00282 # if defined (ACE_HAS_INLINED_OSCALLS)
00283 #   if defined (ACE_INLINE)
00284 #     undef ACE_INLINE
00285 #   endif /* ACE_INLINE */
00286 #   define ACE_INLINE inline
00287 #   include "ace/OS_NS_stdlib.inl"
00288 # endif /* ACE_HAS_INLINED_OSCALLS */
00289 
00290 # include /**/ "ace/post.h"
00291 #endif /* ACE_OS_NS_STDLIB_H */

Generated on Thu Nov 9 09:41:58 2006 for ACE by doxygen 1.3.6