Browse Source

Add alias 'Single' for cpp.Float32. Closes https://github.com/HaxeFoundation/hxcpp/issues/555

Hugh 8 years ago
parent
commit
2d215cc72e
2 changed files with 4 additions and 3 deletions
  1. 3 2
      src/generators/gencpp.ml
  2. 1 1
      std/StdTypes.hx

+ 3 - 2
src/generators/gencpp.ml

@@ -68,7 +68,7 @@ let is_internal_class = function
    |  (["cpp"],"Int16") | (["cpp"],"UInt16")
    |  (["cpp"],"Int16") | (["cpp"],"UInt16")
    |  (["cpp"],"Int32") | (["cpp"],"UInt32")
    |  (["cpp"],"Int32") | (["cpp"],"UInt32")
    |  (["cpp"],"Int64") | (["cpp"],"UInt64")
    |  (["cpp"],"Int64") | (["cpp"],"UInt64")
-   |  (["cpp"],"Float32") | (["cpp"],"Float64") -> true
+   |  (["cpp"],"Float32") | (["cpp"],"Float64") | ([],"Single") -> true
    | _ -> false;;
    | _ -> false;;
 
 
 let get_include_prefix common_ctx with_slash =
 let get_include_prefix common_ctx with_slash =
@@ -587,7 +587,7 @@ let is_numeric = function
    | "::cpp::UInt32" | "::cpp::Int32"
    | "::cpp::UInt32" | "::cpp::Int32"
    | "::cpp::UInt64" | "::cpp::Int64"
    | "::cpp::UInt64" | "::cpp::Int64"
    | "::cpp::Float32" | "::cpp::Float64"
    | "::cpp::Float32" | "::cpp::Float64"
-   | "int" | "bool" | "double" | "float" -> true
+   | "int" | "bool" | "double" | "float" | "Single" -> true
    | _ -> false
    | _ -> false
 
 
 
 
@@ -1808,6 +1808,7 @@ let rec cpp_type_of ctx haxe_type =
       | ([], "EnumValue"),_ -> TCppObject
       | ([], "EnumValue"),_ -> TCppObject
       | ([], "Class"),_ -> TCppClass
       | ([], "Class"),_ -> TCppClass
       | ([], "Enum"),_  -> TCppClass
       | ([], "Enum"),_  -> TCppClass
+      | ([], "Single"),_ -> TCppScalar("float")
       | (["cpp"], "Char"),_ -> TCppScalar("char")
       | (["cpp"], "Char"),_ -> TCppScalar("char")
       | (["cpp"], "Object"),_ -> TCppObjectPtr
       | (["cpp"], "Object"),_ -> TCppObjectPtr
       | (["cpp"], "Float32"),_ -> TCppScalar("float")
       | (["cpp"], "Float32"),_ -> TCppScalar("float")

+ 1 - 1
std/StdTypes.hx

@@ -57,7 +57,7 @@
 **/
 **/
 @:coreType @:notNull @:runtimeValue abstract Int to Float { }
 @:coreType @:notNull @:runtimeValue abstract Int to Float { }
 
 
-#if (java || cs || hl)
+#if (java || cs || hl || cpp)
 /**
 /**
 	Single-precision IEEE 32bit float (4-byte).
 	Single-precision IEEE 32bit float (4-byte).
 **/
 **/