diff --git a/lime/_backend/native/NativeCFFI.hx b/lime/_backend/native/NativeCFFI.hx index 64a2a928d..e0cd80a48 100644 --- a/lime/_backend/native/NativeCFFI.hx +++ b/lime/_backend/native/NativeCFFI.hx @@ -206,7 +206,7 @@ class NativeCFFI { @:hlNative("lime", "lime_application_update") private static function lime_application_update (handle:CFFIPointer):Bool { return false; } @:cffi private static function lime_audio_load (data:Dynamic, buffer:Dynamic):Dynamic; @:cffi private static function lime_bytes_from_data_pointer (data:Float, length:Int):Dynamic; - @:cffi private static function lime_bytes_get_data_pointer (data:Dynamic):Float; + @:hlNative("lime", "lime_bytes_get_data_pointer") private static function lime_bytes_get_data_pointer (data:hl.Bytes):Float { return 0; } @:cffi private static function lime_bytes_get_data_pointer_offset (data:Dynamic, offset:Int):Float; @:cffi private static function lime_bytes_read_file (path:String, bytes:Dynamic):Dynamic; @:cffi private static function lime_cffi_get_native_pointer (ptr:Dynamic):Float; @@ -308,7 +308,7 @@ class NativeCFFI { @:cffi private static function lime_system_get_platform_label ():Dynamic; @:cffi private static function lime_system_get_platform_name ():Dynamic; @:cffi private static function lime_system_get_platform_version ():Dynamic; - @:cffi private static function lime_system_get_timer ():Float; + @:hlNative("lime", "lime_system_get_timer") private static function lime_system_get_timer ():Float { return 0; } @:cffi private static function lime_system_open_file (path:String):Void; @:cffi private static function lime_system_open_url (url:String, target:String):Void; @:hlNative("lime", "lime_text_event_manager_register") private static function lime_text_event_manager_register (callback:Void->Void, eventObject:TextEventInfo):Void {} diff --git a/project/Build.xml b/project/Build.xml index 4464b45c8..87fcbb8be 100644 --- a/project/Build.xml +++ b/project/Build.xml @@ -16,7 +16,8 @@ - + + @@ -56,7 +57,6 @@ - @@ -125,8 +125,8 @@
- +
@@ -288,6 +288,7 @@ + @@ -391,8 +392,8 @@ - - + + diff --git a/project/include/app/ApplicationEvent.h b/project/include/app/ApplicationEvent.h index 32b49b36e..e5b7dcbdc 100644 --- a/project/include/app/ApplicationEvent.h +++ b/project/include/app/ApplicationEvent.h @@ -2,8 +2,7 @@ #define LIME_APP_APPLICATION_EVENT_H -#include -#include +#include #include diff --git a/project/include/graphics/Image.h b/project/include/graphics/Image.h index 309269d0b..9da284dd9 100644 --- a/project/include/graphics/Image.h +++ b/project/include/graphics/Image.h @@ -2,10 +2,9 @@ #define LIME_GRAPHICS_IMAGE_H -#include -#include #include #include +#include namespace lime { diff --git a/project/include/graphics/ImageBuffer.h b/project/include/graphics/ImageBuffer.h index cf160f793..804f5a62d 100644 --- a/project/include/graphics/ImageBuffer.h +++ b/project/include/graphics/ImageBuffer.h @@ -2,9 +2,8 @@ #define LIME_GRAPHICS_IMAGE_BUFFER_H -#include -#include #include +#include #include diff --git a/project/include/graphics/RenderEvent.h b/project/include/graphics/RenderEvent.h index ca1a2566d..ece4214b4 100644 --- a/project/include/graphics/RenderEvent.h +++ b/project/include/graphics/RenderEvent.h @@ -2,8 +2,7 @@ #define LIME_GRAPHICS_RENDER_EVENT_H -#include -#include +#include #include diff --git a/project/include/math/Matrix3.h b/project/include/math/Matrix3.h index 36ffb415a..196a7f831 100644 --- a/project/include/math/Matrix3.h +++ b/project/include/math/Matrix3.h @@ -2,8 +2,7 @@ #define LIME_MATH_MATRIX_3_H -#include -#include +#include namespace lime { diff --git a/project/include/math/Rectangle.h b/project/include/math/Rectangle.h index 350caf484..8b7458d3e 100644 --- a/project/include/math/Rectangle.h +++ b/project/include/math/Rectangle.h @@ -2,8 +2,7 @@ #define LIME_MATH_RECTANGLE_H -#include -#include +#include namespace lime { diff --git a/project/include/math/Vector2.h b/project/include/math/Vector2.h index a96cefa22..456f96166 100644 --- a/project/include/math/Vector2.h +++ b/project/include/math/Vector2.h @@ -2,8 +2,7 @@ #define LIME_MATH_VECTOR2_H -#include -#include +#include namespace lime { diff --git a/project/include/system/CFFI.h b/project/include/system/CFFI.h new file mode 100644 index 000000000..9d91ef681 --- /dev/null +++ b/project/include/system/CFFI.h @@ -0,0 +1,16 @@ +#ifndef LIME_SYSTEM_CFFI_H +#define LIME_SYSTEM_CFFI_H + + +#define HL_NAME(n) hl_##n +#include + +#include + + +#ifndef LIME_HASHLINK +// define stubs in CFFI.cpp +#endif + + +#endif \ No newline at end of file diff --git a/project/include/system/CFFIPointer.h b/project/include/system/CFFIPointer.h index 0a16d2c3e..9b574d042 100644 --- a/project/include/system/CFFIPointer.h +++ b/project/include/system/CFFIPointer.h @@ -2,8 +2,7 @@ #define LIME_SYSTEM_CFFI_POINTER_H -#include -#include +#include namespace hx { diff --git a/project/include/system/ClipboardEvent.h b/project/include/system/ClipboardEvent.h index 91664b4da..907320fef 100644 --- a/project/include/system/ClipboardEvent.h +++ b/project/include/system/ClipboardEvent.h @@ -2,8 +2,7 @@ #define LIME_SYSTEM_CLIPBOARD_EVENT_H -#include -#include +#include #include diff --git a/project/include/system/SensorEvent.h b/project/include/system/SensorEvent.h index a92cefaa1..c5f78f568 100644 --- a/project/include/system/SensorEvent.h +++ b/project/include/system/SensorEvent.h @@ -2,8 +2,7 @@ #define LIME_SYSTEM_SENSOR_EVENT_H -#include -#include +#include #include diff --git a/project/include/system/ValuePointer.h b/project/include/system/ValuePointer.h index f52312426..54703cce4 100644 --- a/project/include/system/ValuePointer.h +++ b/project/include/system/ValuePointer.h @@ -2,8 +2,7 @@ #define LIME_SYSTEM_VALUE_POINTER_H -#include -#include +#include namespace lime { diff --git a/project/include/ui/DropEvent.h b/project/include/ui/DropEvent.h index 0b044e453..f92fe8b13 100644 --- a/project/include/ui/DropEvent.h +++ b/project/include/ui/DropEvent.h @@ -2,8 +2,7 @@ #define LIME_UI_DROP_EVENT_H -#include -#include +#include #include diff --git a/project/include/ui/GamepadEvent.h b/project/include/ui/GamepadEvent.h index a83cde5f4..7c6440a91 100644 --- a/project/include/ui/GamepadEvent.h +++ b/project/include/ui/GamepadEvent.h @@ -2,8 +2,7 @@ #define LIME_UI_GAMEPAD_EVENT_H -#include -#include +#include #include diff --git a/project/include/ui/JoystickEvent.h b/project/include/ui/JoystickEvent.h index d6a8ab534..fc122db78 100644 --- a/project/include/ui/JoystickEvent.h +++ b/project/include/ui/JoystickEvent.h @@ -2,8 +2,7 @@ #define LIME_UI_JOYSTICK_EVENT_H -#include -#include +#include #include diff --git a/project/include/ui/KeyEvent.h b/project/include/ui/KeyEvent.h index b3d892285..a741d9ef9 100644 --- a/project/include/ui/KeyEvent.h +++ b/project/include/ui/KeyEvent.h @@ -2,8 +2,7 @@ #define LIME_UI_KEY_EVENT_H -#include -#include +#include #include #include diff --git a/project/include/ui/MouseEvent.h b/project/include/ui/MouseEvent.h index f182912fc..f6b492bb8 100644 --- a/project/include/ui/MouseEvent.h +++ b/project/include/ui/MouseEvent.h @@ -2,8 +2,7 @@ #define LIME_UI_MOUSE_EVENT_H -#include -#include +#include #include #include diff --git a/project/include/ui/TextEvent.h b/project/include/ui/TextEvent.h index 8ff496248..f8893889a 100644 --- a/project/include/ui/TextEvent.h +++ b/project/include/ui/TextEvent.h @@ -2,8 +2,7 @@ #define LIME_UI_TEXT_EVENT_H -#include -#include +#include #include #include diff --git a/project/include/ui/TouchEvent.h b/project/include/ui/TouchEvent.h index 1a8bb9e57..f84ecc67e 100644 --- a/project/include/ui/TouchEvent.h +++ b/project/include/ui/TouchEvent.h @@ -2,8 +2,7 @@ #define LIME_UI_TOUCH_EVENT_H -#include -#include +#include #include #include diff --git a/project/include/ui/Window.h b/project/include/ui/Window.h index a11e51a7a..75b382eca 100644 --- a/project/include/ui/Window.h +++ b/project/include/ui/Window.h @@ -6,9 +6,9 @@ #undef CreateWindow #endif -#include #include #include +#include #include #include diff --git a/project/include/ui/WindowEvent.h b/project/include/ui/WindowEvent.h index 02862b9e2..f7ecf1fa2 100644 --- a/project/include/ui/WindowEvent.h +++ b/project/include/ui/WindowEvent.h @@ -2,8 +2,7 @@ #define LIME_UI_WINDOW_EVENT_H -#include -#include +#include #include #include diff --git a/project/include/utils/ArrayBufferView.h b/project/include/utils/ArrayBufferView.h index c850135ce..9206e5ab8 100644 --- a/project/include/utils/ArrayBufferView.h +++ b/project/include/utils/ArrayBufferView.h @@ -2,8 +2,7 @@ #define LIME_UTILS_ARRAY_BUFFER_VIEW_H -#include -#include +#include #include diff --git a/project/include/utils/Bytes.h b/project/include/utils/Bytes.h index 845ffb62c..eb49fccd2 100644 --- a/project/include/utils/Bytes.h +++ b/project/include/utils/Bytes.h @@ -2,8 +2,7 @@ #define LIME_UTILS_BYTES_H -#include -#include +#include #include diff --git a/project/include/utils/String.h b/project/include/utils/String.h index d890ad474..f31197946 100644 --- a/project/include/utils/String.h +++ b/project/include/utils/String.h @@ -2,7 +2,7 @@ #define LIME_UTILS_STRING_H -#include +#include namespace lime { diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index e017ffd35..c09737420 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -6,11 +6,8 @@ #define NEKO_COMPATIBLE #endif +#include -#define HL_NAME(n) hl_##n -#include - -#include #include #include #include @@ -450,6 +447,13 @@ namespace lime { } + HL_PRIM double hl_lime_bytes_get_data_pointer (HL_Bytes* bytes) { + + return bytes ? (uintptr_t)bytes->b : 0; + + } + + double lime_bytes_get_data_pointer_offset (value bytes, int offset) { Bytes data = Bytes (bytes); @@ -4188,7 +4192,7 @@ namespace lime { DEFINE_HL_PRIM (_BOOL, lime_application_update, _TCFFIPOINTER); // DEFINE_PRIME2 (lime_audio_load); // DEFINE_PRIME2 (lime_bytes_from_data_pointer); - // DEFINE_PRIME1 (lime_bytes_get_data_pointer); + DEFINE_HL_PRIM (_F64, lime_bytes_get_data_pointer, _BYTES); // DEFINE_PRIME2 (lime_bytes_get_data_pointer_offset); // DEFINE_PRIME2 (lime_bytes_read_file); // DEFINE_PRIME1 (lime_cffi_get_native_pointer); @@ -4294,7 +4298,7 @@ namespace lime { // DEFINE_PRIME0 (lime_system_get_platform_label); // DEFINE_PRIME0 (lime_system_get_platform_name); // DEFINE_PRIME0 (lime_system_get_platform_version); - // DEFINE_PRIME0 (lime_system_get_timer); + DEFINE_HL_PRIM (_F64, lime_system_get_timer, _NO_ARG); // DEFINE_PRIME1 (lime_system_get_windows_console_mode); // DEFINE_PRIME1v (lime_system_open_file); // DEFINE_PRIME2v (lime_system_open_url); diff --git a/project/src/graphics/cairo/CairoBindings.cpp b/project/src/graphics/cairo/CairoBindings.cpp index 7511e63f8..2166d72d5 100644 --- a/project/src/graphics/cairo/CairoBindings.cpp +++ b/project/src/graphics/cairo/CairoBindings.cpp @@ -1,12 +1,9 @@ -#define HL_NAME(n) hl_##n -#include - #include #include #include #include #include -#include +#include #include #include #include diff --git a/project/src/media/openal/OpenALBindings.cpp b/project/src/media/openal/OpenALBindings.cpp index afcd843eb..404a4f76c 100644 --- a/project/src/media/openal/OpenALBindings.cpp +++ b/project/src/media/openal/OpenALBindings.cpp @@ -12,10 +12,7 @@ #endif #endif -#define HL_NAME(n) hl_##n -#include - -#include +#include #include #include #include diff --git a/project/src/system/CFFI.cpp b/project/src/system/CFFI.cpp new file mode 100644 index 000000000..3f9e60f7e --- /dev/null +++ b/project/src/system/CFFI.cpp @@ -0,0 +1,37 @@ +#include + + +#ifndef LIME_HASHLINK + +HL_API hl_type hlt_void = hl_type (); +HL_API hl_type hlt_i32 = hl_type (); +HL_API hl_type hlt_i64 = hl_type (); +HL_API hl_type hlt_f64 = hl_type (); +HL_API hl_type hlt_f32 = hl_type (); +HL_API hl_type hlt_dyn = hl_type (); +HL_API hl_type hlt_array = hl_type (); +HL_API hl_type hlt_bytes = hl_type (); +HL_API hl_type hlt_dynobj = hl_type (); +HL_API hl_type hlt_bool = hl_type (); +HL_API hl_type hlt_abstract = hl_type (); + +HL_API varray *hl_alloc_array( hl_type *t, int size ) { return 0; } +HL_API vdynobj *hl_alloc_dynobj( void ) { return 0; } +HL_API char *hl_to_utf8( const uchar *bytes ) { return 0; } + +HL_API int hl_hash_utf8 ( const char *str ) { return 0; } + +HL_API vdynamic *hl_dyn_call( vclosure *c, vdynamic **args, int nargs ) { return 0; } + +HL_API void hl_dyn_seti( vdynamic *d, int hfield, hl_type *t, int value ) {} +HL_API void hl_dyn_setp( vdynamic *d, int hfield, hl_type *t, void *ptr ) {} +HL_API void hl_dyn_setf( vdynamic *d, int hfield, float f ) {} +HL_API void hl_dyn_setd( vdynamic *d, int hfield, double v ) {} + +HL_API void *hl_gc_alloc_gen( hl_type *t, int size, int flags ) { return 0; } +HL_API void hl_add_root( void *ptr ) {} +HL_API void hl_remove_root( void *ptr ) {} +HL_API void hl_gc_major( void ) {} +HL_API bool hl_is_gc_ptr( void *ptr ) { return false; } + +#endif \ No newline at end of file