genFiles :: String (Box GType a) *World -> *World | gType{|*|} a
genFiles bn t w
- # tds = map (map gTypeToType) $ map (filter (not o isBasic)) $ flattenGType $ unBox t
+// # tds = map (map gTypeToType) $ map (filter (not o isBasic)) $ flattenGType $ unBox t
+ # tds = map (map gTypeToType) $ flattenGType $ unBox t
# (ok, h, w) = fopen (bn <.> "h") FWriteText w
| not ok = abort ("Couldn't open: " +++ bn <.> "h")
# (ok, c, w) = fopen (bn <.> "c") FWriteText w
<<< "#define " <<< toUpperCase bn <<< "_H\n"
<<< includes
# c = c <<< includes
- <<< "#include \"" <<< (bn <.> "h") <<< "\"\n"
+ <<< "#include <stdlib.h>\n"
+ <<< "#include \"" <<< (bn <.> "h") <<< "\"\n\n"
# h = case typedefs tds of
Left e = abort ("Couldn't generate typedef: " +++ e)
Right d = foldl (<<<) h d
<<< "#define " <<< toUpperCase bn <<< "_H\n"
<<< includes
# c = c <<< includes
- <<< "#include \"" <<< (bn <.> "h") <<< "\"\n"
+ <<< "#include \"" <<< (bn <.> "h") <<< "\"\n\n"
# h = case flatTypedef ty of
Left e = abort ("Couldn't generate typedef: " +++ e)
Right d = foldl (<<<) h d
[ genFiles "maybeInt" maybeInt
, genFiles "eitherIntChar" eitherIntChar
, genFiles "eitherIntMaybeChar" eitherIntMaybeChar
+ , genFiles "cp" cp
+ , genFiles "raint" raInt
+ , genFiles "lmint" lmInt
]
// ( flatTypedef $ gTypeToType $ unBox t
// , typedefs $ map (map gTypeToType) $ map (filter (not o isBasic)) $ flattenGType $ unBox t
eitherIntMaybeChar :: Box GType (Either Int (?Char))
eitherIntMaybeChar = gType{|*|}
+ cp :: Box GType CP
+ cp = gType{|*|}
+
+ raInt :: Box GType (RA Int)
+ raInt = gType{|*|}
+
+ lmInt :: Box GType [?Int]
+ lmInt = gType{|*|}
+
//Start = typedefs //$ (\x->[[gTypeToType x]])
// $ map (/*filter (not o isBuiltin) o*/ catMaybes o map gTypeToType)
// $ (\x->[[x]])