From 6a58758d5f4198305191747c5c8b6af3c5057898 Mon Sep 17 00:00:00 2001 From: LegionMammal978 Date: Mon, 12 Dec 2022 19:02:00 -0500 Subject: Add ISO C functions atof, atol, atoll, strtoll, strtoull --- src/fuchsia/mod.rs | 6 +++++- src/unix/bsd/mod.rs | 1 - src/unix/haiku/mod.rs | 1 - src/unix/hermit/mod.rs | 1 - src/unix/linux_like/emscripten/mod.rs | 1 - src/unix/linux_like/linux/mod.rs | 1 - src/unix/mod.rs | 5 +++++ src/unix/newlib/mod.rs | 1 - src/unix/solarish/mod.rs | 1 - src/vxworks/mod.rs | 5 +++++ src/wasi.rs | 6 +++++- src/windows/mod.rs | 6 +++++- 12 files changed, 25 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 7a9edada1f..5c6aebde23 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -3402,11 +3402,16 @@ extern "C" { pub fn feof(stream: *mut FILE) -> c_int; pub fn ferror(stream: *mut FILE) -> c_int; pub fn perror(s: *const c_char); + pub fn atof(s: *const c_char) -> c_double; pub fn atoi(s: *const c_char) -> c_int; + pub fn atol(s: *const c_char) -> c_long; + pub fn atoll(s: *const c_char) -> c_longlong; pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float; pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long; + pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong; pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong; + pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong; pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; pub fn malloc(size: size_t) -> *mut c_void; pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; @@ -3448,7 +3453,6 @@ extern "C" { pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; pub fn abs(i: c_int) -> c_int; - pub fn atof(s: *const c_char) -> c_double; pub fn labs(i: c_long) -> c_long; pub fn rand() -> c_int; pub fn srand(seed: c_uint); diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index d49e3c4402..84e572edab 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -613,7 +613,6 @@ extern "C" { pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; pub fn abs(i: ::c_int) -> ::c_int; - pub fn atof(s: *const ::c_char) -> ::c_double; pub fn labs(i: ::c_long) -> ::c_long; #[cfg_attr( all(target_os = "freebsd", any(freebsd12, freebsd11, freebsd10)), diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 005b1d9df5..95ddadaeea 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -1592,7 +1592,6 @@ extern "C" { pub fn _errnop() -> *mut ::c_int; pub fn abs(i: ::c_int) -> ::c_int; - pub fn atof(s: *const ::c_char) -> ::c_double; pub fn labs(i: ::c_long) -> ::c_long; pub fn rand() -> ::c_int; pub fn srand(seed: ::c_uint); diff --git a/src/unix/hermit/mod.rs b/src/unix/hermit/mod.rs index eedfd28a49..6a656a8598 100644 --- a/src/unix/hermit/mod.rs +++ b/src/unix/hermit/mod.rs @@ -966,7 +966,6 @@ extern "C" { pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int; pub fn abs(i: ::c_int) -> ::c_int; - pub fn atof(s: *const ::c_char) -> ::c_double; pub fn labs(i: ::c_long) -> ::c_long; pub fn rand() -> ::c_int; pub fn srand(seed: ::c_uint); diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 11fbb31c38..f2024900cb 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -1763,7 +1763,6 @@ extern "C" { pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; pub fn abs(i: ::c_int) -> ::c_int; - pub fn atof(s: *const ::c_char) -> ::c_double; pub fn labs(i: ::c_long) -> ::c_long; pub fn rand() -> ::c_int; pub fn srand(seed: ::c_uint); diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 743927e517..9658f07446 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -3804,7 +3804,6 @@ extern "C" { pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; pub fn abs(i: ::c_int) -> ::c_int; - pub fn atof(s: *const ::c_char) -> ::c_double; pub fn labs(i: ::c_long) -> ::c_long; pub fn rand() -> ::c_int; pub fn srand(seed: ::c_uint); diff --git a/src/unix/mod.rs b/src/unix/mod.rs index fb9ebf792e..a5722381cb 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -492,7 +492,10 @@ extern "C" { pub fn ferror(stream: *mut FILE) -> c_int; pub fn clearerr(stream: *mut FILE); pub fn perror(s: *const c_char); + pub fn atof(s: *const c_char) -> c_double; pub fn atoi(s: *const c_char) -> c_int; + pub fn atol(s: *const c_char) -> c_long; + pub fn atoll(s: *const c_char) -> c_longlong; #[cfg_attr( all(target_os = "macos", target_arch = "x86"), link_name = "strtod$UNIX2003" @@ -500,7 +503,9 @@ extern "C" { pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float; pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long; + pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong; pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong; + pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong; pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; pub fn malloc(size: size_t) -> *mut c_void; pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 1a694691a6..3875f1cb4e 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -621,7 +621,6 @@ extern "C" { pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int; pub fn abs(i: ::c_int) -> ::c_int; - pub fn atof(s: *const ::c_char) -> ::c_double; pub fn labs(i: ::c_long) -> ::c_long; pub fn rand() -> ::c_int; pub fn srand(seed: ::c_uint); diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index abe304e8ea..99135d5f59 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -2710,7 +2710,6 @@ extern "C" { pub fn abs(i: ::c_int) -> ::c_int; pub fn acct(filename: *const ::c_char) -> ::c_int; - pub fn atof(s: *const ::c_char) -> ::c_double; pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; pub fn labs(i: ::c_long) -> ::c_long; pub fn rand() -> ::c_int; diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 2772d68d2f..6b705e8a22 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -1119,11 +1119,16 @@ extern "C" { pub fn feof(stream: *mut FILE) -> c_int; pub fn ferror(stream: *mut FILE) -> c_int; pub fn perror(s: *const c_char); + pub fn atof(s: *const c_char) -> c_double; pub fn atoi(s: *const c_char) -> c_int; + pub fn atol(s: *const c_char) -> c_long; + pub fn atoll(s: *const c_char) -> c_longlong; pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float; pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long; + pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong; pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong; + pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong; pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; pub fn malloc(size: size_t) -> *mut c_void; pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; diff --git a/src/wasi.rs b/src/wasi.rs index c5dd670477..abfebd6439 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -540,12 +540,16 @@ extern "C" { pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int; pub fn setbuf(stream: *mut FILE, buf: *mut c_char); pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; - pub fn atoi(s: *const c_char) -> c_int; pub fn atof(s: *const c_char) -> c_double; + pub fn atoi(s: *const c_char) -> c_int; + pub fn atol(s: *const c_char) -> c_long; + pub fn atoll(s: *const c_char) -> c_longlong; pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float; pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long; + pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong; pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong; + pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong; pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char; diff --git a/src/windows/mod.rs b/src/windows/mod.rs index 916019b1f2..7f2f1ded19 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -329,11 +329,16 @@ extern "C" { pub fn feof(stream: *mut FILE) -> c_int; pub fn ferror(stream: *mut FILE) -> c_int; pub fn perror(s: *const c_char); + pub fn atof(s: *const c_char) -> c_double; pub fn atoi(s: *const c_char) -> c_int; + pub fn atol(s: *const c_char) -> c_long; + pub fn atoll(s: *const c_char) -> c_longlong; pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float; pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long; + pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong; pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong; + pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong; pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; pub fn malloc(size: size_t) -> *mut c_void; pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; @@ -374,7 +379,6 @@ extern "C" { pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; pub fn abs(i: c_int) -> c_int; - pub fn atof(s: *const c_char) -> c_double; pub fn labs(i: c_long) -> c_long; pub fn rand() -> c_int; pub fn srand(seed: c_uint); -- cgit v1.2.1