Fix some pas2c engine warnings
authorunc0rr
Thu, 15 May 2014 21:58:37 +0400
changeset 10245 3ccc054c3c3e
parent 10244 f7b5b4b88171
child 10246 8da91cd7a32a
Fix some pas2c engine warnings
hedgewars/uGearsUtils.pas
tools/pas2c/Pas2C.hs
tools/pas2c/PascalParser.hs
--- a/hedgewars/uGearsUtils.pas	Wed May 14 22:50:07 2014 +0400
+++ b/hedgewars/uGearsUtils.pas	Thu May 15 21:58:37 2014 +0400
@@ -380,7 +380,7 @@
                 Gear^.dY:= _90-(GetRandomf*_360)
                 end
             else DeleteGear(Gear);
-            exit
+            exit(true)
             end;
         isSubmersible:= ((Gear = CurrentHedgehog^.Gear) and (CurAmmoGear <> nil) and (CurAmmoGear^.State and gstSubmersible <> 0)) or (Gear^.State and gstSubmersible <> 0);
         skipSpeed := _0_25;
@@ -414,7 +414,7 @@
                             begin
                             // Gear could become nil after this, just exit to skip splashes
                             ResurrectHedgehog(Gear);
-                            exit
+                            exit(true)
                             end
                         else
                             begin
@@ -427,7 +427,7 @@
                     else
                         Gear^.doStep := @doStepDrowningGear;
                         if Gear^.Kind = gtFlake then
-                            exit // skip splashes
+                            exit(true) // skip splashes
                 end
             else if (Y > cWaterLine + cVisibleWater*4) and
                     ((Gear <> CurrentHedgehog^.Gear) or (CurAmmoGear = nil) or (CurAmmoGear^.State and gstSubmersible = 0)) then
--- a/tools/pas2c/Pas2C.hs	Wed May 14 22:50:07 2014 +0400
+++ b/tools/pas2c/Pas2C.hs	Thu May 15 21:58:37 2014 +0400
@@ -15,7 +15,7 @@
 import Data.List (find)
 import Numeric
 
-import PascalParser(pascalUnit)
+import PascalParser
 import PascalUnitSyntaxTree
 
 
@@ -237,7 +237,11 @@
 
 pascal2C (Program _ implementation mainFunction) = do
     impl <- implementation2C implementation
-    [main] <- tvar2C True False True True (FunctionDeclaration (Identifier "main" (BTInt True)) False False False (SimpleType $ Identifier "int" (BTInt True)) [VarDeclaration False False ([Identifier "argc" (BTInt True)], SimpleType (Identifier "Integer" (BTInt True))) Nothing, VarDeclaration False False ([Identifier "argv" BTUnknown], SimpleType (Identifier "PPChar" BTUnknown)) Nothing] (Just (TypesAndVars [], mainFunction)))
+    [main] <- tvar2C True False True True 
+        (FunctionDeclaration (Identifier "main" (BTInt True)) False False False (SimpleType $ Identifier "int" (BTInt True)) 
+            [VarDeclaration False False ([Identifier "argc" (BTInt True)], SimpleType (Identifier "Integer" (BTInt True))) Nothing
+            , VarDeclaration False False ([Identifier "argv" BTUnknown], SimpleType (Identifier "PPChar" BTUnknown)) Nothing] 
+        (Just (TypesAndVars [], Phrases [mainResultInit, mainFunction])))
 
     return $ impl $+$ main
 
--- a/tools/pas2c/PascalParser.hs	Wed May 14 22:50:07 2014 +0400
+++ b/tools/pas2c/PascalParser.hs	Thu May 15 21:58:37 2014 +0400
@@ -1,5 +1,6 @@
 module PascalParser (
-    pascalUnit
+    pascalUnit,
+    mainResultInit
     )
     where
 
@@ -13,6 +14,10 @@
 import PascalBasics
 import PascalUnitSyntaxTree
 
+
+mainResultInit :: Phrase
+mainResultInit = (\(Right a) -> a) $ parse phrase "<built-in>" "main:= 0;"
+
 knownTypes :: [String]
 knownTypes = ["shortstring", "ansistring", "char", "byte"]