-------------------------------------------------------------------------------

ppEnvDecls :: Int -> [ExtVars] -> Doc
ppEnvDecls numIterations vars = 
  vcat $  
    [ space  
    , text "// External variables" 
    , vcat $ map ppEnvDecl vars
    , space
    , text "// External values" 
    , vcat $ map ppVals vars
    , space
    , space
    ]

  where
  ppEnvDecl :: (Name, DynamicF [] Type) -> Doc
  ppEnvDecl (name, DynamicF _ t) = 
    cType <+> text name <> semi
    where
    cType = ppUType UType { uTypeType = t }

  ppVals :: (Name, DynamicF [] Type) -> Doc
  ppVals (name, DynamicF vals t) = 
    cType <+> valsName name 
      <> lbrack <> (text . show) numIterations <> rbrack 
      <+> equals <+> lbrace <+> arrVals <+> rbrace <> semi
    where
    cType = ppUType UType { uTypeType = t }
    arrVals = hsep $ punctuate comma $ map text showVals
    showVals = map (showWithType C t) vals

--------------------------------------------------------------------------------

ppEnvDecls :: Int -> [ExtVars] -> Doc
ppEnvDecls numIterations vars = 
  vcat $  
    [ space  
    , text "// External variables" 
    , vcat $ map ppEnvDecl vars
    , space
    , text "// External values" 
    , vcat $ map ppVals vars
    , space
    , space
    ]

  where
  ppEnvDecl :: (Name, DynamicF [] Type) -> Doc
  ppEnvDecl (name, DynamicF _ t) = 
    cType <+> text name <> semi
    where
    cType = ppUType UType { uTypeType = t }

  ppVals :: (Name, DynamicF [] Type) -> Doc
  ppVals (name, DynamicF vals t) = 
    cType <+> valsName name 
      <> lbrack <> (text . show) numIterations <> rbrack 
      <+> equals <+> lbrace <+> arrVals <+> rbrace <> semi
    where
    cType = ppUType UType { uTypeType = t }
    arrVals = hsep $ punctuate comma $ map text showVals
    showVals = map (showWithType C t) vals

--------------------------------------------------------------------------------
ppEnvDecls numIterations vars = 
  vcat $  
    [ space  
    , text "// External variables" 
    , vcat $ map ppEnvDecl vars
    , space
    , text "// External values" 
    , vcat $ map ppVals vars
    , space
    , space
    ]

  where
  ppEnvDecl :: (Name, DynamicF [] Type) -> Doc
  ppEnvDecl (name, DynamicF _ t) = 
    cType <+> text name <> semi
    where
    cType = ppUType UType { uTypeType = t }

  ppVals :: (Name, DynamicF [] Type) -> Doc
  ppVals (name, DynamicF vals t) = 
    cType <+> valsName name 
      <> lbrack <> (text . show) numIterations <> rbrack 
      <+> equals <+> lbrace <+> arrVals <+> rbrace <> semi
    where
    cType = ppUType UType { uTypeType = t }
    arrVals = hsep $ punctuate comma $ map text showVals
    showVals = map (showWithType C t) vals

--------------------------------------------------------------------------------