# assert ~0x2Fi8 == 0xD0i8
fun ~: Int8 is intern
- # C function to calculate the length of the `NativeString` to receive `self`
+ # C function to calculate the length of the `CString` to receive `self`
private fun to_s_len: Int `{
return snprintf(NULL, 0, "%"PRIi8, self);
`}
- # C function to convert a nit Int to a NativeString (char*)
- private fun native_to_s(nstr: NativeString, strlen: Int) `{
+ # C function to convert a nit Int to a CString (char*)
+ private fun native_to_s(nstr: CString, strlen: Int) `{
snprintf(nstr, strlen, "%"PRIi8, self);
`}
# assert (-123i8).to_s == "-123"
redef fun to_s do
var nslen = to_s_len
- var ns = new NativeString(nslen + 1)
+ var ns = new CString(nslen + 1)
ns[nslen] = 0u8
native_to_s(ns, nslen + 1)
return ns.to_s_with_length(nslen)
# assert ~0x2Fi16 == 0xFFD0i16
fun ~: Int16 is intern
- # C function to calculate the length of the `NativeString` to receive `self`
+ # C function to calculate the length of the `CString` to receive `self`
private fun to_s_len: Int `{
return snprintf(NULL, 0, "%"PRIi16, self);
`}
- # C function to convert a nit Int to a NativeString (char*)
- private fun native_to_s(nstr: NativeString, strlen: Int) `{
+ # C function to convert a nit Int to a CString (char*)
+ private fun native_to_s(nstr: CString, strlen: Int) `{
snprintf(nstr, strlen, "%"PRIi16, self);
`}
# assert (-123i16).to_s == "-123"
redef fun to_s do
var nslen = to_s_len
- var ns = new NativeString(nslen + 1)
+ var ns = new CString(nslen + 1)
ns[nslen] = 0u8
native_to_s(ns, nslen + 1)
return ns.to_s_with_length(nslen)
# assert ~0x2Fu16 == 0xFFD0u16
fun ~: UInt16 is intern
- # C function to calculate the length of the `NativeString` to receive `self`
+ # C function to calculate the length of the `CString` to receive `self`
private fun to_s_len: Int `{
return snprintf(NULL, 0, "%"PRIu16, self);
`}
- # C function to convert a nit Int to a NativeString (char*)
- private fun native_to_s(nstr: NativeString, strlen: Int) `{
+ # C function to convert a nit Int to a CString (char*)
+ private fun native_to_s(nstr: CString, strlen: Int) `{
snprintf(nstr, strlen, "%"PRIu16, self);
`}
# assert (-123u16).to_s == "65413"
redef fun to_s do
var nslen = to_s_len
- var ns = new NativeString(nslen + 1)
+ var ns = new CString(nslen + 1)
ns[nslen] = 0u8
native_to_s(ns, nslen + 1)
return ns.to_s_with_length(nslen)
# assert ~0x2Fi32 == 0xFFFFFFD0i32
fun ~: Int32 is intern
- # C function to calculate the length of the `NativeString` to receive `self`
+ # C function to calculate the length of the `CString` to receive `self`
private fun to_s_len: Int `{
return snprintf(NULL, 0, "%"PRIi32, self);
`}
- # C function to convert a nit Int to a NativeString (char*)
- private fun native_to_s(nstr: NativeString, strlen: Int) `{
+ # C function to convert a nit Int to a CString (char*)
+ private fun native_to_s(nstr: CString, strlen: Int) `{
snprintf(nstr, strlen, "%"PRIi32, self);
`}
# assert (-123i32).to_s == "-123"
redef fun to_s do
var nslen = to_s_len
- var ns = new NativeString(nslen + 1)
+ var ns = new CString(nslen + 1)
ns[nslen] = 0u8
native_to_s(ns, nslen + 1)
return ns.to_s_with_length(nslen)
# assert ~0x2Fu32 == 0xFFFFFFD0u32
fun ~: UInt32 is intern
- # C function to calculate the length of the `NativeString` to receive `self`
+ # C function to calculate the length of the `CString` to receive `self`
private fun to_s_len: Int `{
return snprintf(NULL, 0, "%"PRIu32, self);
`}
- # C function to convert a nit Int to a NativeString (char*)
- private fun native_to_s(nstr: NativeString, strlen: Int) `{
+ # C function to convert a nit Int to a CString (char*)
+ private fun native_to_s(nstr: CString, strlen: Int) `{
snprintf(nstr, strlen, "%"PRIu32, self);
`}
# assert (-123u32).to_s == "4294967173"
redef fun to_s do
var nslen = to_s_len
- var ns = new NativeString(nslen + 1)
+ var ns = new CString(nslen + 1)
ns[nslen] = 0u8
native_to_s(ns, nslen + 1)
return ns.to_s_with_length(nslen)