Browse Source

[cpp] Use @:access instead of untyped for sys.io.File constructors. Mark ConstCharStar as extern. Fix RawConstPointer in cppast. Do not use '::' on native metadat

Hugh 9 years ago
parent
commit
472e094b23
4 changed files with 11 additions and 8 deletions
  1. 3 3
      gencpp.ml
  2. 1 1
      std/cpp/ConstCharStar.hx
  3. 1 1
      std/cpp/Object.hx
  4. 6 3
      std/cpp/_std/Sys.hx

+ 3 - 3
gencpp.ml

@@ -1827,7 +1827,7 @@ and tcpp_to_string = function
          "id <" ^ path ^ ">"
       else
          path ^ " *"
-   | TCppNativePointer klass -> (cpp_class_path_of klass) ^ " *"
+   | TCppNativePointer klass -> (join_class_path_remap klass.cl_path "::") ^ " *"
    | TCppInst klass ->
         cpp_class_path_of klass
    | TCppClass -> "hx::Class";
@@ -1966,8 +1966,8 @@ let rec cpp_type_of ctx haxe_type =
             TCppPointer("ConstPointer", cpp_type_of ctx p)
       | (["cpp"],"RawPointer"), [p] ->
             TCppRawPointer("", cpp_type_of ctx p)
-      | (["cpp"],"ConstRawPointer"), [p] ->
-            TCppRawPointer("const", cpp_type_of ctx p)
+      | (["cpp"],"RawConstPointer"), [p] ->
+            TCppRawPointer("const ", cpp_type_of ctx p)
       | (["cpp"],"Function"), [function_type; abi] ->
             cpp_function_type_of ctx function_type abi;
 

+ 1 - 1
std/cpp/ConstCharStar.hx

@@ -21,7 +21,7 @@
  */
  package cpp;
 
-abstract ConstCharStar( RawConstPointer<Char> ) to(RawConstPointer<Char>)
+@:extern abstract ConstCharStar( RawConstPointer<Char> ) to(RawConstPointer<Char>)
 {
    inline function new(s:String) this = untyped s.__s;
 

+ 1 - 1
std/cpp/Object.hx

@@ -21,7 +21,7 @@
  */
  package cpp;
 
-@:native("::hx::Object *")
+@:native("hx::Object *")
 extern class HxObjectPtr
 {
    @:native("hx::DynamicPtr")

+ 6 - 3
std/cpp/_std/Sys.hx

@@ -30,16 +30,19 @@
 		print("\n");
 	}
 
+   @:access(sys.io.FileInput)
 	public static function stdin() : haxe.io.Input {
-		return untyped new sys.io.FileInput(file_stdin());
+		return new sys.io.FileInput(file_stdin());
 	}
 
+   @:access(sys.io.FileOutput)
 	public static function stdout() : haxe.io.Output {
-		return untyped new sys.io.FileOutput(file_stdout());
+		return new sys.io.FileOutput(file_stdout());
 	}
 
+   @:access(sys.io.FileOutput)
 	public static function stderr() : haxe.io.Output {
-		return untyped new sys.io.FileOutput(file_stderr());
+		return new sys.io.FileOutput(file_stderr());
 	}
 
 	public static function getChar( echo : Bool ) : Int {