tools/pas2c/PascalParser.hs
changeset 10129 cd2a64a1f4aa
parent 10120 b7f632c12784
child 10131 4b4a043111f4
--- a/tools/pas2c/PascalParser.hs	Mon Feb 10 23:02:49 2014 +0400
+++ b/tools/pas2c/PascalParser.hs	Tue Feb 11 01:19:44 2014 +0400
@@ -329,11 +329,13 @@
         decorators <- many functionDecorator
         let inline = any (== "inline;") decorators
             overload = any (== "overload;") decorators
-        b <- if isImpl && (not forward) then
+            external = any (== "external;") decorators
+        -- TODO: don't mangle external functions names (and remove fpcrtl.h defines hacks)
+        b <- if isImpl && (not forward) && (not external) then
                 liftM Just functionBody
                 else
                 return Nothing
-        return $ [FunctionDeclaration i inline overload ret vs b]
+        return $ [FunctionDeclaration i inline overload external ret vs b]
 
     functionDecorator = do
         d <- choice [
@@ -342,7 +344,8 @@
             , try $ string "overload;"
             , try $ string "export;"
             , try $ string "varargs;"
-            , try (string' "external") >> comments >> iD >> optional (string' "name" >> comments >> stringLiteral pas) >> string' ";" >> return "external"
+            , try (string' "external") >> comments >> iD >> comments >>
+                optional (string' "name" >> comments >> stringLiteral pas) >> string' ";" >> return "external;"
             ]
         comments
         return d