Drop support for other string types than string255
authorunc0rr
Thu, 06 Feb 2014 23:02:35 +0400
changeset 10111 459bc720cea1
parent 10110 a7aed2eea727
child 10113 b26c2772e754
Drop support for other string types than string255
tools/pas2c/Pas2C.hs
tools/pas2c/PascalParser.hs
tools/pas2c/PascalUnitSyntaxTree.hs
--- a/tools/pas2c/Pas2C.hs	Thu Feb 06 19:05:22 2014 +0100
+++ b/tools/pas2c/Pas2C.hs	Thu Feb 06 23:02:35 2014 +0400
@@ -421,7 +421,7 @@
 resolveType (DeriveType (BuiltInFunction{})) = return (BTInt True)
 resolveType (DeriveType (InitReference (Identifier{}))) = return BTBool -- TODO: derive from actual type
 resolveType (DeriveType _) = return BTUnknown
-resolveType (String _) = return BTString
+resolveType String = return BTString
 resolveType VoidType = return BTVoid
 resolveType (Sequence ids) = return $ BTEnum $ map (\(Identifier i _) -> map toLower i) ids
 resolveType (RangeType _) = return $ BTVoid
@@ -713,7 +713,7 @@
     return r
     where
     type2C' VoidType = return (text "void" <+>)
-    type2C' (String l) = return (text "string255" <+>)--return (text ("string" ++ show l) <+>)
+    type2C' String = return (text "string255" <+>)--return (text ("string" ++ show l) <+>)
     type2C' (PointerTo (SimpleType i)) = do
         i' <- id2C IODeferred i
         lt <- gets lastType
--- a/tools/pas2c/PascalParser.hs	Thu Feb 06 19:05:22 2014 +0100
+++ b/tools/pas2c/PascalParser.hs	Thu Feb 06 23:02:35 2014 +0400
@@ -121,9 +121,9 @@
 
 typeDecl = choice [
     char '^' >> typeDecl >>= return . PointerTo
-    , try (string "shortstring") >> return (String 255)
-    , try (string "string") >> optionMaybe (brackets pas $ integer pas) >>= return . String . fromMaybe 255
-    , try (string "ansistring") >> optionMaybe (brackets pas $ integer pas) >>= return . String . fromMaybe 255
+    , try (string "shortstring") >> return String
+    , try (string "string") >> optionMaybe (brackets pas $ integer pas) >> return String
+    , try (string "ansistring") >> optionMaybe (brackets pas $ integer pas) >> return String
     , arrayDecl
     , recordDecl
     , setDecl
--- a/tools/pas2c/PascalUnitSyntaxTree.hs	Thu Feb 06 19:05:22 2014 +0100
+++ b/tools/pas2c/PascalUnitSyntaxTree.hs	Thu Feb 06 23:02:35 2014 +0400
@@ -28,7 +28,7 @@
     | ArrayDecl (Maybe Range) TypeDecl
     | RecordType [TypeVarDeclaration] (Maybe [[TypeVarDeclaration]])
     | PointerTo TypeDecl
-    | String Integer
+    | String
     | Set TypeDecl
     | FunctionType TypeDecl [TypeVarDeclaration]
     | DeriveType InitExpression