nitc: let CC, CXX and NO_STACKTRACE use env value
[nit.git] / c_src / core__flat._ffi.c
1 /*
2 Extern implementation of Nit module flat
3 */
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <stdint.h>
7 #include "core__flat._ffi.h"
8 #ifdef ANDROID
9 #include <android/log.h>
10 #define PRINT_ERROR(...) (void)__android_log_print(ANDROID_LOG_WARN, "Nit", __VA_ARGS__)
11 #else
12 #define PRINT_ERROR(...) fprintf(stderr, __VA_ARGS__)
13 #endif
14 #line 16 "../lib/core/text/flat.nit"
15
16
17 #include <stdio.h>
18 #include <string.h>
19 void flat___NativeString_native_set_char___impl( char* self, long pos, uint32_t c, long ln )
20 {
21 #line 1256 "../lib/core/text/flat.nit"
22
23
24 char* dst = self + pos;
25 switch(ln){
26 case 1:
27 dst[0] = c;
28 break;
29 case 2:
30 dst[0] = 0xC0 | ((c & 0x7C0) >> 6);
31 dst[1] = 0x80 | (c & 0x3F);
32 break;
33 case 3:
34 dst[0] = 0xE0 | ((c & 0xF000) >> 12);
35 dst[1] = 0x80 | ((c & 0xFC0) >> 6);
36 dst[2] = 0x80 | (c & 0x3F);
37 break;
38 case 4:
39 dst[0] = 0xF0 | ((c & 0x1C0000) >> 18);
40 dst[1] = 0x80 | ((c & 0x3F000) >> 12);
41 dst[2] = 0x80 | ((c & 0xFC0) >> 6);
42 dst[3] = 0x80 | (c & 0x3F);
43 break;
44 }
45 }