/trunk/Lib/inttypes.i

# · Swig · 91 lines · 46 code · 25 blank · 20 comment · 0 complexity · ecb9e595754659b0fa99b284e5b96237 MD5 · raw file

  1. /* -----------------------------------------------------------------------------
  2. * inttypes.i
  3. *
  4. * SWIG library file for ISO C99 types: 7.8 Format conversion of integer types <inttypes.h>
  5. * ----------------------------------------------------------------------------- */
  6. %{
  7. #include <inttypes.h>
  8. %}
  9. %include <stdint.i>
  10. %include <wchar.i>
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. #ifdef SWIGWORDSIZE64
  15. /* We have to define the `uintmax_t' type using `ldiv_t'. */
  16. typedef struct
  17. {
  18. long int quot; /* Quotient. */
  19. long int rem; /* Remainder. */
  20. } imaxdiv_t;
  21. #else
  22. /* We have to define the `uintmax_t' type using `lldiv_t'. */
  23. typedef struct
  24. {
  25. long long int quot; /* Quotient. */
  26. long long int rem; /* Remainder. */
  27. } imaxdiv_t;
  28. #endif
  29. /* Compute absolute value of N. */
  30. extern intmax_t imaxabs (intmax_t n);
  31. /* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */
  32. extern imaxdiv_t imaxdiv (intmax_t numer, intmax_t denom);
  33. /* Like `strtol' but convert to `intmax_t'. */
  34. extern intmax_t strtoimax (const char *nptr, char **endptr, int base);
  35. /* Like `strtoul' but convert to `uintmax_t'. */
  36. extern uintmax_t strtoumax (const char *nptr, char ** endptr, int base);
  37. #ifdef SWIG_WCHAR
  38. /* Like `wcstol' but convert to `intmax_t'. */
  39. extern intmax_t wcstoimax (const wchar_t *nptr, wchar_t **endptr, int base);
  40. /* Like `wcstoul' but convert to `uintmax_t'. */
  41. extern uintmax_t wcstoumax (const wchar_t *nptr, wchar_t ** endptr, int base);
  42. #endif
  43. #ifdef SWIGWORDSIZE64
  44. /* Like `strtol' but convert to `intmax_t'. */
  45. extern intmax_t strtoimax (const char *nptr, char **endptr, int base);
  46. /* Like `strtoul' but convert to `uintmax_t'. */
  47. extern uintmax_t strtoumax (const char *nptr, char **endptr,int base);
  48. #ifdef SWIG_WCHAR
  49. /* Like `wcstol' but convert to `intmax_t'. */
  50. extern intmax_t wcstoimax (const wchar_t *nptr, wchar_t **endptr, int base);
  51. /* Like `wcstoul' but convert to `uintmax_t'. */
  52. extern uintmax_t wcstoumax (const wchar_t *nptr, wchar_t **endptr, int base);
  53. #endif
  54. #else /* SWIGWORDSIZE32 */
  55. /* Like `strtol' but convert to `intmax_t'. */
  56. extern intmax_t strtoimax (const char *nptr, char **endptr, int base);
  57. /* Like `strtoul' but convert to `uintmax_t'. */
  58. extern uintmax_t strtoumax (const char *nptr, char **endptr, int base);
  59. #ifdef SWIG_WCHAR
  60. /* Like `wcstol' but convert to `intmax_t'. */
  61. extern uintmax_t wcstoumax (const wchar_t *nptr, wchar_t **endptr, int base);
  62. #endif
  63. #endif /* SWIGWORDSIZE32 */
  64. #ifdef __cplusplus
  65. }
  66. #endif