geg
[clean-tests.git] / gengen / test.icl
index 7664753..66ef797 100644 (file)
@@ -53,7 +53,8 @@ includes = "#include <stdint.h>\n#include <stdbool.h>\n"
 
 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
@@ -62,7 +63,8 @@ genFiles bn t 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
@@ -87,7 +89,7 @@ genFilesFlat bn t w
                <<< "#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
@@ -105,6 +107,9 @@ Start w = foldr ($) w
        [ 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
@@ -120,6 +125,15 @@ where
        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]])