summaryrefslogtreecommitdiff
path: root/Language.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Language.hs')
-rw-r--r--Language.hs26
1 files changed, 6 insertions, 20 deletions
diff --git a/Language.hs b/Language.hs
index e0e53cf..6a5cc33 100644
--- a/Language.hs
+++ b/Language.hs
@@ -176,7 +176,7 @@ hsType aliasMap = \case
176 Data t -> t 176 Data t -> t
177 x -> error $ "unknown type: " ++ show x 177 x -> error $ "unknown type: " ++ show x
178 178
179csType :: AliasMap -> Type -> String 179csType :: AliasMap -> Type -> String -- TODO
180csType aliasMap a = case normalize aliasMap a of 180csType aliasMap a = case normalize aliasMap a of
181 Data t -> t 181 Data t -> t
182 Int -> "int" 182 Int -> "int"
@@ -193,7 +193,6 @@ csType aliasMap a = case normalize aliasMap a of
193 193
194cppType :: AliasMap -> Type -> String 194cppType :: AliasMap -> Type -> String
195cppType aliasMap = \case 195cppType aliasMap = \case
196 Data t -> "::" ++ t
197 Int -> "Int" 196 Int -> "Int"
198 Int32 -> "Int32" 197 Int32 -> "Int32"
199 Word -> "Word" 198 Word -> "Word"
@@ -201,18 +200,6 @@ cppType aliasMap = \case
201 Float -> "Float" 200 Float -> "Float"
202 Bool -> "Bool" 201 Bool -> "Bool"
203 String -> "String" 202 String -> "String"
204 Array t -> "std::vector<" ++ cppType aliasMap t ++ ">"
205 List t -> "std::vector<" ++ cppType aliasMap t ++ ">"
206 Map k v -> "std::map<" ++ cppType aliasMap k ++ ", " ++ cppType aliasMap v ++ ">"
207 _ -> "int"
208{-
209 Int -> "Int"
210 Int32 -> "Int32"
211 Word -> "Word"
212 Word32 -> "Word32"
213 Float -> "Float"
214 Bool -> "Bool"
215 String -> "String"
216 203
217 V2 Int -> "V2I" 204 V2 Int -> "V2I"
218 V2 Word -> "V2U" 205 V2 Word -> "V2U"
@@ -238,14 +225,13 @@ cppType aliasMap = \case
238 V4 (V3 Float) -> "M34F" 225 V4 (V3 Float) -> "M34F"
239 V4 (V4 Float) -> "M44F" 226 V4 (V4 Float) -> "M44F"
240 227
241 Array t -> "Vector " ++ parens (cppType aliasMap t) 228 Array t -> "std::vector<" ++ cppType aliasMap t ++ ">"
242 List t -> "[" ++ cppType aliasMap t ++ "]" 229 List t -> "std::vector<" ++ cppType aliasMap t ++ ">"
243 Maybe t -> "Maybe " ++ parens (cppType aliasMap t) 230 Maybe t -> "Maybe<" ++ cppType aliasMap t ++ ">"
244 Map k v -> "Map " ++ parens (cppType aliasMap k) ++ " " ++ parens (cppType aliasMap v) 231 Map k v -> "std::map<" ++ cppType aliasMap k ++ ", " ++ cppType aliasMap v ++ ">"
245 -- user defined 232 -- user defined
246 Data t -> t 233 Data t -> "::" ++ t
247 x -> error $ "unknown type: " ++ show x 234 x -> error $ "unknown type: " ++ show x
248-}
249 235
250hasFieldNames :: [Field] -> Bool 236hasFieldNames :: [Field] -> Bool
251hasFieldNames [] = False 237hasFieldNames [] = False