2 Extern implementation of Nit module abstract_text
7 #include "core__abstract_text._ffi.h"
9 #include <android/log.h>
10 #define PRINT_ERROR(...) (void)__android_log_print(ANDROID_LOG_WARN, "Nit", __VA_ARGS__)
12 #define PRINT_ERROR(...) fprintf(stderr, __VA_ARGS__)
14 #line 18 "../lib/core/text/abstract_text.nit"
20 long core__abstract_text___Int_int_to_s_len___impl( long self
)
22 #line 1838 "../lib/core/text/abstract_text.nit"
25 return snprintf(NULL
, 0, "%ld", self
);
27 void core__abstract_text___Int_native_int_to_s___impl( long self
, char* nstr
, long strlen
)
29 #line 1843 "../lib/core/text/abstract_text.nit"
32 snprintf(nstr
, strlen
, "%ld", self
);
34 long core__abstract_text___Byte_byte_to_s_len___impl( unsigned char self
)
36 #line 1783 "../lib/core/text/abstract_text.nit"
39 return snprintf(NULL
, 0, "0x%02x", self
);
41 void core__abstract_text___Byte_native_byte_to_s___impl( unsigned char self
, char* nstr
, long strlen
)
43 #line 1788 "../lib/core/text/abstract_text.nit"
46 snprintf(nstr
, strlen
, "0x%02x", self
);
48 char* core__abstract_text___Int_strerror_ext___impl( long self
)
50 #line 1808 "../lib/core/text/abstract_text.nit"
52 return strerror((int)self
); }
53 void core__abstract_text___Char_u8char_tos___impl( uint32_t self
, char* r
, long len
)
55 #line 2033 "../lib/core/text/abstract_text.nit"
64 r
[0] = 0xC0 | ((self
& 0x7C0) >> 6);
65 r
[1] = 0x80 | (self
& 0x3F);
68 r
[0] = 0xE0 | ((self
& 0xF000) >> 12);
69 r
[1] = 0x80 | ((self
& 0xFC0) >> 6);
70 r
[2] = 0x80 | (self
& 0x3F);
73 r
[0] = 0xF0 | ((self
& 0x1C0000) >> 18);
74 r
[1] = 0x80 | ((self
& 0x3F000) >> 12);
75 r
[2] = 0x80 | ((self
& 0xFC0) >> 6);
76 r
[3] = 0x80 | (self
& 0x3F);