|
@@ -21,7 +21,11 @@
|
|
|
*/
|
|
|
package cpp;
|
|
|
|
|
|
-
|
|
|
+/**
|
|
|
+ Platform-specific Cpp Library. Provides some platform-specific functions
|
|
|
+ for the C++ target, such as conversion from Haxe types to native types
|
|
|
+ and vice-versa.
|
|
|
+**/
|
|
|
class Lib {
|
|
|
|
|
|
/**
|
|
@@ -45,15 +49,15 @@ class Lib {
|
|
|
|
|
|
public static function _loadPrime( lib : String, prim : String, signature : String, quietFail = false ) : Dynamic {
|
|
|
var factory:Callable< ConstCharStar -> Object > =
|
|
|
- untyped __global__.__hxcpp_cast_get_proc_address(lib, prim + "__prime", quietFail);
|
|
|
- if (factory!=null)
|
|
|
- {
|
|
|
- var func:Dynamic = factory.call(signature);
|
|
|
- if (func==null && !quietFail)
|
|
|
- throw '$prim does not have signature $signature';
|
|
|
- return func;
|
|
|
- }
|
|
|
- return null;
|
|
|
+ untyped __global__.__hxcpp_cast_get_proc_address(lib, prim + "__prime", quietFail);
|
|
|
+ if (factory!=null)
|
|
|
+ {
|
|
|
+ var func:Dynamic = factory.call(signature);
|
|
|
+ if (func==null && !quietFail)
|
|
|
+ throw '$prim does not have signature $signature';
|
|
|
+ return func;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -80,30 +84,30 @@ class Lib {
|
|
|
public static function rethrow(inExp:Dynamic) { throw inExp; }
|
|
|
|
|
|
public static function stringReference(inBytes:haxe.io.Bytes) : String
|
|
|
- {
|
|
|
- var result:String = "";
|
|
|
- untyped __global__.__hxcpp_string_of_bytes(inBytes.b, result, 0, 0, true);
|
|
|
- return result;
|
|
|
- }
|
|
|
+ {
|
|
|
+ var result:String = "";
|
|
|
+ untyped __global__.__hxcpp_string_of_bytes(inBytes.b, result, 0, 0, true);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
public static function pushDllSearchPath(inPath:String) : Void
|
|
|
- untyped __global__.__hxcpp_push_dll_path(inPath);
|
|
|
+ untyped __global__.__hxcpp_push_dll_path(inPath);
|
|
|
|
|
|
public static function getDllExtension() : String
|
|
|
- return untyped __global__.__hxcpp_get_dll_extension();
|
|
|
+ return untyped __global__.__hxcpp_get_dll_extension();
|
|
|
|
|
|
public static function getBinDirectory() : String
|
|
|
- return untyped __global__.__hxcpp_get_bin_dir();
|
|
|
+ return untyped __global__.__hxcpp_get_bin_dir();
|
|
|
|
|
|
/**
|
|
|
Returns bytes referencing the content of a string.
|
|
|
- Use with extreme caution - changing constant strings will crash.
|
|
|
- Changing one string can cause others to change unexpectedly.
|
|
|
- Only really safe if you are using it read-only or if it comes from stringReference above
|
|
|
+ Use with extreme caution - changing constant strings will crash.
|
|
|
+ Changing one string can cause others to change unexpectedly.
|
|
|
+ Only really safe if you are using it read-only or if it comes from stringReference above
|
|
|
**/
|
|
|
public inline static function bytesReference( s : String ) : haxe.io.Bytes {
|
|
|
- var bytes = new haxe.io.BytesData();
|
|
|
- untyped bytes.__unsafeStringReference(s);
|
|
|
+ var bytes = new haxe.io.BytesData();
|
|
|
+ untyped bytes.__unsafeStringReference(s);
|
|
|
return haxe.io.Bytes.ofData(bytes);
|
|
|
}
|
|
|
|
|
@@ -136,9 +140,9 @@ class Lib {
|
|
|
untyped __global__.__hxcpp_println(v);
|
|
|
}
|
|
|
|
|
|
- public static function setFloatFormat(inFormat:String):Void
|
|
|
- {
|
|
|
- untyped __global__.__hxcpp_set_float_format(inFormat);
|
|
|
- }
|
|
|
+ public static function setFloatFormat(inFormat:String):Void
|
|
|
+ {
|
|
|
+ untyped __global__.__hxcpp_set_float_format(inFormat);
|
|
|
+ }
|
|
|
|
|
|
}
|