|
5 | 5 | //! This file is Copyright (c) Jonathan 'theJPster' Pallant 2019 |
6 | 6 | //! Licensed under the Blue Oak Model Licence 1.0.0 |
7 | 7 | //! |
8 | | -//! See each module for its respective licence. |
| 8 | +//! See each module for its respective license. |
9 | 9 |
|
10 | 10 | #![cfg_attr(not(test), no_std)] |
| 11 | +#![allow(clippy::missing_safety_doc)] |
11 | 12 |
|
12 | 13 | #[cfg(test)] |
13 | 14 | #[allow(unused_imports)] |
14 | 15 | use std as core; |
15 | 16 |
|
16 | | -#[cfg(feature = "abs")] |
| 17 | +mod itoa; |
| 18 | + |
17 | 19 | mod abs; |
18 | 20 | #[cfg(feature = "abs")] |
19 | 21 | pub use self::abs::abs; |
20 | 22 |
|
21 | | -#[cfg(feature = "strcmp")] |
22 | 23 | mod strcmp; |
23 | 24 | #[cfg(feature = "strcmp")] |
24 | 25 | pub use self::strcmp::strcmp; |
25 | 26 |
|
26 | | -#[cfg(feature = "strncmp")] |
27 | 27 | mod strncmp; |
28 | 28 | #[cfg(feature = "strncmp")] |
29 | 29 | pub use self::strncmp::strncmp; |
30 | 30 |
|
31 | | -#[cfg(feature = "strcpy")] |
32 | 31 | mod strcpy; |
33 | 32 | #[cfg(feature = "strcpy")] |
34 | 33 | pub use self::strcpy::strcpy; |
35 | 34 |
|
36 | | -#[cfg(feature = "strncpy")] |
37 | 35 | mod strncpy; |
38 | 36 | #[cfg(feature = "strncpy")] |
39 | 37 | pub use self::strncpy::strncpy; |
40 | 38 |
|
41 | | -#[cfg(feature = "strlen")] |
42 | 39 | mod strlen; |
43 | 40 | #[cfg(feature = "strlen")] |
44 | 41 | pub use self::strlen::strlen; |
45 | 42 |
|
46 | | -#[cfg(feature = "strtol")] |
47 | 43 | mod strtol; |
| 44 | +#[cfg(feature = "atoi")] |
| 45 | +pub use self::strtol::atoi; |
| 46 | +#[cfg(feature = "isalpha")] |
| 47 | +pub use self::strtol::isalpha; |
| 48 | +#[cfg(feature = "isdigit")] |
| 49 | +pub use self::strtol::isdigit; |
| 50 | +#[cfg(feature = "isspace")] |
| 51 | +pub use self::strtol::isspace; |
| 52 | +#[cfg(feature = "isupper")] |
| 53 | +pub use self::strtol::isupper; |
| 54 | +#[cfg(feature = "strtoimax")] |
| 55 | +pub use self::strtol::strtoimax; |
48 | 56 | #[cfg(feature = "strtol")] |
49 | 57 | pub use self::strtol::strtol; |
50 | | - |
| 58 | +#[cfg(feature = "strtoll")] |
| 59 | +pub use self::strtol::strtoll; |
51 | 60 | #[cfg(feature = "strtoul")] |
52 | | -mod strtoul; |
53 | | -#[cfg(feature = "strtoul")] |
54 | | -pub use self::strtoul::strtoul; |
| 61 | +pub use self::strtol::strtoul; |
| 62 | +#[cfg(feature = "strtoull")] |
| 63 | +pub use self::strtol::strtoull; |
| 64 | +#[cfg(feature = "strtoumax")] |
| 65 | +pub use self::strtol::strtoumax; |
55 | 66 |
|
56 | | -#[cfg(feature = "strstr")] |
57 | 67 | mod strstr; |
58 | 68 | #[cfg(feature = "strstr")] |
59 | 69 | pub use self::strstr::strstr; |
60 | 70 |
|
61 | | -#[cfg(feature = "strchr")] |
62 | 71 | mod strchr; |
63 | 72 | #[cfg(feature = "strchr")] |
64 | 73 | pub use self::strchr::strchr; |
65 | 74 |
|
66 | | -#[cfg(feature = "atoi")] |
67 | | -mod atoi; |
68 | | -#[cfg(feature = "atoi")] |
69 | | -pub use self::atoi::atoi; |
70 | | - |
71 | | -#[cfg(feature = "itoa")] |
72 | | -mod itoa; |
73 | | -#[cfg(feature = "itoa")] |
74 | | -pub use self::itoa::itoa; |
75 | | - |
76 | | -#[cfg(feature = "snprintf")] |
77 | 75 | mod snprintf; |
78 | 76 |
|
79 | | -/// `long long int` |
80 | | -pub type CLongLong = ::core::ffi::c_longlong; |
81 | | - |
82 | | -/// `unsigned long long int` |
83 | | -pub type CULongLong = ::core::ffi::c_ulonglong; |
84 | | - |
85 | | -/// `long int` |
86 | | -pub type CLong = ::core::ffi::c_long; |
87 | | - |
88 | | -/// `unsigned long int` |
89 | | -pub type CULong = ::core::ffi::c_ulong; |
90 | | - |
91 | | -/// `int` |
92 | | -pub type CInt = ::core::ffi::c_int; |
93 | | - |
94 | | -/// `unsigned int` |
95 | | -pub type CUInt = ::core::ffi::c_uint; |
96 | | - |
97 | | -/// Represents an 8-bit `char`. Rust does not (and will never) support |
98 | | -/// platforms where `char` is not 8-bits long. |
99 | | -pub type CChar = u8; |
100 | | - |
101 | | -/// This allows you to iterate a null-terminated string in a relatively simple |
102 | | -/// way. |
103 | | -pub struct CStringIter { |
104 | | - ptr: *const CChar, |
105 | | - idx: isize, |
106 | | -} |
107 | | - |
108 | | -impl CStringIter { |
109 | | - /// Create a new iterator from a pointer to a null-terminated string. The |
110 | | - /// behaviour is undefined if the string is not null-terminated. |
111 | | - pub fn new(s: *const CChar) -> CStringIter { |
112 | | - CStringIter { ptr: s, idx: 0 } |
113 | | - } |
114 | | -} |
115 | | - |
116 | | -impl core::iter::Iterator for CStringIter { |
117 | | - type Item = CChar; |
118 | | - fn next(&mut self) -> Option<Self::Item> { |
119 | | - let c = unsafe { *self.ptr.offset(self.idx) }; |
120 | | - if c == 0 { |
121 | | - None |
122 | | - } else { |
123 | | - self.idx += 1; |
124 | | - Some(c) |
125 | | - } |
126 | | - } |
127 | | -} |
| 77 | +mod ctype; |
| 78 | +pub use self::ctype::*; |
0 commit comments