misc/vim: do not show the preview window when using the omnifunc
[nit.git] / c_src / core__native._ffi.c
1 /*
2 Extern implementation of Nit module native
3 */
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <stdint.h>
7 #include "core__native._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/native.nit"
15
16
17 #ifdef __linux__
18 #include <endian.h>
19 #endif
20 #ifdef __APPLE__
21 #include <libkern/OSByteOrder.h>
22 #define be32toh(x) OSSwapBigToHostInt32(x)
23 #endif
24
25 #ifdef __pnacl__
26 #define be16toh(val) (((val) >> 8) | ((val) << 8))
27 #define be32toh(val) ((be16toh((val) << 16) | (be16toh((val) >> 16))))
28 #endif
29 #ifndef be32toh
30 #define be32toh(val) betoh32(val)
31 #endif
32 double native___NativeString_atof___impl( char* self )
33 {
34 #line 102 "../lib/core/text/native.nit"
35
36 return atof(self); }
37 long native___NativeString_fetch_4_ffi___impl( char* self, long pos )
38 {
39 #line 282 "../lib/core/text/native.nit"
40
41 return (long)*((uint32_t*)(self+pos)); }
42 long native___NativeString_fetch_4h_ffi___impl( char* self, long pos )
43 {
44 #line 283 "../lib/core/text/native.nit"
45
46 return (long)be32toh(*((uint32_t*)(self+pos))); }