浏览代码

[cpp] move zlib externs inline

Hugh 9 年之前
父节点
当前提交
f488139252
共有 2 个文件被更改,包括 30 次插入6 次删除
  1. 18 1
      std/cpp/_std/haxe/zip/Compress.hx
  2. 12 5
      std/cpp/_std/haxe/zip/Uncompress.hx

+ 18 - 1
std/cpp/_std/haxe/zip/Compress.hx

@@ -21,7 +21,7 @@
  */
 package haxe.zip;
 
-@:coreApi
+@:coreApi @:buildXml('<import name="${HXCPP}/src/hx/libs/zlib/Build.xml" />')
 class Compress {
 
 	var s : Dynamic;
@@ -53,10 +53,27 @@ class Compress {
 		return out.sub(0,r.write);
 	}
 
+   @:extern @:native("_hx_deflate_init")
+	static function _deflate_init(level:Int) : Dynamic return null;
+
+   @:extern @:native("_hx_deflate_bound")
+	static function _deflate_bound(handle:Dynamic,length:Int):Int return 0;
+
+   @:extern @:native("_hx_deflate_buffer")
+	static function _deflate_buffer(handle:Dynamic, src:haxe.io.BytesData, srcPos:Int,  dest:haxe.io.BytesData, destPos:Int) : { done : Bool, read : Int, write : Int } return null;
+
+   @:extern @:native("_hx_deflate_end")
+	static function _deflate_end(handle:Dynamic) : Void { }
+
+   @:extern @:native("_hx_zip_set_flush_mode")
+	static function _set_flush_mode(handle:Dynamic, flushMode:String):Void { }
+
+   /*
 	static var _deflate_init = cpp.Lib.load("zlib","deflate_init",1);
 	static var _deflate_bound = cpp.Lib.load("zlib","deflate_bound",2);
 	static var _deflate_buffer = cpp.Lib.load("zlib","deflate_buffer",5);
 	static var _deflate_end = cpp.Lib.load("zlib","deflate_end",1);
 	static var _set_flush_mode = cpp.Lib.load("zlib","set_flush_mode",2);
+   */
 
 }

+ 12 - 5
std/cpp/_std/haxe/zip/Uncompress.hx

@@ -21,7 +21,7 @@
  */
 package haxe.zip;
 
-@:coreApi
+@:coreApi @:buildXml('<import name="${HXCPP}/src/hx/libs/zlib/Build.xml"/>')
 class Uncompress {
 	var s : Dynamic;
 
@@ -59,9 +59,16 @@ class Uncompress {
 		return b.getBytes();
 	}
 
-	static var _inflate_init = cpp.Lib.load("zlib","inflate_init",1);
-	static var _inflate_buffer = cpp.Lib.load("zlib","inflate_buffer",5);
-	static var _inflate_end = cpp.Lib.load("zlib","inflate_end",1);
-	static var _set_flush_mode = cpp.Lib.load("zlib","set_flush_mode",2);
+   @:extern @:native("_hx_inflate_init")
+	static function _inflate_init(windowBits:Dynamic) : Dynamic return null;
+
+   @:extern @:native("_hx_inflate_buffer")
+	static function _inflate_buffer(handle:Dynamic, src:haxe.io.BytesData, srcPos:Int,  dest:haxe.io.BytesData, destPos:Int) : { done : Bool, read : Int, write : Int } return null;
+
+   @:extern @:native("_hx_inflate_end")
+	static function _inflate_end(handle:Dynamic):Void { }
+
+   @:extern @:native("_hx_zip_set_flush_mode")
+	static function _set_flush_mode(handle:Dynamic, flushMode:String):Void { }
 
 }