1 #if !defined(hy2sie_h) 2 #define hy2sie_h 3 4 5 #include "JNIHelp.h" 6 #include "jni.h" 7 #include "sieb.h" 8 9 10 typedef int BOOLEAN; 11 #define TRUE 1 12 #define FALSE 0 13 14 15 // mc: Stuff adopted from hyport.h: 16 17 /** HyMaxPath was chosen from unix MAXPATHLEN. Override in platform 18 * specific hyfile implementations if needed. 19 */ 20 #define HyMaxPath 1024 21 22 23 24 // Following definitions from hycomp.h: 25 26 /** 27 * Define common types: 28 * <ul> 29 * <li><code>U_32 / I_32</code> - unsigned/signed 32 bits</li> 30 * <li><code>U_16 / I_16</code> - unsigned/signed 16 bits</li> 31 * <li><code>U_8 / I_8</code> - unsigned/signed 8 bits (bytes -- not to be 32 * confused with char)</li> 33 * </ul> 34 */ 35 36 typedef int I_32; 37 typedef short I_16; 38 typedef signed char I_8; /* chars can be unsigned */ 39 typedef unsigned int U_32; 40 typedef unsigned short U_16; 41 typedef unsigned char U_8; 42 43 typedef long long I_64; 44 typedef unsigned long long U_64; 45 46 /** 47 * Define platform specific types: 48 * <ul> 49 * <li><code>UDATA</code> - unsigned data, can be used as an integer or 50 * pointer storage</li> 51 * <li><code>IDATA</code> - signed data, can be used as an integer or 52 * pointer storage</li> 53 * </ul> 54 */ 55 /* FIXME: POINTER64 */ 56 57 typedef I_32 IDATA; 58 typedef U_32 UDATA; 59 60 61 // Further required definitions from Harmony: 62 63 #define HYCONST64(x) x##L 64 65 66 #define HY_CFUNC 67 #define HY_CDATA 68 #define PROTOTYPE(x) x 69 #define VMCALL 70 #define PVMCALL * 71 #define NORETURN 72 73 #define GLOBAL_DATA(symbol) ((void*)&(symbol)) 74 75 76 // Following definitions substitute the HyPortLibrary simply with the JNIEnv 77 78 typedef JNIEnv HyPortLibrary; 79 80 #define PORT_ACCESS_FROM_ENV(env) HyPortLibrary *privatePortLibrary = env 81 #define PORT_ACCESS_FROM_PORT(portLibrary) HyPortLibrary *privatePortLibrary = portLibrary 82 #define PORTLIB privatePortLibrary 83 84 85 // Following defintion is used to avoide quite a few signedness warnings: 86 #define mcSignednessBull void * 87 88 89 // Following the substitution of hyfile: 90 91 #include <fcntl.h> 92 93 #define HyOpenRead O_RDONLY 94 #define hyfile_open(a, b, c) open(a, b, c) 95 96 #define HySeekEnd SEEK_END 97 #define HySeekSet SEEK_SET 98 #define HySeekCur SEEK_CUR 99 #define hyfile_seek(a, b, c) lseek(a, b, c) 100 101 #define hyfile_read(a, b, c) read(a, b, c) 102 103 #define hyfile_close(a) close(a) 104 105 106 // And further substitutions: 107 108 #define hymem_allocate_memory(byteCount) sieb_malloc(privatePortLibrary, byteCount) 109 #define hymem_free_memory(pointer) sieb_free(privatePortLibrary, pointer) 110 111 #define ioh_convertToPlatform(path) sieb_convertToPlatform (path) 112 113 114 #endif /* hy2sie_h */ 115