Jelajahi Sumber

Add ssl functions to cppia. Fix getEnum for cppia. Remove pointer test for cppia

Hugh 9 tahun lalu
induk
melakukan
d3f7af70fd

+ 1 - 1
src/generators/gencpp.ml

@@ -6112,7 +6112,7 @@ class script_writer ctx filename asciiOut =
                   this#write ( (this#op IaCallSuper) ^ (this#typeText obj.etype) ^ " " ^ (this#stringText field.cf_name) ^
                      argN ^ (this#commentOf field.cf_name) ^ "\n");
          (* Cppia does not have a "GetEnumIndex" op code - must use IaCallMember hx::EnumBase.__Index *)
-         | TField (obj,FInstance (_,_,field) ) when field.cf_name = "getIndex" && (script_type_string obj.etype)="hx::EnumBase" ->
+         | TField (obj,FInstance (_,_,field) ) when field.cf_name = "_hx_getIndex" && (script_type_string obj.etype)="hx::EnumBase" ->
                   this#write ( (this#op IaCallMember) ^ (this#typeTextString "hx::EnumBase") ^ " " ^ (this#stringText "__Index") ^
                      argN ^ (this#commentOf ("Enum index") ) ^ "\n");
                   this#gen_expression obj;

+ 9 - 0
std/cpp/cppia/HostClasses.hx

@@ -66,7 +66,12 @@ class HostClasses
    "sys.FileSystem",
    "sys.io.File",
    "sys.io.FileInput",
+   "sys.net.UdpSocket",
    "sys.net.Socket",
+   "sys.ssl.Certificate",
+   "sys.ssl.Digest",
+   "sys.ssl.Key",
+   "sys.ssl.Socket",
    "Enum",
    "EnumValue",
    //"Sys",
@@ -194,6 +199,10 @@ class HostClasses
       externs.set("sys.db._Sqlite.SqliteResultSet",true);
       externs.set("sys.db._Mysql.MysqlConnection",true);
       externs.set("sys.db._Mysql.MysqlResultSet",true);
+      externs.set("sys.net._Socket.SocketInput",true);
+      externs.set("sys.net._Socket.SocketOutput",true);
+      externs.set("sys.ssl._Socket.SocketInput",true);
+      externs.set("sys.ssl._Socket.SocketOutput",true);
       externs.set("haxe.ds.TreeNode",true);
       externs.set("haxe.xml.XmlParserException",true);
       for(e in classes)

+ 2 - 2
tests/unit/src/unit/hxcpp_issues/Issue352.hx

@@ -1,7 +1,7 @@
 package unit.hxcpp_issues;
 
 class Issue352 extends Test {
-	#if cpp
+	#if (cpp && !cppia)
 	@:keep
 	static function onSample( buf : cpp.Pointer<cpp.Float32>, len : Int ) {
 		var data : haxe.io.BytesData = [];
@@ -11,4 +11,4 @@ class Issue352 extends Test {
 
 	static function foo(d) { }
 	#end
-}
+}