Kaynağa Gözat

Fix storage type constants. Add ExecutionTrace class for debugging

[email protected] 11 yıl önce
ebeveyn
işleme
212f54821c
2 değiştirilmiş dosya ile 20 ekleme ve 3 silme
  1. 3 3
      gencpp.ml
  2. 17 0
      std/cpp/vm/ExecutionTrace.hx

+ 3 - 3
gencpp.ml

@@ -3155,11 +3155,11 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
 
    	let dump_member_storage = (fun field ->
          let storage = match type_string field.cf_type with
-         | "Bool" -> "hx::fsBool"
-         | "Int" -> "hx::fsInt"
+         | "bool" -> "hx::fsBool"
+         | "int" -> "hx::fsInt"
          | "Float" -> "hx::fsFloat"
          | "::String" -> "hx::fsString"
-         | _ -> "hx::fsObject"
+         | str -> "hx::fsObject" ^ " /*" ^ str ^ "*/ "
          in
          output_cpp ("	{" ^ storage ^ ",(int)offsetof(" ^ class_name ^"," ^ (keyword_remap field.cf_name) ^")," ^
             (str field.cf_name) ^ "},\n")

+ 17 - 0
std/cpp/vm/ExecutionTrace.hx

@@ -0,0 +1,17 @@
+package cpp.vm;
+
+class ExecutionTrace
+{
+   public static function traceOff()
+   {
+      untyped __hxcpp_execution_trace(0);
+   }
+   public static function traceFunctions()
+   {
+      untyped __hxcpp_execution_trace(1);
+   }
+   public static function traceLines()
+   {
+      untyped __hxcpp_execution_trace(2);
+   }
+}