Commit f4181aba by Zachary Snow

added pass-through support for strings

parent bce438c8
...@@ -170,7 +170,9 @@ traverseDeclM structs origDecl = do ...@@ -170,7 +170,9 @@ traverseDeclM structs origDecl = do
case origDecl of case origDecl of
Variable d t x a me -> do Variable d t x a me -> do
let (tf, rs) = typeRanges t let (tf, rs) = typeRanges t
modify $ Map.insert x (tf $ a ++ rs) if isRangeable t
then modify $ Map.insert x (tf $ a ++ rs)
else return ()
case me of case me of
Nothing -> return origDecl Nothing -> return origDecl
Just e -> do Just e -> do
...@@ -188,6 +190,10 @@ traverseDeclM structs origDecl = do ...@@ -188,6 +190,10 @@ traverseDeclM structs origDecl = do
types <- get types <- get
let (LHSIdent _, e') = convertAsgn structs types (LHSIdent x, e) let (LHSIdent _, e') = convertAsgn structs types (LHSIdent x, e)
return e' return e'
isRangeable :: Type -> Bool
isRangeable (IntegerAtom _ _) = False
isRangeable (NonInteger _ ) = False
isRangeable _ = True
-- produces a function which packs the components of a struct literal -- produces a function which packs the components of a struct literal
packerFn :: TypeFunc -> ModuleItem packerFn :: TypeFunc -> ModuleItem
......
...@@ -146,6 +146,7 @@ data NonIntegerType ...@@ -146,6 +146,7 @@ data NonIntegerType
= TShortreal = TShortreal
| TReal | TReal
| TRealtime | TRealtime
| TString
deriving (Eq, Ord) deriving (Eq, Ord)
instance Show NetType where instance Show NetType where
...@@ -176,6 +177,7 @@ instance Show NonIntegerType where ...@@ -176,6 +177,7 @@ instance Show NonIntegerType where
show TShortreal = "shortreal" show TShortreal = "shortreal"
show TReal = "real" show TReal = "real"
show TRealtime = "realtime" show TRealtime = "realtime"
show TString = "string"
data Packing data Packing
= Unpacked = Unpacked
......
...@@ -485,6 +485,7 @@ NonIntegerType :: { NonIntegerType } ...@@ -485,6 +485,7 @@ NonIntegerType :: { NonIntegerType }
: "shortreal" { TShortreal } : "shortreal" { TShortreal }
| "real" { TReal } | "real" { TReal }
| "realtime" { TRealtime } | "realtime" { TRealtime }
| "string" { TString }
EnumItems :: { [(Identifier, Maybe Expr)] } EnumItems :: { [(Identifier, Maybe Expr)] }
: VariablePortIdentifiers { $1 } : VariablePortIdentifiers { $1 }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment