home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Resources / Utilities / Partition Logic 0.68 / partlogic-0.68.iso / system / headers / stdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-10  |  3.1 KB  |  86 lines

  1. // 
  2. //  Visopsys
  3. //  Copyright (C) 1998-2007 J. Andrew McLaughlin
  4. //  
  5. //  This library is free software; you can redistribute it and/or modify it
  6. //  under the terms of the GNU Lesser General Public License as published by
  7. //  the Free Software Foundation; either version 2.1 of the License, or (at
  8. //  your option) any later version.
  9. //
  10. //  This library is distributed in the hope that it will be useful, but
  11. //  WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
  13. //  General Public License for more details.
  14. //
  15. //  You should have received a copy of the GNU Lesser General Public License
  16. //  along with this library; if not, write to the Free Software Foundation,
  17. //  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. //
  19. //  stdlib.h
  20. //
  21.  
  22. // This is the Visopsys version of the standard header file stdlib.h
  23.  
  24. #if !defined(_STDLIB_H)
  25.  
  26. #include <limits.h>
  27. #include <stddef.h>
  28. #include <sys/cdefs.h>
  29.  
  30. #define EXIT_FAILURE  -1
  31. #define EXIT_SUCCESS  0
  32. #define MB_CUR_MAX    MB_LEN_MAX
  33. #define RAND_MAX      UINT_MAX
  34.  
  35. #ifndef NULL
  36. #define NULL 0
  37. #endif
  38.  
  39. // We're supposed to define size_t here???  Same with wchar_t???  I thought
  40. // they were defined in stddef.h.  Oh well, we're including stddef.h anyway.
  41.  
  42. // Functions
  43. void abort(void) __attribute__((noreturn));
  44. int abs(int);
  45. #define atoi(string) ((int) _str2num(string, 10, 1))
  46. #define atoll(string) ((long long) _str2num(string, 10, 1))
  47. void *_calloc(size_t, size_t, const char *);
  48. #define calloc(num, size) _calloc(num, size, __FUNCTION__)
  49. void exit(int) __attribute__((noreturn));
  50. void _free(void *, const char *);
  51. #define free(ptr) _free(ptr, __FUNCTION__)
  52. long int labs(long int);
  53. void *_malloc(size_t, const char *);
  54. #define malloc(size) _malloc(size, __FUNCTION__)
  55. int mbtowc(wchar_t *, const char *, size_t);
  56. size_t mbstowcs(wchar_t *dest, const char *src, size_t n);
  57. int rand(void);
  58. void *_realloc(void *, size_t, const char *);
  59. #define realloc(ptr, size) _realloc(ptr, size, __FUNCTION__)
  60. char *realpath(const char *, char *);
  61. void srand(unsigned int);
  62. int system(const char *);
  63. int wctomb(char *, wchar_t);
  64.  
  65. // Not sure where else to put these
  66. #define max(a, b) ((a) > (b) ? (a) : (b))
  67. #define min(a, b) ((a) < (b) ? (a) : (b))
  68.  
  69. // These are unofficial, Andy-special extensions of the atoi() and atoll()
  70. // paradigm.
  71. #define atou(string) ((unsigned) _str2num(string, 10, 0))
  72. #define atoull(string) ((unsigned long long) _str2num(string, 10, 0))
  73. #define itoa(num, string) _num2str((int) num, string, 10, 1)
  74. #define itoux(num, string) _num2str((int) num, string, 16, 0)
  75. #define itox(num, string) _num2str((int) num, string, 16, 1)
  76. #define lltoa(num, string) _num2str((long long) num, string, 10, 1)
  77. #define lltoux(num, string) _num2str((long long) num, string, 16, 0)
  78. #define lltox(num, string) _num2str((long long) num, string, 16, 1)
  79. #define xtoi(string) ((int) _str2num(string, 16, 1))
  80. #define xtoll(string) ((long long) _str2num(string, 16, 1))
  81. #define ulltoa(num, string) _num2str((unsigned long long) num, string, 10, 0)
  82. #define utoa(num, string) _num2str((unsigned) num, string, 10, 0)
  83.  
  84. #define _STDLIB_H
  85. #endif
  86.