From 89886ef083b24350dd92615aa68546de79070436 Mon Sep 17 00:00:00 2001 From: Stardew Date: Tue, 27 Aug 2024 16:26:27 -0400 Subject: [PATCH 01/17] added scope and motivation fields into SI --- code/drasil-code/lib/Language/Drasil/CodeSpec.hs | 8 ++++++++ code/drasil-gen/lib/Language/Drasil/TypeCheck.hs | 2 +- code/drasil-sysinfo/lib/SysInfo/Drasil.hs | 4 ++-- .../lib/SysInfo/Drasil/SystemInformation.hs | 15 ++++++++++++--- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/code/drasil-code/lib/Language/Drasil/CodeSpec.hs b/code/drasil-code/lib/Language/Drasil/CodeSpec.hs index 46ecc6c2cb..dd73ab4941 100644 --- a/code/drasil-code/lib/Language/Drasil/CodeSpec.hs +++ b/code/drasil-code/lib/Language/Drasil/CodeSpec.hs @@ -47,6 +47,10 @@ data CodeSpec where purpose :: Purpose, -- | Example Background. background :: Background, + -- | Example Scope. + scope :: Scope, + -- | Example Motivation. + motivation :: Motivation, -- | All inputs. inputs :: [Input], -- | Explicit inputs (values to be supplied by a file). @@ -98,6 +102,8 @@ codeSpec SI {_sys = sys , _authors = as , _purpose = ps , _background = bk + , _scope = scp + , _motivation = mtvtn , _instModels = ims , _datadefs = ddefs , _configFiles = cfp @@ -123,6 +129,8 @@ codeSpec SI {_sys = sys authors = as, purpose = ps, background = bk, + scope = scp, + motivation = mtvtn, inputs = allInputs, extInputs = inputs', derivedInputs = derived, diff --git a/code/drasil-gen/lib/Language/Drasil/TypeCheck.hs b/code/drasil-gen/lib/Language/Drasil/TypeCheck.hs index ca5a58ac07..392d35157e 100644 --- a/code/drasil-gen/lib/Language/Drasil/TypeCheck.hs +++ b/code/drasil-gen/lib/Language/Drasil/TypeCheck.hs @@ -13,7 +13,7 @@ import SysInfo.Drasil (SystemInformation(SI)) typeCheckSI :: SystemInformation -> IO () typeCheckSI - (SI _ _ _ _ _ _ _ ims dds _ _ _ _ _ _ chks _ _) + (SI _ _ _ _ _ _ _ _ _ ims dds _ _ _ _ _ _ chks _ _) = do -- build a variable context (a map of UIDs to "Space"s [types]) let cxt = M.map (\(dict, _) -> dict ^. typ) (symbolTable chks) diff --git a/code/drasil-sysinfo/lib/SysInfo/Drasil.hs b/code/drasil-sysinfo/lib/SysInfo/Drasil.hs index 257eb77c9a..84b12639d8 100644 --- a/code/drasil-sysinfo/lib/SysInfo/Drasil.hs +++ b/code/drasil-sysinfo/lib/SysInfo/Drasil.hs @@ -2,8 +2,8 @@ module SysInfo.Drasil ( -- * System Information SystemInformation(..), Block(Parallel), sysinfodb -- * Reference Database - , ReferenceDB, RefMap, Purpose, Background, citeDB, rdb, simpleMap - , citationDB, conceptDB + , ReferenceDB, RefMap, Purpose, Background, Scope, Motivation + , citeDB, rdb, simpleMap, citationDB, conceptDB -- ** Utility Helper Functions -- GetChunk diff --git a/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs b/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs index 7b86fbcc31..3bd30457b0 100644 --- a/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs +++ b/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs @@ -10,13 +10,13 @@ module SysInfo.Drasil.SystemInformation ( -- ** Types SystemInformation(..), Block(..), -- ** Lenses - instModels, datadefs, configFiles, inputs, purpose, background, - defSequence, constraints, constants, sysinfodb, usedinfodb, + instModels, datadefs, configFiles, inputs, purpose, background, scope, + motivation, defSequence, constraints, constants, sysinfodb, usedinfodb, -- ** Lookup Functions citeDB, citationsFromBibMap, -- * Reference Database -- ** Types - ReferenceDB, RefMap, Purpose, Background, + ReferenceDB, RefMap, Purpose, Background, Scope, SoftwareReview, Motivation, -- ** Constructors rdb, simpleMap, -- ** Lenses @@ -50,6 +50,9 @@ data SystemInformation where , _authors :: [c] , _purpose :: Purpose , _background :: Background + , _scope :: Scope + , _sftwe_rev :: SoftwareReview + , _motivation :: Motivation , _quants :: [e] , _concepts :: [f] , _instModels :: [InstanceModel] @@ -70,6 +73,12 @@ data SystemInformation where type Purpose = [Sentence] -- | Project Example background information, used in the 'What' section of README. type Background = [Sentence] +-- | Project Example scope. +type Scope = [Sentence] +-- | Project Example software revision. +type SoftwareReview = [Sentence] +-- | Project Example motivation. +type Motivation = [Sentence] -- | for listing 'QDefinition's in 'SystemInformation'. data Block a = Coupled a a [a] | Parallel a [a] From a849147a6c3139060f8480a3ff6976ff1b67b3f5 Mon Sep 17 00:00:00 2001 From: Stardew Date: Thu, 29 Aug 2024 14:22:18 -0400 Subject: [PATCH 02/17] linked SI to README --- .../Code/Imperative/GOOL/ClassInterface.hs | 6 ++++++ .../Drasil/Code/Imperative/Generator.hs | 12 ++++++++++++ .../Drasil/Code/Imperative/WriteReadMe.hs | 6 +++++- .../lib/Language/Drasil/Markdown/CreateMd.hs | 18 ++++++++++-------- .../lib/SysInfo/Drasil/SystemInformation.hs | 5 +---- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/ClassInterface.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/ClassInterface.hs index e70871a7ec..cbca9c06ed 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/ClassInterface.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/ClassInterface.hs @@ -52,6 +52,10 @@ type CaseName = String type ExamplePurpose = String -- | Description of example type ExampleDescr = String +-- | Motivation of example +type ExampleMotivation = String +-- | Scope of exmample +type ExampleScope = String -- | File contributors type Contributor = String -- | Input File @@ -71,6 +75,8 @@ data ReadMeInfo = ReadMeInfo { caseName :: CaseName, examplePurpose :: ExamplePurpose, exampleDescr :: ExampleDescr, + exampleMotivation :: ExampleMotivation, + exampleScope :: ExampleScope, folderNum :: Int, inputOutput :: (InFile, OutFile) } diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs index b002f1928f..0e1a34e901 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs @@ -150,6 +150,10 @@ genPackage unRepr = do (foldlSent $ purpose $ codeSpec g) bckgrnd = show $ sentenceDoc db Implementation OneLine (foldlSent $ background $ codeSpec g) + mtvtn = show $ sentenceDoc db Implementation OneLine + (foldlSent $ motivation $ codeSpec g) + scp = show $ sentenceDoc db Implementation OneLine + (foldlSent $ scope $ codeSpec g) i <- genSampleInput d <- genDoxConfig s rm <- genReadMe ReadMeInfo { @@ -164,6 +168,8 @@ genPackage unRepr = do caseName = "", examplePurpose = prps, exampleDescr = bckgrnd, + exampleMotivation = mtvtn, + exampleScope = scp, folderNum = getVal g, inputOutput = (sampleInputName, "output.txt")} -- This needs a more permanent solution return $ package pd (m:catMaybes [i,rm,d]) @@ -256,6 +262,10 @@ genPackageProc unRepr = do (foldlSent $ purpose $ codeSpec g) bckgrnd = show $ sentenceDoc db Implementation OneLine (foldlSent $ background $ codeSpec g) + mtvtn = show $ sentenceDoc db Implementation OneLine + (foldlSent $ motivation $ codeSpec g) + scp = show $ sentenceDoc db Implementation OneLine + (foldlSent $ scope $ codeSpec g) i <- genSampleInput d <- genDoxConfig s rm <- genReadMe ReadMeInfo { @@ -270,6 +280,8 @@ genPackageProc unRepr = do caseName = "", examplePurpose = prps, exampleDescr = bckgrnd, + exampleMotivation = mtvtn, + exampleScope = scp, folderNum = getVal g, inputOutput = (sampleInputName, "output.txt")} -- This needs a more permanent solution return $ package pd (m:catMaybes [i,rm,d]) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs index 4f07831f99..1ec9a78a82 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs @@ -25,9 +25,13 @@ makeReadMe ReadMeInfo { caseName = name, examplePurpose = purp, exampleDescr = descr, + exampleMotivation = motiv, + exampleScope = sc, folderNum = number, inputOutput = inoutf} = - makeMd [introInfo name auths $ fieldEmptySTR purp, + makeMd [introInfo name auths (fieldEmptySTR motiv) + (fieldEmptySTR purp) + (fieldEmptySTR sc), whatInfo $ fieldEmptySTR descr, makeInstr imptype configFPs name inoutf, verInfo progLang progLangVers, diff --git a/code/drasil-printers/lib/Language/Drasil/Markdown/CreateMd.hs b/code/drasil-printers/lib/Language/Drasil/Markdown/CreateMd.hs index c963658260..623264a815 100644 --- a/code/drasil-printers/lib/Language/Drasil/Markdown/CreateMd.hs +++ b/code/drasil-printers/lib/Language/Drasil/Markdown/CreateMd.hs @@ -17,8 +17,9 @@ makeMd :: [Doc] -> Doc makeMd = vcat . punctuate secSep . filterEmpty -- | Example title, authors, and maybe purpose section. -introInfo :: String -> [String] -> Maybe String -> Doc -introInfo name auths descr = introSec (text name) (listToDoc auths) (length auths) (maybePurpDoc descr) +introInfo :: String -> [String] -> Maybe String -> Maybe String -> Maybe String -> Doc +introInfo name auths motiv descr sc = introSec (text name) (listToDoc auths) (length auths) + (maybeSub "Motivation" motiv) (maybeSub "Purpose" descr) (maybeSub "Scope" sc) -- | Instruction section, contains 4 paragraphs, Running, Building, Input-Output and Config Files. -- The Config file section is only displayed if there are configuration files. @@ -26,9 +27,10 @@ instDoc :: [String] -> String -> (String, String) -> Doc instDoc cfp name inoutn = regularSec (text "Making Examples") (runInstDoc inoutn <> doubleSep <> makeInstDoc) <> inOutFile name inoutn <> configSec cfp --- | Helper for creating optional Purpose subsection as Doc -maybePurpDoc :: Maybe String -> Doc -maybePurpDoc = maybe empty (\descr-> doubleSep <> text "> Purpose:" <+> upcase descr) +-- | Helper for creating optional Intro subsection as Doc +maybeSub :: String -> Maybe String -> Doc +maybeSub role = maybe empty (\content-> doubleSep <> text ("> " ++ role ++ ":") + <+> upcase content) -- | 'What' section in generated README file, does not display if empty whatInfo :: Maybe String -> Doc @@ -129,9 +131,9 @@ bkQuote3 = text "```" -- FIXME as explained in #2224 we still need to add in the purpose section, -- this could be done by adding a third parameter to introSec -- | Constructs introduction section from header and message. -introSec :: Doc -> Doc -> Int -> Doc -> Doc -introSec hd ms1 l descr = text "#" <+> hd <+> contSep <> (if l == 1 then text "> Author:" else text "> Authors: ") - <+> ms1 <> descr +introSec :: Doc -> Doc -> Int -> Doc -> Doc -> Doc -> Doc +introSec hd ms1 l motiv descr sc = text "#" <+> hd <+> contSep <> (if l == 1 then text "> Author:" else text "> Authors: ") + <+> ms1 <> motiv <> descr <> sc -- | Constructs regular section section from header and message. regularSec :: Doc -> Doc -> Doc diff --git a/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs b/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs index 3bd30457b0..c94b0cfb63 100644 --- a/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs +++ b/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs @@ -16,7 +16,7 @@ module SysInfo.Drasil.SystemInformation ( citeDB, citationsFromBibMap, -- * Reference Database -- ** Types - ReferenceDB, RefMap, Purpose, Background, Scope, SoftwareReview, Motivation, + ReferenceDB, RefMap, Purpose, Background, Scope, Motivation, -- ** Constructors rdb, simpleMap, -- ** Lenses @@ -51,7 +51,6 @@ data SystemInformation where , _purpose :: Purpose , _background :: Background , _scope :: Scope - , _sftwe_rev :: SoftwareReview , _motivation :: Motivation , _quants :: [e] , _concepts :: [f] @@ -75,8 +74,6 @@ type Purpose = [Sentence] type Background = [Sentence] -- | Project Example scope. type Scope = [Sentence] --- | Project Example software revision. -type SoftwareReview = [Sentence] -- | Project Example motivation. type Motivation = [Sentence] From 0974d1763a99f54c6708b7da4861d636b50d3cdb Mon Sep 17 00:00:00 2001 From: Stardew Date: Thu, 29 Aug 2024 14:23:05 -0400 Subject: [PATCH 03/17] added new fields into example SI --- code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs | 4 +++- .../gamephysics/lib/Drasil/GamePhysics/Body.hs | 2 ++ code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs | 2 ++ code/drasil-example/hghc/lib/Drasil/HGHC/Body.hs | 2 ++ .../pdcontroller/lib/Drasil/PDController/Body.hs | 2 ++ .../drasil-example/projectile/lib/Drasil/Projectile/Body.hs | 6 ++++++ .../projectile/lib/Drasil/Projectile/Lesson/Body.hs | 2 ++ code/drasil-example/ssp/lib/Drasil/SSP/Body.hs | 2 ++ code/drasil-example/swhs/lib/Drasil/SWHS/Body.hs | 2 ++ code/drasil-example/swhsnopcm/lib/Drasil/SWHSNoPCM/Body.hs | 2 ++ code/drasil-example/template/lib/Drasil/Template/Body.hs | 2 ++ code/drasil-website/lib/Drasil/Website/Body.hs | 2 ++ 12 files changed, 29 insertions(+), 1 deletion(-) diff --git a/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs b/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs index 44f0e40a06..31de1f8ef4 100644 --- a/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs +++ b/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs @@ -110,7 +110,9 @@ si = SI { _kind = Doc.srs, _authors = [dong], _purpose = [purp], - _background = [], + _background = [], + _motivation = [], + _scope = [], _quants = symbolsAll, _concepts = [] :: [DefinedQuantityDict], _instModels = iMods, diff --git a/code/drasil-example/gamephysics/lib/Drasil/GamePhysics/Body.hs b/code/drasil-example/gamephysics/lib/Drasil/GamePhysics/Body.hs index 85ce68ec14..2fac8cca59 100644 --- a/code/drasil-example/gamephysics/lib/Drasil/GamePhysics/Body.hs +++ b/code/drasil-example/gamephysics/lib/Drasil/GamePhysics/Body.hs @@ -104,6 +104,8 @@ si = SI { _authors = [alex, luthfi, olu], _purpose = [purp], _background = [], + _motivation = [], + _scope = [], -- FIXME: The _quants field should be filled in with all the symbols, however -- #1658 is why this is empty, otherwise we end up with unused (and probably -- should be removed) symbols. But that's for another time. This is "fine" diff --git a/code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs b/code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs index fdb083ed90..9d9a55f0b6 100644 --- a/code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs +++ b/code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs @@ -64,6 +64,8 @@ si = SI { _authors = [nikitha, spencerSmith], _purpose = [purp], _background = [], + _motivation = [], + _scope = [], _quants = symbolsForTable, _concepts = [] :: [DefinedQuantityDict], _instModels = iMods, diff --git a/code/drasil-example/hghc/lib/Drasil/HGHC/Body.hs b/code/drasil-example/hghc/lib/Drasil/HGHC/Body.hs index 3b5db7e8cf..b26e85f0d1 100644 --- a/code/drasil-example/hghc/lib/Drasil/HGHC/Body.hs +++ b/code/drasil-example/hghc/lib/Drasil/HGHC/Body.hs @@ -31,6 +31,8 @@ si = SI { _quants = symbols, _purpose = [purp], _background = [], + _motivation = [], + _scope = [], _concepts = [] :: [UnitalChunk], _instModels = [], -- FIXME; empty _instModels _datadefs = dataDefs, diff --git a/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs b/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs index 1320b104e0..13d62cf545 100644 --- a/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs +++ b/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs @@ -103,6 +103,8 @@ si = SI { _authors = [naveen], _purpose = [purp], _background = [], + _motivation = [], + _scope = [], _quants = symbolsAll, _concepts = [] :: [DefinedQuantityDict], _datadefs = dataDefinitions, diff --git a/code/drasil-example/projectile/lib/Drasil/Projectile/Body.hs b/code/drasil-example/projectile/lib/Drasil/Projectile/Body.hs index 643b12d1cb..f4f136914f 100644 --- a/code/drasil-example/projectile/lib/Drasil/Projectile/Body.hs +++ b/code/drasil-example/projectile/lib/Drasil/Projectile/Body.hs @@ -103,6 +103,10 @@ mkSRS = [TableOfContents, Bibliography ] +motivation :: Sentence +motivation = foldlSent_ [phrase projectile, phrase motion, S "is a common" +:+ + phraseNP (problem `in_` physics)] + justification, scope :: Sentence justification = foldlSent [atStart projectile, phrase motion, S "is a common" +:+. phraseNP (problem `in_` physics), S "Therefore, it is useful to have a", @@ -137,6 +141,8 @@ si = SI { _authors = [samCrawford, brooks, spencerSmith], _purpose = [purp], _background = [], + _motivation = [motivation], + _scope = [scope], _quants = symbols, _concepts = [] :: [DefinedQuantityDict], _instModels = iMods, diff --git a/code/drasil-example/projectile/lib/Drasil/Projectile/Lesson/Body.hs b/code/drasil-example/projectile/lib/Drasil/Projectile/Lesson/Body.hs index b3fac4d06d..4c9d26b9f0 100644 --- a/code/drasil-example/projectile/lib/Drasil/Projectile/Lesson/Body.hs +++ b/code/drasil-example/projectile/lib/Drasil/Projectile/Lesson/Body.hs @@ -49,6 +49,8 @@ si = SI { _authors = [spencerSmith], _purpose = [], _background = [], + _motivation = [], + _scope = [], _quants = [] :: [QuantityDict], _concepts = [] :: [DefinedQuantityDict], _instModels = [], diff --git a/code/drasil-example/ssp/lib/Drasil/SSP/Body.hs b/code/drasil-example/ssp/lib/Drasil/SSP/Body.hs index ae6bec53e7..5ee3fc0315 100644 --- a/code/drasil-example/ssp/lib/Drasil/SSP/Body.hs +++ b/code/drasil-example/ssp/lib/Drasil/SSP/Body.hs @@ -75,6 +75,8 @@ si = SI { _authors = [henryFrankis, brooks], _purpose = [purp], _background = [], + _motivation = [], + _scope = [], _quants = symbols, _concepts = [] :: [DefinedQuantityDict], _instModels = SSP.iMods, diff --git a/code/drasil-example/swhs/lib/Drasil/SWHS/Body.hs b/code/drasil-example/swhs/lib/Drasil/SWHS/Body.hs index 305c89d9c5..8890bac309 100755 --- a/code/drasil-example/swhs/lib/Drasil/SWHS/Body.hs +++ b/code/drasil-example/swhs/lib/Drasil/SWHS/Body.hs @@ -81,6 +81,8 @@ si = SI { _authors = [thulasi, brooks, spencerSmith], _purpose = [purp], _background = [], + _motivation = [], + _scope = [], _quants = symbols, _concepts = [] :: [DefinedQuantityDict], _instModels = insModel, diff --git a/code/drasil-example/swhsnopcm/lib/Drasil/SWHSNoPCM/Body.hs b/code/drasil-example/swhsnopcm/lib/Drasil/SWHSNoPCM/Body.hs index 12602c56d1..97ac4532cf 100644 --- a/code/drasil-example/swhsnopcm/lib/Drasil/SWHSNoPCM/Body.hs +++ b/code/drasil-example/swhsnopcm/lib/Drasil/SWHSNoPCM/Body.hs @@ -177,6 +177,8 @@ si = SI { _authors = [thulasi], _purpose = [purp], _background = [], + _motivation = [], + _scope = [], -- FIXME: Everything after (and including) \\ should be removed when -- #1658 is resolved. Basically, _quants is used here, but -- tau does not appear in the document and thus should not be displayed. diff --git a/code/drasil-example/template/lib/Drasil/Template/Body.hs b/code/drasil-example/template/lib/Drasil/Template/Body.hs index d9319fe445..cfcc46705f 100644 --- a/code/drasil-example/template/lib/Drasil/Template/Body.hs +++ b/code/drasil-example/template/lib/Drasil/Template/Body.hs @@ -91,6 +91,8 @@ si = SI { _authors = [authorName], _background = [], _purpose = [], + _motivation = [], + _scope = [], _quants = [] :: [QuantityDict], _concepts = [] :: [DefinedQuantityDict], _instModels = [] :: [InstanceModel], diff --git a/code/drasil-website/lib/Drasil/Website/Body.hs b/code/drasil-website/lib/Drasil/Website/Body.hs index 94005f5d66..fa7d7ef478 100644 --- a/code/drasil-website/lib/Drasil/Website/Body.hs +++ b/code/drasil-website/lib/Drasil/Website/Body.hs @@ -78,6 +78,8 @@ si fl = SI { _quants = [] :: [QuantityDict], _purpose = [], _background = [], + _motivation = [], + _scope = [], _concepts = [] :: [UnitalChunk], _instModels = [], _datadefs = [], From 2de0bd8135e5ed25c5bcf5929670b93f3e597ae7 Mon Sep 17 00:00:00 2001 From: Stardew Date: Thu, 29 Aug 2024 14:25:40 -0400 Subject: [PATCH 04/17] Stabilized projectile READMEs --- .../projectile/projectile_m_l_nol_u_u_v_f/src/cpp/README.md | 4 ++++ .../projectile_m_l_nol_u_u_v_f/src/csharp/README.md | 4 ++++ .../projectile/projectile_m_l_nol_u_u_v_f/src/java/README.md | 4 ++++ .../projectile/projectile_m_l_nol_u_u_v_f/src/julia/README.md | 4 ++++ .../projectile_m_l_nol_u_u_v_f/src/python/README.md | 4 ++++ .../projectile/projectile_m_l_nol_u_u_v_f/src/swift/README.md | 4 ++++ .../projectile/projectile_m_p_nol_b_u_v_d/src/cpp/README.md | 4 ++++ .../projectile_m_p_nol_b_u_v_d/src/csharp/README.md | 4 ++++ .../projectile/projectile_m_p_nol_b_u_v_d/src/java/README.md | 4 ++++ .../projectile_m_p_nol_b_u_v_d/src/python/README.md | 4 ++++ .../projectile/projectile_m_p_nol_b_u_v_d/src/swift/README.md | 4 ++++ .../projectile/projectile_u_p_l_b_b_c_d/src/cpp/README.md | 4 ++++ .../projectile/projectile_u_p_l_b_b_c_d/src/csharp/README.md | 4 ++++ .../projectile/projectile_u_p_l_b_b_c_d/src/java/README.md | 4 ++++ .../projectile/projectile_u_p_l_b_b_c_d/src/python/README.md | 4 ++++ .../projectile/projectile_u_p_l_b_b_c_d/src/swift/README.md | 4 ++++ .../projectile/projectile_u_p_l_b_wi_v_f/src/cpp/README.md | 4 ++++ .../projectile/projectile_u_p_l_b_wi_v_f/src/csharp/README.md | 4 ++++ .../projectile/projectile_u_p_l_b_wi_v_f/src/java/README.md | 4 ++++ .../projectile/projectile_u_p_l_b_wi_v_f/src/python/README.md | 4 ++++ .../projectile/projectile_u_p_l_b_wi_v_f/src/swift/README.md | 4 ++++ .../projectile/projectile_u_p_nol_u_wi_v_d/src/cpp/README.md | 4 ++++ .../projectile_u_p_nol_u_wi_v_d/src/csharp/README.md | 4 ++++ .../projectile/projectile_u_p_nol_u_wi_v_d/src/java/README.md | 4 ++++ .../projectile_u_p_nol_u_wi_v_d/src/julia/README.md | 4 ++++ .../projectile_u_p_nol_u_wi_v_d/src/python/README.md | 4 ++++ .../projectile_u_p_nol_u_wi_v_d/src/swift/README.md | 4 ++++ 27 files changed, 108 insertions(+) diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/cpp/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/cpp/README.md index f8f25ca4fd..b1301ca6b2 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/cpp/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/cpp/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Version `C++ gcc 10.1` diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/csharp/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/csharp/README.md index 19b74f4d7c..c8738f2325 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/csharp/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/csharp/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Version `C# 6.0` diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/java/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/java/README.md index 1557376866..548d6ab44f 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/java/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/java/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Version `Java 14` diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/julia/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/julia/README.md index 8591e6118d..5a74eca472 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/julia/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/julia/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Version `Julia 1.10.3` diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/python/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/python/README.md index c8c2b285e8..573130093e 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/python/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/python/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Version `Python 3.5.1` diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/swift/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/swift/README.md index 16583de432..10e3ed713d 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/swift/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/swift/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Version `Swift 5.2.4` diff --git a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/cpp/README.md b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/cpp/README.md index ac0e5030ea..3bf8c537cd 100644 --- a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/cpp/README.md +++ b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/cpp/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/csharp/README.md b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/csharp/README.md index d15e25eb5f..40857f8758 100644 --- a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/csharp/README.md +++ b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/csharp/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/java/README.md b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/java/README.md index 44e905ca20..2f8f6dce10 100644 --- a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/java/README.md +++ b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/java/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/python/README.md b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/python/README.md index d900db0bfe..cecaacc37a 100644 --- a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/python/README.md +++ b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/python/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/swift/README.md b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/swift/README.md index f9919378d6..20327d5f3f 100644 --- a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/swift/README.md +++ b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/swift/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/cpp/README.md b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/cpp/README.md index ac0e5030ea..3bf8c537cd 100644 --- a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/cpp/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/cpp/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/csharp/README.md b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/csharp/README.md index d15e25eb5f..40857f8758 100644 --- a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/csharp/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/csharp/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/java/README.md b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/java/README.md index 44e905ca20..2f8f6dce10 100644 --- a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/java/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/java/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/python/README.md b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/python/README.md index d900db0bfe..cecaacc37a 100644 --- a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/python/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/python/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/swift/README.md b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/swift/README.md index f9919378d6..20327d5f3f 100644 --- a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/swift/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/swift/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/cpp/README.md b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/cpp/README.md index ac0e5030ea..3bf8c537cd 100644 --- a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/cpp/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/cpp/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/csharp/README.md b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/csharp/README.md index d15e25eb5f..40857f8758 100644 --- a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/csharp/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/csharp/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/java/README.md b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/java/README.md index 44e905ca20..2f8f6dce10 100644 --- a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/java/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/java/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/python/README.md b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/python/README.md index d900db0bfe..cecaacc37a 100644 --- a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/python/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/python/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/swift/README.md b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/swift/README.md index f9919378d6..20327d5f3f 100644 --- a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/swift/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/swift/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/cpp/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/cpp/README.md index ac0e5030ea..3bf8c537cd 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/cpp/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/cpp/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/csharp/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/csharp/README.md index d15e25eb5f..40857f8758 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/csharp/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/csharp/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/java/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/java/README.md index 44e905ca20..2f8f6dce10 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/java/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/java/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/julia/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/julia/README.md index 7e143fbec9..1b71d27676 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/julia/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/julia/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/python/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/python/README.md index d900db0bfe..cecaacc37a 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/python/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/python/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/swift/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/swift/README.md index f9919378d6..20327d5f3f 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/swift/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/swift/README.md @@ -1,8 +1,12 @@ # Projectile > Authors: Samuel J. Crawford, Brooks MacLachlan, W. Spencer Smith +> Motivation: Projectile motion is a common problem in physics. + > Purpose: Predict whether a launched projectile hits its target. +> Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. + ------------------------------------------------------------ ## Making Examples How to Run the Program: From 915505dde84091b330e1a828be56c67aa0e0b3d1 Mon Sep 17 00:00:00 2001 From: Stardew Date: Tue, 3 Sep 2024 12:32:29 -0400 Subject: [PATCH 05/17] Refactor documentation sections: - Restructure `introInfo` to focus on `motivation` and `purpose`. - Adjust `whatInfo` to address `background` and `scope`. --- .../Drasil/Code/Imperative/WriteReadMe.hs | 5 ++--- .../lib/Language/Drasil/Markdown/CreateMd.hs | 20 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs index 1ec9a78a82..0142af1c51 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs @@ -30,9 +30,8 @@ makeReadMe ReadMeInfo { folderNum = number, inputOutput = inoutf} = makeMd [introInfo name auths (fieldEmptySTR motiv) - (fieldEmptySTR purp) - (fieldEmptySTR sc), - whatInfo $ fieldEmptySTR descr, + (fieldEmptySTR purp), + whatInfo (fieldEmptySTR descr) (fieldEmptySTR sc), makeInstr imptype configFPs name inoutf, verInfo progLang progLangVers, unsupOS unsupportedOSs, diff --git a/code/drasil-printers/lib/Language/Drasil/Markdown/CreateMd.hs b/code/drasil-printers/lib/Language/Drasil/Markdown/CreateMd.hs index 623264a815..6aad76a88e 100644 --- a/code/drasil-printers/lib/Language/Drasil/Markdown/CreateMd.hs +++ b/code/drasil-printers/lib/Language/Drasil/Markdown/CreateMd.hs @@ -17,9 +17,9 @@ makeMd :: [Doc] -> Doc makeMd = vcat . punctuate secSep . filterEmpty -- | Example title, authors, and maybe purpose section. -introInfo :: String -> [String] -> Maybe String -> Maybe String -> Maybe String -> Doc -introInfo name auths motiv descr sc = introSec (text name) (listToDoc auths) (length auths) - (maybeSub "Motivation" motiv) (maybeSub "Purpose" descr) (maybeSub "Scope" sc) +introInfo :: String -> [String] -> Maybe String -> Maybe String -> Doc +introInfo name auths motiv descr = introSec (text name) (listToDoc auths) (length auths) + (maybeSub "Motivation" motiv) (maybeSub "Purpose" descr) -- | Instruction section, contains 4 paragraphs, Running, Building, Input-Output and Config Files. -- The Config file section is only displayed if there are configuration files. @@ -27,15 +27,15 @@ instDoc :: [String] -> String -> (String, String) -> Doc instDoc cfp name inoutn = regularSec (text "Making Examples") (runInstDoc inoutn <> doubleSep <> makeInstDoc) <> inOutFile name inoutn <> configSec cfp +-- | 'What' section in generated README file, displays description and scope if not empty +whatInfo :: Maybe String -> Maybe String -> Doc +whatInfo descr sc = regularSec (text "What") (maybeSub "Background" descr <> maybeSub "Scope" sc) + -- | Helper for creating optional Intro subsection as Doc maybeSub :: String -> Maybe String -> Doc maybeSub role = maybe empty (\content-> doubleSep <> text ("> " ++ role ++ ":") <+> upcase content) --- | 'What' section in generated README file, does not display if empty -whatInfo :: Maybe String -> Doc -whatInfo = maybe empty (regularSec (text "What") . text) - -- | Helper for giving instructions on the command line. commandLine :: Doc commandLine = text $ "In your terminal command line, enter the same directory as this " ++ @@ -131,9 +131,9 @@ bkQuote3 = text "```" -- FIXME as explained in #2224 we still need to add in the purpose section, -- this could be done by adding a third parameter to introSec -- | Constructs introduction section from header and message. -introSec :: Doc -> Doc -> Int -> Doc -> Doc -> Doc -> Doc -introSec hd ms1 l motiv descr sc = text "#" <+> hd <+> contSep <> (if l == 1 then text "> Author:" else text "> Authors: ") - <+> ms1 <> motiv <> descr <> sc +introSec :: Doc -> Doc -> Int -> Doc -> Doc -> Doc +introSec hd ms1 l motiv purp = text "#" <+> hd <+> contSep <> (if l == 1 then text "> Author:" else text "> Authors: ") + <+> ms1 <> motiv <> purp -- | Constructs regular section section from header and message. regularSec :: Doc -> Doc -> Doc From 267b5471e32aca96e5442b7696e5464b0b646b87 Mon Sep 17 00:00:00 2001 From: Stardew Date: Tue, 3 Sep 2024 12:46:42 -0400 Subject: [PATCH 06/17] added new fields into example SI --- .../dblpend/lib/Drasil/DblPend/Body.hs | 15 ++++++++++++--- .../glassbr/lib/Drasil/GlassBR/Body.hs | 9 +++++++-- .../lib/Drasil/PDController/Body.hs | 17 +++++++++++++---- .../lib/Drasil/PDController/IntroSection.hs | 6 ++++++ .../projectile/lib/Drasil/Projectile/Body.hs | 15 ++++++++++----- .../drasil-example/swhs/lib/Drasil/SWHS/Body.hs | 8 ++++++-- .../swhsnopcm/lib/Drasil/SWHSNoPCM/Body.hs | 12 ++++++------ 7 files changed, 60 insertions(+), 22 deletions(-) diff --git a/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs b/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs index 31de1f8ef4..f1a31f28ac 100644 --- a/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs +++ b/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs @@ -110,9 +110,9 @@ si = SI { _kind = Doc.srs, _authors = [dong], _purpose = [purp], - _background = [], - _motivation = [], - _scope = [], + _background = [background], + _motivation = [motivation], + _scope = [scope], _quants = symbolsAll, _concepts = [] :: [DefinedQuantityDict], _instModels = iMods, @@ -131,6 +131,15 @@ si = SI { purp :: Sentence purp = foldlSent_ [S "predict the", phrase motion `S.ofA` S "double", phrase pendulum] +motivation :: Sentence +motivation = foldlSent_ [S "To simulate", phraseNP (motion `the_ofThe` pendulum), + S "and exhibit its chaotic characteristics"] + +background :: Sentence +background = foldlSent_ [phraseNP (a_ pendulum), S "consists" `S.of_` phrase mass, + S "attached to the end" `S.ofA` phrase rod `S.andIts` S "moving curve" `S.is` + (S "highly sensitive to initial conditions")] + symbolsAll :: [QuantityDict] symbolsAll = symbols ++ scipyODESymbols ++ osloSymbols ++ apacheODESymbols ++ odeintSymbols ++ map qw [listToArray $ quantvar pendDisAngle, arrayVecDepVar dblPenODEInfo] diff --git a/code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs b/code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs index 9d9a55f0b6..ae43890539 100644 --- a/code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs +++ b/code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs @@ -63,9 +63,9 @@ si = SI { _kind = Doc.srs, _authors = [nikitha, spencerSmith], _purpose = [purp], - _background = [], + _background = [background], _motivation = [], - _scope = [], + _scope = [scope], _quants = symbolsForTable, _concepts = [] :: [DefinedQuantityDict], _instModels = iMods, @@ -129,6 +129,11 @@ purp :: Sentence purp = foldlSent_ [S "predict whether a", phrase glaSlab, S "can withstand a", phrase blast, S "under given", plural condition] +background :: Sentence +background = foldlSent_ [phrase explosion, S "in downtown areas are dangerous from the", + phrase blast +:+ S "itself" `S.and_` S "also potentially from the secondary" + +:+ S "effect of falling glass"] + symbMap :: ChunkDB symbMap = cdb thisSymbols (map nw acronyms ++ map nw thisSymbols ++ map nw con ++ map nw con' ++ map nw terms ++ map nw doccon ++ map nw doccon' ++ map nw educon diff --git a/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs b/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs index 13d62cf545..cadb338bea 100644 --- a/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs +++ b/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs @@ -33,7 +33,7 @@ import Drasil.PDController.GenSysDesc gsduserCharacteristics) import Drasil.PDController.IModel (instanceModels, imPD) import Drasil.PDController.IntroSection (introPara, introPurposeOfDoc, externalLinkRef, - introUserChar1, introUserChar2, introscopeOfReq) + introUserChar1, introUserChar2, introscopeOfReq, scope) import Drasil.PDController.References (citations) import Drasil.PDController.Requirements (funcReqs, nonfuncReqs) import Drasil.PDController.SpSysDesc (goals, sysFigure, sysGoalInput, sysParts) @@ -102,9 +102,9 @@ si = SI { _kind = Doc.srs, _authors = [naveen], _purpose = [purp], - _background = [], - _motivation = [], - _scope = [], + _background = [background], + _motivation = [motivation], + _scope = [scope], _quants = symbolsAll, _concepts = [] :: [DefinedQuantityDict], _datadefs = dataDefinitions, @@ -124,6 +124,15 @@ purp = foldlSent_ [S "provide a model of a", phrase pidC, S "that can be used for the tuning of the gain constants before", S "the deployment of the controller"] +motivation :: Sentence +motivation = foldlSent_ [S "The gains of a controller in an application" +:+ + S "must be tuned before the controller is ready for production"] + +background :: Sentence +background = foldlSent_ [S "Automatic process control with a controller (P/PI/PD/PID) is used", + S "in a variety of applications such as thermostats, automobile", + S "cruise-control, etc"] + symbolsAll :: [QuantityDict] symbolsAll = symbols ++ map qw pidDqdConstants ++ map qw pidConstants ++ scipyODESymbols ++ osloSymbols ++ apacheODESymbols ++ odeintSymbols diff --git a/code/drasil-example/pdcontroller/lib/Drasil/PDController/IntroSection.hs b/code/drasil-example/pdcontroller/lib/Drasil/PDController/IntroSection.hs index 88c70e3543..6d4e03aa2a 100644 --- a/code/drasil-example/pdcontroller/lib/Drasil/PDController/IntroSection.hs +++ b/code/drasil-example/pdcontroller/lib/Drasil/PDController/IntroSection.hs @@ -34,6 +34,12 @@ introscopeOfReq S "Additionally, this software is intended to aid with the manual", S "tuning of the", phrase pidC] +scope :: Sentence +scope = foldlSent_ [phraseNP (a_ pidCL), + S "with three subsystems, namely:" +:+ + foldlList Comma List (map (phraseNP.a_) + [pidC, summingPt, powerPlant])] + introPurposeOfDoc = foldlSent [S "The purpose of this document is to capture all the necessary", diff --git a/code/drasil-example/projectile/lib/Drasil/Projectile/Body.hs b/code/drasil-example/projectile/lib/Drasil/Projectile/Body.hs index f4f136914f..ef3cbdea20 100644 --- a/code/drasil-example/projectile/lib/Drasil/Projectile/Body.hs +++ b/code/drasil-example/projectile/lib/Drasil/Projectile/Body.hs @@ -103,10 +103,6 @@ mkSRS = [TableOfContents, Bibliography ] -motivation :: Sentence -motivation = foldlSent_ [phrase projectile, phrase motion, S "is a common" +:+ - phraseNP (problem `in_` physics)] - justification, scope :: Sentence justification = foldlSent [atStart projectile, phrase motion, S "is a common" +:+. phraseNP (problem `in_` physics), S "Therefore, it is useful to have a", @@ -140,7 +136,7 @@ si = SI { _kind = Doc.srs, _authors = [samCrawford, brooks, spencerSmith], _purpose = [purp], - _background = [], + _background = [background], _motivation = [motivation], _scope = [scope], _quants = symbols, @@ -161,6 +157,15 @@ si = SI { purp :: Sentence purp = foldlSent_ [S "predict whether a launched", phrase projectile, S "hits its", phrase target] +motivation :: Sentence +motivation = foldlSent_ [phrase projectile, phrase motion, S "is a common" +:+ + phraseNP (problem `in_` physics)] + +background :: Sentence +background = foldlSent_ [S "Common examples of", phrase projectile, phrase motion, S "include", + S "ballistics", plural problem, S "(missiles and bullets)" `S.andThe` S "flight of the balls", + S "in various sports (baseball, golf, football, etc.)"] + tMods :: [TheoryModel] tMods = [accelerationTM, velocityTM] diff --git a/code/drasil-example/swhs/lib/Drasil/SWHS/Body.hs b/code/drasil-example/swhs/lib/Drasil/SWHS/Body.hs index 8890bac309..e729f94d4c 100755 --- a/code/drasil-example/swhs/lib/Drasil/SWHS/Body.hs +++ b/code/drasil-example/swhs/lib/Drasil/SWHS/Body.hs @@ -81,8 +81,8 @@ si = SI { _authors = [thulasi, brooks, spencerSmith], _purpose = [purp], _background = [], - _motivation = [], - _scope = [], + _motivation = [motivation], + _scope = [scope], _quants = symbols, _concepts = [] :: [DefinedQuantityDict], _instModels = insModel, @@ -102,6 +102,10 @@ purp :: Sentence purp = foldlSent_ [S "investigate the effect" `S.of_` S "employing", short phsChgMtrl, S "within a", phrase sWHT] +motivation :: Sentence +motivation = foldlSent_ [S "the demand is high for renewable", pluralNP (enerSrc `and_PS` + energy), S "storage technology"] + symbMap :: ChunkDB symbMap = cdb (qw (heatEInPCM ^. output) : symbolsAll) -- heatEInPCM ? (nw heatEInPCM : map nw symbols ++ map nw acronymsFull diff --git a/code/drasil-example/swhsnopcm/lib/Drasil/SWHSNoPCM/Body.hs b/code/drasil-example/swhsnopcm/lib/Drasil/SWHSNoPCM/Body.hs index 97ac4532cf..056793050f 100644 --- a/code/drasil-example/swhsnopcm/lib/Drasil/SWHSNoPCM/Body.hs +++ b/code/drasil-example/swhsnopcm/lib/Drasil/SWHSNoPCM/Body.hs @@ -41,9 +41,9 @@ import Data.Drasil.SI_Units (metre, kilogram, second, centigrade, joule, watt, -- Since NoPCM is a simplified version of SWHS, the file is to be built off -- of the SWHS libraries. If the source for something cannot be found in -- NoPCM, check SWHS. -import Drasil.SWHS.Body (charsOfReader, dataContMid, introStart, externalLinkRef, - physSyst1, physSyst2, sysCntxtDesc, systContRespBullets, - sysCntxtRespIntro, userChars) +import Drasil.SWHS.Body (charsOfReader, dataContMid, motivation, + introStart, externalLinkRef, physSyst1, physSyst2, sysCntxtDesc, + systContRespBullets, sysCntxtRespIntro, userChars) import Drasil.SWHS.Changes (likeChgTCVOD, likeChgTCVOL, likeChgTLH) import Drasil.SWHS.Concepts (acronyms, coil, sWHT, tank, transient, water, con, phsChgMtrl) import Drasil.SWHS.Requirements (nfRequirements) @@ -176,9 +176,9 @@ si = SI { _kind = Doc.srs, _authors = [thulasi], _purpose = [purp], - _background = [], - _motivation = [], - _scope = [], + _background = [introStartNoPCM], + _motivation = [motivation], + _scope = [scope], -- FIXME: Everything after (and including) \\ should be removed when -- #1658 is resolved. Basically, _quants is used here, but -- tau does not appear in the document and thus should not be displayed. From 57e17138a559825c0e3280ebfd33dc900cc421ab Mon Sep 17 00:00:00 2001 From: Stardew Date: Tue, 3 Sep 2024 12:47:24 -0400 Subject: [PATCH 07/17] Remove redundant period. --- code/drasil-example/ssp/lib/Drasil/SSP/Body.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/drasil-example/ssp/lib/Drasil/SSP/Body.hs b/code/drasil-example/ssp/lib/Drasil/SSP/Body.hs index 5ee3fc0315..0baa742010 100644 --- a/code/drasil-example/ssp/lib/Drasil/SSP/Body.hs +++ b/code/drasil-example/ssp/lib/Drasil/SSP/Body.hs @@ -212,7 +212,7 @@ startIntro = foldlSent [atStartNP (a_ slope), S "of geological", S "assessment" `S.ofThe` S "safety of a" +:+ phrase slope `sC` S "identifying the", phrase surface, S "most likely to experience", phrase slip `S.and_` - S "an index of its relative stability known as the" +:+. phrase fs] + S "an index of its relative stability known as the" +:+ phrase fs] kSent = keySent ssa ssp From 0609bdffafa5e10561bc1728d5ddd545edc84c2a Mon Sep 17 00:00:00 2001 From: Stardew Date: Tue, 3 Sep 2024 12:48:22 -0400 Subject: [PATCH 08/17] Updated stable READMEs. --- code/stable/dblpend/src/cpp/README.md | 10 ++++++++++ code/stable/dblpend/src/csharp/README.md | 10 ++++++++++ code/stable/dblpend/src/java/README.md | 10 ++++++++++ code/stable/dblpend/src/python/README.md | 10 ++++++++++ code/stable/glassbr/src/cpp/README.md | 8 ++++++++ code/stable/glassbr/src/csharp/README.md | 8 ++++++++ code/stable/glassbr/src/java/README.md | 8 ++++++++ code/stable/glassbr/src/python/README.md | 8 ++++++++ code/stable/glassbr/src/swift/README.md | 8 ++++++++ code/stable/pdcontroller/src/cpp/README.md | 10 ++++++++++ code/stable/pdcontroller/src/csharp/README.md | 10 ++++++++++ code/stable/pdcontroller/src/java/README.md | 10 ++++++++++ code/stable/pdcontroller/src/python/README.md | 10 ++++++++++ .../projectile_m_l_nol_u_u_v_f/src/cpp/README.md | 6 ++++++ .../projectile_m_l_nol_u_u_v_f/src/csharp/README.md | 6 ++++++ .../projectile_m_l_nol_u_u_v_f/src/java/README.md | 6 ++++++ .../projectile_m_l_nol_u_u_v_f/src/julia/README.md | 6 ++++++ .../projectile_m_l_nol_u_u_v_f/src/python/README.md | 6 ++++++ .../projectile_m_l_nol_u_u_v_f/src/swift/README.md | 6 ++++++ .../projectile_m_p_nol_b_u_v_d/src/cpp/README.md | 6 ++++++ .../projectile_m_p_nol_b_u_v_d/src/csharp/README.md | 6 ++++++ .../projectile_m_p_nol_b_u_v_d/src/java/README.md | 6 ++++++ .../projectile_m_p_nol_b_u_v_d/src/python/README.md | 6 ++++++ .../projectile_m_p_nol_b_u_v_d/src/swift/README.md | 6 ++++++ .../projectile_u_p_l_b_b_c_d/src/cpp/README.md | 6 ++++++ .../projectile_u_p_l_b_b_c_d/src/csharp/README.md | 6 ++++++ .../projectile_u_p_l_b_b_c_d/src/java/README.md | 6 ++++++ .../projectile_u_p_l_b_b_c_d/src/python/README.md | 6 ++++++ .../projectile_u_p_l_b_b_c_d/src/swift/README.md | 6 ++++++ .../projectile_u_p_l_b_wi_v_f/src/cpp/README.md | 6 ++++++ .../projectile_u_p_l_b_wi_v_f/src/csharp/README.md | 6 ++++++ .../projectile_u_p_l_b_wi_v_f/src/java/README.md | 6 ++++++ .../projectile_u_p_l_b_wi_v_f/src/python/README.md | 6 ++++++ .../projectile_u_p_l_b_wi_v_f/src/swift/README.md | 6 ++++++ .../projectile_u_p_nol_u_wi_v_d/src/cpp/README.md | 6 ++++++ .../projectile_u_p_nol_u_wi_v_d/src/csharp/README.md | 6 ++++++ .../projectile_u_p_nol_u_wi_v_d/src/java/README.md | 6 ++++++ .../projectile_u_p_nol_u_wi_v_d/src/julia/README.md | 6 ++++++ .../projectile_u_p_nol_u_wi_v_d/src/python/README.md | 6 ++++++ .../projectile_u_p_nol_u_wi_v_d/src/swift/README.md | 6 ++++++ code/stable/ssp/SRS/HTML/SSP_SRS.html | 2 +- code/stable/ssp/SRS/Jupyter/SSP_SRS.ipynb | 2 +- code/stable/ssp/SRS/PDF/SSP_SRS.tex | 2 +- code/stable/ssp/SRS/mdBook/src/SecIntro.md | 2 +- code/stable/swhsnopcm/src/cpp/README.md | 10 ++++++++++ code/stable/swhsnopcm/src/csharp/README.md | 10 ++++++++++ code/stable/swhsnopcm/src/java/README.md | 10 ++++++++++ code/stable/swhsnopcm/src/python/README.md | 10 ++++++++++ 48 files changed, 326 insertions(+), 4 deletions(-) diff --git a/code/stable/dblpend/src/cpp/README.md b/code/stable/dblpend/src/cpp/README.md index 7813eebbdc..a4f331f0ae 100644 --- a/code/stable/dblpend/src/cpp/README.md +++ b/code/stable/dblpend/src/cpp/README.md @@ -1,8 +1,18 @@ # DblPend > Author: Dong Chen +> Motivation: To simulate the motion of the pendulum and exhibit its chaotic characteristics. + > Purpose: Predict the motion of a double pendulum. +------------------------------------------------------------ +## What + + +> Background: A pendulum consists of mass attached to the end of a rod and its moving curve is highly sensitive to initial conditions. + +> Scope: The analysis of a two-dimensional (2D) pendulum motion problem with various initial conditions. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/dblpend/src/csharp/README.md b/code/stable/dblpend/src/csharp/README.md index 343ab7252d..0e869470d5 100644 --- a/code/stable/dblpend/src/csharp/README.md +++ b/code/stable/dblpend/src/csharp/README.md @@ -1,8 +1,18 @@ # DblPend > Author: Dong Chen +> Motivation: To simulate the motion of the pendulum and exhibit its chaotic characteristics. + > Purpose: Predict the motion of a double pendulum. +------------------------------------------------------------ +## What + + +> Background: A pendulum consists of mass attached to the end of a rod and its moving curve is highly sensitive to initial conditions. + +> Scope: The analysis of a two-dimensional (2D) pendulum motion problem with various initial conditions. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/dblpend/src/java/README.md b/code/stable/dblpend/src/java/README.md index 50266474d5..c4668ce6b3 100644 --- a/code/stable/dblpend/src/java/README.md +++ b/code/stable/dblpend/src/java/README.md @@ -1,8 +1,18 @@ # DblPend > Author: Dong Chen +> Motivation: To simulate the motion of the pendulum and exhibit its chaotic characteristics. + > Purpose: Predict the motion of a double pendulum. +------------------------------------------------------------ +## What + + +> Background: A pendulum consists of mass attached to the end of a rod and its moving curve is highly sensitive to initial conditions. + +> Scope: The analysis of a two-dimensional (2D) pendulum motion problem with various initial conditions. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/dblpend/src/python/README.md b/code/stable/dblpend/src/python/README.md index dc8bbb5d84..69e5451c0d 100644 --- a/code/stable/dblpend/src/python/README.md +++ b/code/stable/dblpend/src/python/README.md @@ -1,8 +1,18 @@ # DblPend > Author: Dong Chen +> Motivation: To simulate the motion of the pendulum and exhibit its chaotic characteristics. + > Purpose: Predict the motion of a double pendulum. +------------------------------------------------------------ +## What + + +> Background: A pendulum consists of mass attached to the end of a rod and its moving curve is highly sensitive to initial conditions. + +> Scope: The analysis of a two-dimensional (2D) pendulum motion problem with various initial conditions. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/glassbr/src/cpp/README.md b/code/stable/glassbr/src/cpp/README.md index c32dbc4ab0..c6a58f2033 100644 --- a/code/stable/glassbr/src/cpp/README.md +++ b/code/stable/glassbr/src/cpp/README.md @@ -3,6 +3,14 @@ > Purpose: Predict whether a glass slab can withstand a blast under given conditions. +------------------------------------------------------------ +## What + + +> Background: Explosion in downtown areas are dangerous from the blast itself and also potentially from the secondary effect of falling glass. + +> Scope: Determining the safety of a glass slab under a blast loading following the ASTM standard (Ref: astm2009). + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/glassbr/src/csharp/README.md b/code/stable/glassbr/src/csharp/README.md index 2a8c15ee2f..ede412f7d0 100644 --- a/code/stable/glassbr/src/csharp/README.md +++ b/code/stable/glassbr/src/csharp/README.md @@ -3,6 +3,14 @@ > Purpose: Predict whether a glass slab can withstand a blast under given conditions. +------------------------------------------------------------ +## What + + +> Background: Explosion in downtown areas are dangerous from the blast itself and also potentially from the secondary effect of falling glass. + +> Scope: Determining the safety of a glass slab under a blast loading following the ASTM standard (Ref: astm2009). + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/glassbr/src/java/README.md b/code/stable/glassbr/src/java/README.md index 152e0ae400..7540ef8259 100644 --- a/code/stable/glassbr/src/java/README.md +++ b/code/stable/glassbr/src/java/README.md @@ -3,6 +3,14 @@ > Purpose: Predict whether a glass slab can withstand a blast under given conditions. +------------------------------------------------------------ +## What + + +> Background: Explosion in downtown areas are dangerous from the blast itself and also potentially from the secondary effect of falling glass. + +> Scope: Determining the safety of a glass slab under a blast loading following the ASTM standard (Ref: astm2009). + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/glassbr/src/python/README.md b/code/stable/glassbr/src/python/README.md index 7c81cfe6d6..08a36507b0 100644 --- a/code/stable/glassbr/src/python/README.md +++ b/code/stable/glassbr/src/python/README.md @@ -3,6 +3,14 @@ > Purpose: Predict whether a glass slab can withstand a blast under given conditions. +------------------------------------------------------------ +## What + + +> Background: Explosion in downtown areas are dangerous from the blast itself and also potentially from the secondary effect of falling glass. + +> Scope: Determining the safety of a glass slab under a blast loading following the ASTM standard (Ref: astm2009). + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/glassbr/src/swift/README.md b/code/stable/glassbr/src/swift/README.md index 23100f5a94..2ab7d33e8f 100644 --- a/code/stable/glassbr/src/swift/README.md +++ b/code/stable/glassbr/src/swift/README.md @@ -3,6 +3,14 @@ > Purpose: Predict whether a glass slab can withstand a blast under given conditions. +------------------------------------------------------------ +## What + + +> Background: Explosion in downtown areas are dangerous from the blast itself and also potentially from the secondary effect of falling glass. + +> Scope: Determining the safety of a glass slab under a blast loading following the ASTM standard (Ref: astm2009). + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/pdcontroller/src/cpp/README.md b/code/stable/pdcontroller/src/cpp/README.md index b0068542d3..54a2b3dcb1 100644 --- a/code/stable/pdcontroller/src/cpp/README.md +++ b/code/stable/pdcontroller/src/cpp/README.md @@ -1,8 +1,18 @@ # PDController > Author: Naveen Ganesh Muralidharan +> Motivation: The gains of a controller in an application must be tuned before the controller is ready for production. + > Purpose: Provide a model of a PD Controller that can be used for the tuning of the gain constants before the deployment of the controller. +------------------------------------------------------------ +## What + + +> Background: Automatic process control with a controller (P/PI/PD/PID) is used in a variety of applications such as thermostats, automobile cruise-control, etc. + +> Scope: A PD Control Loop with three subsystems, namely: a PD Controller, a Summing Point, and a Power Plant. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/pdcontroller/src/csharp/README.md b/code/stable/pdcontroller/src/csharp/README.md index 9efe75c3bd..14cafe7878 100644 --- a/code/stable/pdcontroller/src/csharp/README.md +++ b/code/stable/pdcontroller/src/csharp/README.md @@ -1,8 +1,18 @@ # PDController > Author: Naveen Ganesh Muralidharan +> Motivation: The gains of a controller in an application must be tuned before the controller is ready for production. + > Purpose: Provide a model of a PD Controller that can be used for the tuning of the gain constants before the deployment of the controller. +------------------------------------------------------------ +## What + + +> Background: Automatic process control with a controller (P/PI/PD/PID) is used in a variety of applications such as thermostats, automobile cruise-control, etc. + +> Scope: A PD Control Loop with three subsystems, namely: a PD Controller, a Summing Point, and a Power Plant. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/pdcontroller/src/java/README.md b/code/stable/pdcontroller/src/java/README.md index e407e018af..d1295d1d11 100644 --- a/code/stable/pdcontroller/src/java/README.md +++ b/code/stable/pdcontroller/src/java/README.md @@ -1,8 +1,18 @@ # PDController > Author: Naveen Ganesh Muralidharan +> Motivation: The gains of a controller in an application must be tuned before the controller is ready for production. + > Purpose: Provide a model of a PD Controller that can be used for the tuning of the gain constants before the deployment of the controller. +------------------------------------------------------------ +## What + + +> Background: Automatic process control with a controller (P/PI/PD/PID) is used in a variety of applications such as thermostats, automobile cruise-control, etc. + +> Scope: A PD Control Loop with three subsystems, namely: a PD Controller, a Summing Point, and a Power Plant. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/pdcontroller/src/python/README.md b/code/stable/pdcontroller/src/python/README.md index ab854885c0..de15f723a1 100644 --- a/code/stable/pdcontroller/src/python/README.md +++ b/code/stable/pdcontroller/src/python/README.md @@ -1,8 +1,18 @@ # PDController > Author: Naveen Ganesh Muralidharan +> Motivation: The gains of a controller in an application must be tuned before the controller is ready for production. + > Purpose: Provide a model of a PD Controller that can be used for the tuning of the gain constants before the deployment of the controller. +------------------------------------------------------------ +## What + + +> Background: Automatic process control with a controller (P/PI/PD/PID) is used in a variety of applications such as thermostats, automobile cruise-control, etc. + +> Scope: A PD Control Loop with three subsystems, namely: a PD Controller, a Summing Point, and a Power Plant. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/cpp/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/cpp/README.md index b1301ca6b2..9ee1bfda44 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/cpp/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/cpp/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/csharp/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/csharp/README.md index c8738f2325..f4064c3010 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/csharp/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/csharp/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/java/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/java/README.md index 548d6ab44f..ceab8523cc 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/java/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/java/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/julia/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/julia/README.md index 5a74eca472..8983e51bef 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/julia/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/julia/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/python/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/python/README.md index 573130093e..dc846513f3 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/python/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/python/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/swift/README.md b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/swift/README.md index 10e3ed713d..cae70bd8c2 100644 --- a/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/swift/README.md +++ b/code/stable/projectile/projectile_m_l_nol_u_u_v_f/src/swift/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/cpp/README.md b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/cpp/README.md index 3bf8c537cd..70f30a104d 100644 --- a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/cpp/README.md +++ b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/cpp/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/csharp/README.md b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/csharp/README.md index 40857f8758..c6abf10dc8 100644 --- a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/csharp/README.md +++ b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/csharp/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/java/README.md b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/java/README.md index 2f8f6dce10..5e1ea3e9a5 100644 --- a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/java/README.md +++ b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/java/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/python/README.md b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/python/README.md index cecaacc37a..1bbe53d5a8 100644 --- a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/python/README.md +++ b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/python/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/swift/README.md b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/swift/README.md index 20327d5f3f..0fd857aeca 100644 --- a/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/swift/README.md +++ b/code/stable/projectile/projectile_m_p_nol_b_u_v_d/src/swift/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/cpp/README.md b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/cpp/README.md index 3bf8c537cd..70f30a104d 100644 --- a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/cpp/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/cpp/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/csharp/README.md b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/csharp/README.md index 40857f8758..c6abf10dc8 100644 --- a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/csharp/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/csharp/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/java/README.md b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/java/README.md index 2f8f6dce10..5e1ea3e9a5 100644 --- a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/java/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/java/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/python/README.md b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/python/README.md index cecaacc37a..1bbe53d5a8 100644 --- a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/python/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/python/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/swift/README.md b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/swift/README.md index 20327d5f3f..0fd857aeca 100644 --- a/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/swift/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_b_c_d/src/swift/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/cpp/README.md b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/cpp/README.md index 3bf8c537cd..70f30a104d 100644 --- a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/cpp/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/cpp/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/csharp/README.md b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/csharp/README.md index 40857f8758..c6abf10dc8 100644 --- a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/csharp/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/csharp/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/java/README.md b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/java/README.md index 2f8f6dce10..5e1ea3e9a5 100644 --- a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/java/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/java/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/python/README.md b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/python/README.md index cecaacc37a..1bbe53d5a8 100644 --- a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/python/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/python/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/swift/README.md b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/swift/README.md index 20327d5f3f..0fd857aeca 100644 --- a/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/swift/README.md +++ b/code/stable/projectile/projectile_u_p_l_b_wi_v_f/src/swift/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/cpp/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/cpp/README.md index 3bf8c537cd..70f30a104d 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/cpp/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/cpp/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/csharp/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/csharp/README.md index 40857f8758..c6abf10dc8 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/csharp/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/csharp/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/java/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/java/README.md index 2f8f6dce10..5e1ea3e9a5 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/java/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/java/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/julia/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/julia/README.md index 1b71d27676..838f1c444d 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/julia/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/julia/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/python/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/python/README.md index cecaacc37a..1bbe53d5a8 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/python/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/python/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/swift/README.md b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/swift/README.md index 20327d5f3f..0fd857aeca 100644 --- a/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/swift/README.md +++ b/code/stable/projectile/projectile_u_p_nol_u_wi_v_d/src/swift/README.md @@ -5,6 +5,12 @@ > Purpose: Predict whether a launched projectile hits its target. +------------------------------------------------------------ +## What + + +> Background: Common examples of projectile motion include ballistics problems (missiles and bullets) and the flight of the balls in various sports (baseball, golf, football, etc.). + > Scope: The analysis of a two-dimensional (2D) projectile motion problem with constant acceleration. ------------------------------------------------------------ diff --git a/code/stable/ssp/SRS/HTML/SSP_SRS.html b/code/stable/ssp/SRS/HTML/SSP_SRS.html index cae1d3aa7c..b8c95dbf5d 100644 --- a/code/stable/ssp/SRS/HTML/SSP_SRS.html +++ b/code/stable/ssp/SRS/HTML/SSP_SRS.html @@ -893,7 +893,7 @@

Abbreviations and Acronyms

Introduction

- A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety.. + A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety.

The following section provides an overview of the Software Requirements Specification (SRS) for a slope stability analysis problem. The developed program will be referred to as the Slope Stability analysis Program (SSP) based on the original, manually created version of SSP. This section explains the purpose of this document, the scope of the requirements, the characteristics of the intended reader, and the organization of the document. diff --git a/code/stable/ssp/SRS/Jupyter/SSP_SRS.ipynb b/code/stable/ssp/SRS/Jupyter/SSP_SRS.ipynb index 8f405dcb59..14866574d4 100644 --- a/code/stable/ssp/SRS/Jupyter/SSP_SRS.ipynb +++ b/code/stable/ssp/SRS/Jupyter/SSP_SRS.ipynb @@ -211,7 +211,7 @@ "# Introduction\n", "\n", "\n", - "A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety..\n", + "A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety.\n", "\n", "The following section provides an overview of the Software Requirements Specification (SRS) for a slope stability analysis problem. The developed program will be referred to as the Slope Stability analysis Program (SSP) based on the original, manually created version of SSP. This section explains the purpose of this document, the scope of the requirements, the characteristics of the intended reader, and the organization of the document.\n", "\n", diff --git a/code/stable/ssp/SRS/PDF/SSP_SRS.tex b/code/stable/ssp/SRS/PDF/SSP_SRS.tex index f1ad9b5af6..0d3f043e62 100644 --- a/code/stable/ssp/SRS/PDF/SSP_SRS.tex +++ b/code/stable/ssp/SRS/PDF/SSP_SRS.tex @@ -298,7 +298,7 @@ \subsection{Abbreviations and Acronyms} \end{longtblr} \section{Introduction} \label{Sec:Intro} -A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety.. +A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety. The following section provides an overview of the Software Requirements Specification (SRS) for a slope stability analysis problem. The developed program will be referred to as the Slope Stability analysis Program (SSP) based on the original, manually created version of \hyperref{https://github.com/smiths/caseStudies/blob/master/CaseStudies/ssp}{}{}{SSP}. This section explains the purpose of this document, the scope of the requirements, the characteristics of the intended reader, and the organization of the document. diff --git a/code/stable/ssp/SRS/mdBook/src/SecIntro.md b/code/stable/ssp/SRS/mdBook/src/SecIntro.md index cd92c9b275..cb748773a0 100644 --- a/code/stable/ssp/SRS/mdBook/src/SecIntro.md +++ b/code/stable/ssp/SRS/mdBook/src/SecIntro.md @@ -1,5 +1,5 @@ # Introduction {#Sec:Intro} -A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety.. +A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety. The following section provides an overview of the Software Requirements Specification (SRS) for a slope stability analysis problem. The developed program will be referred to as the Slope Stability analysis Program (SSP) based on the original, manually created version of [SSP](https://github.com/smiths/caseStudies/blob/master/CaseStudies/ssp). This section explains the purpose of this document, the scope of the requirements, the characteristics of the intended reader, and the organization of the document. diff --git a/code/stable/swhsnopcm/src/cpp/README.md b/code/stable/swhsnopcm/src/cpp/README.md index 6e28e467ab..401fcf8d24 100644 --- a/code/stable/swhsnopcm/src/cpp/README.md +++ b/code/stable/swhsnopcm/src/cpp/README.md @@ -1,8 +1,18 @@ # SWHSNoPCM > Author: Thulasi Jegatheesan +> Motivation: The demand is high for renewable energy sources and energy storage technology. + > Purpose: Investigate the heating of water in a solar water heating tank. +------------------------------------------------------------ +## What + + +> Background: Solar Water Heating System with no Phase Change Material provide a novel way of storing energy.. + +> Scope: Thermal analysis of a single solar water heating tank. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/swhsnopcm/src/csharp/README.md b/code/stable/swhsnopcm/src/csharp/README.md index d659cd0b79..e7c2ab2861 100644 --- a/code/stable/swhsnopcm/src/csharp/README.md +++ b/code/stable/swhsnopcm/src/csharp/README.md @@ -1,8 +1,18 @@ # SWHSNoPCM > Author: Thulasi Jegatheesan +> Motivation: The demand is high for renewable energy sources and energy storage technology. + > Purpose: Investigate the heating of water in a solar water heating tank. +------------------------------------------------------------ +## What + + +> Background: Solar Water Heating System with no Phase Change Material provide a novel way of storing energy.. + +> Scope: Thermal analysis of a single solar water heating tank. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/swhsnopcm/src/java/README.md b/code/stable/swhsnopcm/src/java/README.md index 94d1084f4c..dcfe8d5dd5 100644 --- a/code/stable/swhsnopcm/src/java/README.md +++ b/code/stable/swhsnopcm/src/java/README.md @@ -1,8 +1,18 @@ # SWHSNoPCM > Author: Thulasi Jegatheesan +> Motivation: The demand is high for renewable energy sources and energy storage technology. + > Purpose: Investigate the heating of water in a solar water heating tank. +------------------------------------------------------------ +## What + + +> Background: Solar Water Heating System with no Phase Change Material provide a novel way of storing energy.. + +> Scope: Thermal analysis of a single solar water heating tank. + ------------------------------------------------------------ ## Making Examples How to Run the Program: diff --git a/code/stable/swhsnopcm/src/python/README.md b/code/stable/swhsnopcm/src/python/README.md index 9ea764c934..af4ea0ed1b 100644 --- a/code/stable/swhsnopcm/src/python/README.md +++ b/code/stable/swhsnopcm/src/python/README.md @@ -1,8 +1,18 @@ # SWHSNoPCM > Author: Thulasi Jegatheesan +> Motivation: The demand is high for renewable energy sources and energy storage technology. + > Purpose: Investigate the heating of water in a solar water heating tank. +------------------------------------------------------------ +## What + + +> Background: Solar Water Heating System with no Phase Change Material provide a novel way of storing energy.. + +> Scope: Thermal analysis of a single solar water heating tank. + ------------------------------------------------------------ ## Making Examples How to Run the Program: From 3de170f73448a2facc1f38ebb0bddafc83833a14 Mon Sep 17 00:00:00 2001 From: Stardew Date: Tue, 3 Sep 2024 13:35:05 -0400 Subject: [PATCH 09/17] Removed redundant bracket. Resolved GHC warnings by fixing name shadowing issues and removing redundant bracket. Added new fields into sglPend. --- .../Language/Drasil/Code/Imperative/Import.hs | 24 +++++++++---------- .../dblpend/lib/Drasil/DblPend/Body.hs | 2 +- .../sglpend/lib/Drasil/SglPend/Body.hs | 2 ++ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Import.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Import.hs index 175519ed48..da8a191c9a 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Import.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Import.hs @@ -688,14 +688,14 @@ genDataFunc nameTitle desc ddef = do readData :: (OOProg r) => DataDesc -> GenState [MSBlock r] readData ddef = do g <- get - let scope = convScope $ currentScope g - inD <- mapM (`inData` scope) ddef + let localScope = convScope $ currentScope g + inD <- mapM (`inData` localScope) ddef v_filename <- mkVal (quantvar inFileName) return [block $ - varDec var_infile scope : - (if any (\d -> isLine d || isLines d) ddef then [varDec var_line scope, - listDec 0 var_linetokens scope ] else []) ++ - [listDec 0 var_lines scope | any isLines ddef] ++ openFileR var_infile + varDec var_infile localScope : + (if any (\d -> isLine d || isLines d) ddef then [varDec var_line localScope, + listDec 0 var_linetokens localScope ] else []) ++ + [listDec 0 var_lines localScope | any isLines ddef] ++ openFileR var_infile v_filename : concat inD ++ [closeFile v_infile]] where inData :: (OOProg r) => Data -> r (Scope r) -> GenState [MSStatement r] inData (Singleton v) _ = do @@ -926,14 +926,14 @@ genModFuncsProc (Mod _ _ _ _ fs) = map (genFuncProc publicFuncProc []) fs readDataProc :: (SharedProg r) => DataDesc -> GenState [MSBlock r] readDataProc ddef = do g <- get - let scope = convScope $ currentScope g - inD <- mapM (`inData` scope) ddef + let localScope = convScope $ currentScope g + inD <- mapM (`inData` localScope) ddef v_filename <- mkValProc (quantvar inFileName) return [block $ - varDec var_infile scope : - (if any (\d -> isLine d || isLines d) ddef then [varDec var_line scope, - listDec 0 var_linetokens scope] else []) ++ - [listDec 0 var_lines scope | any isLines ddef] ++ openFileR var_infile + varDec var_infile localScope : + (if any (\d -> isLine d || isLines d) ddef then [varDec var_line localScope, + listDec 0 var_linetokens localScope] else []) ++ + [listDec 0 var_lines localScope | any isLines ddef] ++ openFileR var_infile v_filename : concat inD ++ [closeFile v_infile]] where inData :: (SharedProg r) => Data -> r (Scope r) -> GenState [MSStatement r] inData (Singleton v) _ = do diff --git a/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs b/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs index f1a31f28ac..cd2fa43549 100644 --- a/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs +++ b/code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs @@ -138,7 +138,7 @@ motivation = foldlSent_ [S "To simulate", phraseNP (motion `the_ofThe` pendulum) background :: Sentence background = foldlSent_ [phraseNP (a_ pendulum), S "consists" `S.of_` phrase mass, S "attached to the end" `S.ofA` phrase rod `S.andIts` S "moving curve" `S.is` - (S "highly sensitive to initial conditions")] + S "highly sensitive to initial conditions"] symbolsAll :: [QuantityDict] symbolsAll = symbols ++ scipyODESymbols ++ osloSymbols ++ apacheODESymbols ++ odeintSymbols diff --git a/code/drasil-example/sglpend/lib/Drasil/SglPend/Body.hs b/code/drasil-example/sglpend/lib/Drasil/SglPend/Body.hs index 6a94d763bf..383bf0508b 100644 --- a/code/drasil-example/sglpend/lib/Drasil/SglPend/Body.hs +++ b/code/drasil-example/sglpend/lib/Drasil/SglPend/Body.hs @@ -112,6 +112,8 @@ si = SI { _authors = [olu], _purpose = [purp], _background = [], + _scope = [], + _motivation = [], _quants = symbols, _concepts = [] :: [DefinedQuantityDict], _instModels = iMods, From b82cba49289e084742e0841f2e8372435f59ef72 Mon Sep 17 00:00:00 2001 From: Stardew Date: Thu, 5 Sep 2024 16:36:23 -0400 Subject: [PATCH 10/17] Refactor: Move README-specific information out of `ClassInterface`. Remove unneed comments. --- .../Code/Imperative/GOOL/ClassInterface.hs | 42 +--------------- .../GOOL/LanguageRenderer/CSharpRenderer.hs | 4 +- .../GOOL/LanguageRenderer/CppRenderer.hs | 4 +- .../GOOL/LanguageRenderer/JavaRenderer.hs | 4 +- .../GOOL/LanguageRenderer/JuliaRenderer.hs | 4 +- .../LanguageRenderer/LanguagePolymorphic.hs | 6 +-- .../GOOL/LanguageRenderer/PythonRenderer.hs | 5 +- .../GOOL/LanguageRenderer/SwiftRenderer.hs | 5 +- .../Drasil/Code/Imperative/GenerateGOOL.hs | 4 +- .../Drasil/Code/Imperative/Generator.hs | 4 +- .../Drasil/Code/Imperative/ReadMe/Import.hs | 48 +++++++++++++++++++ .../Drasil/Code/Imperative/WriteReadMe.hs | 2 +- code/drasil-code/package.yaml | 1 + 13 files changed, 72 insertions(+), 61 deletions(-) create mode 100644 code/drasil-code/lib/Language/Drasil/Code/Imperative/ReadMe/Import.hs diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/ClassInterface.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/ClassInterface.hs index cbca9c06ed..bbc0a037b3 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/ClassInterface.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/ClassInterface.hs @@ -3,7 +3,6 @@ -- | Defines a package extension for GOOL, with functions for pairing a GOOL -- program with auxiliary, non-source-code files. module Language.Drasil.Code.Imperative.GOOL.ClassInterface ( - ReadMeInfo(..), -- Typeclasses PackageSym(..), AuxiliarySym(..) ) where @@ -11,8 +10,8 @@ module Language.Drasil.Code.Imperative.GOOL.ClassInterface ( import Language.Drasil (Expr) import Database.Drasil (ChunkDB) import Language.Drasil.Code.DataDesc (DataDesc) -import Language.Drasil.Mod (Name, Version) import Language.Drasil.Choices (Comments, ImplementationType, Verbosity) +import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) import Drasil.GOOL (ProgData, GOOLState) @@ -41,42 +40,3 @@ class AuxiliarySym r where auxHelperDoc :: r (AuxHelper r) -> Doc auxFromData :: FilePath -> Doc -> r (Auxiliary r) - --- | Language name. -type LangAbbrev = String --- | Programming language version. -type LangVers = String --- | Case name. -type CaseName = String --- | Purpose of example -type ExamplePurpose = String --- | Description of example -type ExampleDescr = String --- | Motivation of example -type ExampleMotivation = String --- | Scope of exmample -type ExampleScope = String --- | File contributors -type Contributor = String --- | Input File -type InFile = String -- TODO: There may not always be an Input/Output File --- | Output File -type OutFile = String --- | Holds all information needed to create a README file. -data ReadMeInfo = ReadMeInfo { - langName :: LangAbbrev, - langVersion :: LangVers, - invalidOS :: Maybe String, - implementType :: ImplementationType, - extLibNV :: [(Name,Version)], - extLibFP :: [FilePath], - contributors :: [Contributor], - configFP :: [FilePath], - caseName :: CaseName, - examplePurpose :: ExamplePurpose, - exampleDescr :: ExampleDescr, - exampleMotivation :: ExampleMotivation, - exampleScope :: ExampleScope, - folderNum :: Int, - inputOutput :: (InFile, OutFile) -} diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/CSharpRenderer.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/CSharpRenderer.hs index ee9cde69db..52cf06ef59 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/CSharpRenderer.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/CSharpRenderer.hs @@ -7,8 +7,8 @@ module Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.CSharpRenderer ( ) where import Language.Drasil.Choices (ImplementationType(..)) -import Language.Drasil.Code.Imperative.GOOL.ClassInterface (ReadMeInfo(..), - PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.GOOL.ClassInterface (PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) import qualified Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.LanguagePolymorphic as G (doxConfig, readMe, sampleInput, makefile, noRunIfLib, doxDocConfig, diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/CppRenderer.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/CppRenderer.hs index 53e3b7726d..236a387d6d 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/CppRenderer.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/CppRenderer.hs @@ -8,8 +8,8 @@ module Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.CppRenderer ( ) where import Language.Drasil.Choices (ImplementationType(..)) -import Language.Drasil.Code.Imperative.GOOL.ClassInterface (ReadMeInfo(..), - PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.GOOL.ClassInterface (PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) import qualified Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.LanguagePolymorphic as G (doxConfig, readMe, sampleInput, makefile, noRunIfLib, doxDocConfig, diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/JavaRenderer.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/JavaRenderer.hs index dc17038b4b..f59ffc173f 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/JavaRenderer.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/JavaRenderer.hs @@ -7,8 +7,8 @@ module Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.JavaRenderer ( ) where import Language.Drasil.Choices (ImplementationType(..)) -import Language.Drasil.Code.Imperative.GOOL.ClassInterface (ReadMeInfo(..), - PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.GOOL.ClassInterface (PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) import qualified Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.LanguagePolymorphic as G (doxConfig, readMe, sampleInput, makefile, noRunIfLib, doxDocConfig, docIfEnabled) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/JuliaRenderer.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/JuliaRenderer.hs index 2233788e3a..8d544c98ba 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/JuliaRenderer.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/JuliaRenderer.hs @@ -5,8 +5,8 @@ module Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.JuliaRenderer ( JuliaProject(..) ) where -import Language.Drasil.Code.Imperative.GOOL.ClassInterface (ReadMeInfo(..), - PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.GOOL.ClassInterface (PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) import qualified Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.LanguagePolymorphic as G (sampleInput, readMe, makefile, noRunIfLib, docIfEnabled) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/LanguagePolymorphic.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/LanguagePolymorphic.hs index b2215f4edb..9b9519691a 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/LanguagePolymorphic.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/LanguagePolymorphic.hs @@ -21,9 +21,9 @@ import Language.Drasil.Code.Imperative.WriteReadMe (makeReadMe) import Language.Drasil.Code.Imperative.GOOL.LanguageRenderer (doxConfigName, makefileName, sampleInputName, readMeName) -import Language.Drasil.Code.Imperative.GOOL.ClassInterface ( ReadMeInfo(..), - AuxiliarySym(Auxiliary, AuxHelper, auxHelperDoc, auxFromData)) - +import Language.Drasil.Code.Imperative.GOOL.ClassInterface (AuxiliarySym(Auxiliary, AuxHelper, auxHelperDoc, auxFromData)) +import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) + -- | Defines a Doxygen configuration file. doxConfig :: (AuxiliarySym r) => r (AuxHelper r) -> String -> GOOLState -> Verbosity -> r (Auxiliary r) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/PythonRenderer.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/PythonRenderer.hs index 4ae63eac0c..b5fd26f845 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/PythonRenderer.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/PythonRenderer.hs @@ -5,8 +5,9 @@ module Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.PythonRenderer ( PythonProject(..) ) where -import Language.Drasil.Code.Imperative.GOOL.ClassInterface (ReadMeInfo(..),PackageSym(..), - AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.GOOL.ClassInterface (PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) + import qualified Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.LanguagePolymorphic as G (doxConfig, readMe, sampleInput, makefile, noRunIfLib, doxDocConfig, diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/SwiftRenderer.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/SwiftRenderer.hs index 5e2731f7ea..61663a970f 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/SwiftRenderer.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GOOL/LanguageRenderer/SwiftRenderer.hs @@ -6,8 +6,9 @@ module Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.SwiftRenderer ( ) where import Language.Drasil.Choices (ImplementationType(..)) -import Language.Drasil.Code.Imperative.GOOL.ClassInterface (ReadMeInfo(..), - PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.GOOL.ClassInterface (PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) + import qualified Language.Drasil.Code.Imperative.GOOL.LanguageRenderer.LanguagePolymorphic as G (sampleInput, readMe, makefile, noRunIfLib, docIfEnabled) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GenerateGOOL.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GenerateGOOL.hs index ffbd92e786..c9a11b91a6 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GenerateGOOL.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GenerateGOOL.hs @@ -6,8 +6,8 @@ module Language.Drasil.Code.Imperative.GenerateGOOL (ClassType(..), import Language.Drasil hiding (List) import Language.Drasil.Code.Imperative.DrasilState (GenState, DrasilState(..)) -import Language.Drasil.Code.Imperative.GOOL.ClassInterface (ReadMeInfo(..), - AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.GOOL.ClassInterface (AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) import Language.Drasil.Choices (Comments(..), AuxFile(..)) import Language.Drasil.CodeSpec (CodeSpec(..)) import Language.Drasil.Mod (Name, Description, Import) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs index 0e1a34e901..e88ca8ba6e 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs @@ -22,8 +22,8 @@ import Language.Drasil.Code.Imperative.Modules (genInputMod, genInputModProc, genOutputModProc, genSampleInput) import Language.Drasil.Code.Imperative.DrasilState (GenState, DrasilState(..), ScopeType(..), designLog, modExportMap, clsDefMap, genICName) -import Language.Drasil.Code.Imperative.GOOL.ClassInterface (ReadMeInfo(..), - PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.GOOL.ClassInterface (PackageSym(..), AuxiliarySym(..)) +import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) import Language.Drasil.Code.Imperative.GOOL.Data (PackData(..), ad) import Language.Drasil.Code.Imperative.GOOL.LanguageRenderer(sampleInputName) import Language.Drasil.Code.CodeGeneration (createCodeFiles, makeCode) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/ReadMe/Import.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/ReadMe/Import.hs new file mode 100644 index 0000000000..c2a6e433ec --- /dev/null +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/ReadMe/Import.hs @@ -0,0 +1,48 @@ +-- | This module defines structures and functions for handling README files, +-- which are used as auxiliary documentation files for the system. +module Language.Drasil.Code.Imperative.ReadMe.Import ( + ReadMeInfo(..), +) where + +import Language.Drasil.Mod (Name, Version) +import Language.Drasil.Choices (ImplementationType) + +-- | Language name. +type LangAbbrev = String +-- | Programming language version. +type LangVers = String +-- | Case name. +type CaseName = String +-- | Purpose of example +type ExamplePurpose = String +-- | Description of example +type ExampleDescr = String +-- | Motivation of example +type ExampleMotivation = String +-- | Scope of example +type ExampleScope = String +-- | File contributors +type Contributor = String +-- | Input File +type InFile = String +-- | Output File +type OutFile = String + +-- | Holds all information needed to create a README file. +data ReadMeInfo = ReadMeInfo { + langName :: LangAbbrev, + langVersion :: LangVers, + invalidOS :: Maybe String, + implementType :: ImplementationType, + extLibNV :: [(Name, Version)], + extLibFP :: [FilePath], + contributors :: [Contributor], + configFP :: [FilePath], + caseName :: CaseName, + examplePurpose :: ExamplePurpose, + exampleDescr :: ExampleDescr, + exampleMotivation :: ExampleMotivation, + exampleScope :: ExampleScope, + folderNum :: Int, + inputOutput :: (InFile, OutFile) +} \ No newline at end of file diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs index 0142af1c51..7482df9b17 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/WriteReadMe.hs @@ -5,7 +5,7 @@ module Language.Drasil.Code.Imperative.WriteReadMe ( import Language.Drasil.Choices (ImplementationType(..)) import Language.Drasil.Printers (makeMd, introInfo, verInfo, unsupOS, extLibSec, instDoc, endNote, whatInfo) -import Language.Drasil.Code.Imperative.GOOL.ClassInterface (ReadMeInfo(..)) +import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) import Prelude hiding ((<>)) import Text.PrettyPrint.HughesPJ (Doc, empty) diff --git a/code/drasil-code/package.yaml b/code/drasil-code/package.yaml index 23a17a4391..2e60b83883 100644 --- a/code/drasil-code/package.yaml +++ b/code/drasil-code/package.yaml @@ -52,6 +52,7 @@ library: - Language.Drasil.Code.ExternalLibraryCall - Language.Drasil.Code.ExtLibImport - Language.Drasil.Code.Lang + - Language.Drasil.Code.Imperative.ReadMe.Import - Language.Drasil.Code.Imperative.Build.AST - Language.Drasil.Code.Imperative.Build.Import - Language.Drasil.Code.Imperative.ConceptMatch From 8b0141ed3824e5052911d7c9a14305f141c3be0f Mon Sep 17 00:00:00 2001 From: Stardew Date: Tue, 10 Sep 2024 17:48:55 -0400 Subject: [PATCH 11/17] remove fields. --- .../Drasil/Code/Imperative/Generator.hs | 6 +- .../lib/Language/Drasil/CodeSpec.hs | 87 +++++++++---------- 2 files changed, 44 insertions(+), 49 deletions(-) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs index e88ca8ba6e..4b0681fd96 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs @@ -146,8 +146,10 @@ genPackage unRepr = do as = case codeSpec g of CodeSpec {authors = a} -> map name a cfp = configFiles $ codeSpec g db = sysinfodb $ codeSpec g - prps = show $ sentenceDoc db Implementation OneLine - (foldlSent $ purpose $ codeSpec g) + -- prps = show $ sentenceDoc db Implementation OneLine + -- (foldlSent $ purpose $ codeSpec g) + prps = show $ sentenceDoc db Implementation OneLine + (foldlSent $ sysInfo ^. purpose) bckgrnd = show $ sentenceDoc db Implementation OneLine (foldlSent $ background $ codeSpec g) mtvtn = show $ sentenceDoc db Implementation OneLine diff --git a/code/drasil-code/lib/Language/Drasil/CodeSpec.hs b/code/drasil-code/lib/Language/Drasil/CodeSpec.hs index dd73ab4941..8a5a608995 100644 --- a/code/drasil-code/lib/Language/Drasil/CodeSpec.hs +++ b/code/drasil-code/lib/Language/Drasil/CodeSpec.hs @@ -6,6 +6,8 @@ import Language.Drasil hiding (None, new) import Language.Drasil.Display (Symbol(Variable)) import Database.Drasil import SysInfo.Drasil hiding (sysinfodb) +import SysInfo.Drasil (SystemInformation, _purpose) + import Theory.Drasil (DataDefinition, qdEFromDD, getEqModQdsFromIm) import Language.Drasil.Chunk.ConstraintMap (ConstraintCEMap, ConstraintCE, constraintMap) @@ -16,6 +18,7 @@ import Language.Drasil.CodeExpr.Development (expr, eNamesRI, eDep) import Language.Drasil.Chunk.CodeBase import Language.Drasil.Mod (Func(..), FuncData(..), FuncDef(..), Mod(..), Name) +--import SysInfo.Drasil import Utils.Drasil (subsetOf) import Control.Lens ((^.)) @@ -43,14 +46,6 @@ data CodeSpec where pName :: Name, -- | Authors. authors :: [a], - -- | Purpose. - purpose :: Purpose, - -- | Example Background. - background :: Background, - -- | Example Scope. - scope :: Scope, - -- | Example Motivation. - motivation :: Motivation, -- | All inputs. inputs :: [Input], -- | Explicit inputs (values to be supplied by a file). @@ -74,7 +69,9 @@ data CodeSpec where -- automatically define. mods :: [Mod], -- medium hack -- | The database of all chunks used in the problem. - sysinfodb :: ChunkDB + sysinfodb :: ChunkDB, + -- | Reference to the system information. + sysInfo :: SystemInformation } -> CodeSpec -- | Maps constants to their respective 'CodeDefinition'. @@ -98,51 +95,47 @@ mapODE (Just ode) = map odeDef $ odeInfo ode -- | Defines a 'CodeSpec' based on the 'SystemInformation', 'Choices', and 'Mod's -- defined by the user. codeSpec :: SystemInformation -> Choices -> [Mod] -> CodeSpec -codeSpec SI {_sys = sys - , _authors = as - , _purpose = ps - , _background = bk - , _scope = scp - , _motivation = mtvtn - , _instModels = ims - , _datadefs = ddefs - , _configFiles = cfp - , _inputs = ins - , _outputs = outs - , _constraints = cs - , _constants = cnsts - , _sysinfodb = db} chs ms = - let n = programName sys +codeSpec sysInfo chs ms = + let SI {_sys = sys + , _authors = as + , _purpose = ps + , _background = bk + , _scope = scp + , _motivation = mtvtn + , _instModels = ims + , _datadefs = ddefs + , _configFiles = cfp + , _inputs = ins + , _outputs = outs + , _constraints = cs + , _constants = cnsts + , _sysinfodb = db} = sysInfo + n = programName sys inputs' = map quantvar ins - const' = map qtov (filter ((`Map.notMember` conceptMatch (maps chs)) . (^. uid)) - cnsts) + const' = map qtov (filter ((`Map.notMember` conceptMatch (maps chs)) . (^. uid)) cnsts) derived = map qtov $ getDerivedInputs ddefs inputs' const' db rels = (map qtoc (getEqModQdsFromIm ims ++ mapMaybe qdEFromDD ddefs) \\ derived) ++ mapODE (getODE $ extLibs chs) - -- TODO: When we have better DEModels, we should be deriving our ODE information - -- directly from the instance models (ims) instead of directly from the choices. outs' = map quantvar outs allInputs = nub $ inputs' ++ map quantvar derived exOrder = getExecOrder rels (allInputs ++ map quantvar cnsts) outs' db - in CodeSpec { - pName = n, - authors = as, - purpose = ps, - background = bk, - scope = scp, - motivation = mtvtn, - inputs = allInputs, - extInputs = inputs', - derivedInputs = derived, - outputs = outs', - configFiles = cfp, - execOrder = exOrder, - cMap = constraintMap cs, - constants = const', - constMap = assocToMap const', - mods = ms, - sysinfodb = db - } + in CodeSpec { + pName = n, + authors = as, + inputs = allInputs, + extInputs = inputs', + derivedInputs = derived, + outputs = outs', + configFiles = cfp, + execOrder = exOrder, + cMap = constraintMap cs, + constants = const', + constMap = assocToMap const', + mods = ms, + sysinfodb = db, + sysInfo = sysInfo -- Reference to SystemInformation + } + -- medium hacks --- From f8031352984ebede88c8ffc4a84a498a1c8a7bc4 Mon Sep 17 00:00:00 2001 From: Stardew Date: Wed, 11 Sep 2024 07:53:23 -0400 Subject: [PATCH 12/17] Refactored `CodeSpec` to reference `SystemInformation`. - Used the generated `sysInfo` lens to access nested fields in `SystemInformation` from `CodeSpec`. --- .../lib/Language/Drasil/CodeSpec.hs | 76 ++++++++++--------- code/drasil-sysinfo/lib/SysInfo/Drasil.hs | 2 + 2 files changed, 41 insertions(+), 37 deletions(-) diff --git a/code/drasil-code/lib/Language/Drasil/CodeSpec.hs b/code/drasil-code/lib/Language/Drasil/CodeSpec.hs index 8a5a608995..16dc54b376 100644 --- a/code/drasil-code/lib/Language/Drasil/CodeSpec.hs +++ b/code/drasil-code/lib/Language/Drasil/CodeSpec.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE GADTs #-} +{-# LANGUAGE GADTs, TemplateHaskell #-} -- | Defines the CodeSpec structure and related functions. module Language.Drasil.CodeSpec where @@ -6,7 +6,6 @@ import Language.Drasil hiding (None, new) import Language.Drasil.Display (Symbol(Variable)) import Database.Drasil import SysInfo.Drasil hiding (sysinfodb) -import SysInfo.Drasil (SystemInformation, _purpose) import Theory.Drasil (DataDefinition, qdEFromDD, getEqModQdsFromIm) @@ -18,10 +17,9 @@ import Language.Drasil.CodeExpr.Development (expr, eNamesRI, eDep) import Language.Drasil.Chunk.CodeBase import Language.Drasil.Mod (Func(..), FuncData(..), FuncDef(..), Mod(..), Name) ---import SysInfo.Drasil import Utils.Drasil (subsetOf) -import Control.Lens ((^.)) +import Control.Lens ((^.), makeLenses) import Data.List (intercalate, nub, (\\)) import qualified Data.Map as Map import Data.Maybe (mapMaybe) @@ -71,7 +69,7 @@ data CodeSpec where -- | The database of all chunks used in the problem. sysinfodb :: ChunkDB, -- | Reference to the system information. - sysInfo :: SystemInformation + _sysInfo :: SystemInformation } -> CodeSpec -- | Maps constants to their respective 'CodeDefinition'. @@ -95,46 +93,48 @@ mapODE (Just ode) = map odeDef $ odeInfo ode -- | Defines a 'CodeSpec' based on the 'SystemInformation', 'Choices', and 'Mod's -- defined by the user. codeSpec :: SystemInformation -> Choices -> [Mod] -> CodeSpec -codeSpec sysInfo chs ms = - let SI {_sys = sys - , _authors = as - , _purpose = ps - , _background = bk - , _scope = scp - , _motivation = mtvtn - , _instModels = ims - , _datadefs = ddefs - , _configFiles = cfp - , _inputs = ins - , _outputs = outs - , _constraints = cs - , _constants = cnsts - , _sysinfodb = db} = sysInfo - n = programName sys +codeSpec si@SI{ _sys = sys + , _authors = as + , _purpose = ps + , _background = bk + , _scope = scp + , _motivation = mtvtn + , _instModels = ims + , _datadefs = ddefs + , _configFiles = cfp + , _inputs = ins + , _outputs = outs + , _constraints = cs + , _constants = cnsts + , _sysinfodb = db} chs ms = + let n = programName sys inputs' = map quantvar ins - const' = map qtov (filter ((`Map.notMember` conceptMatch (maps chs)) . (^. uid)) cnsts) + const' = map qtov (filter ((`Map.notMember` conceptMatch (maps chs)) . (^. uid)) + cnsts) derived = map qtov $ getDerivedInputs ddefs inputs' const' db rels = (map qtoc (getEqModQdsFromIm ims ++ mapMaybe qdEFromDD ddefs) \\ derived) ++ mapODE (getODE $ extLibs chs) + -- TODO: When we have better DEModels, we should be deriving our ODE information + -- directly from the instance models (ims) instead of directly from the choices. outs' = map quantvar outs allInputs = nub $ inputs' ++ map quantvar derived exOrder = getExecOrder rels (allInputs ++ map quantvar cnsts) outs' db in CodeSpec { - pName = n, - authors = as, - inputs = allInputs, - extInputs = inputs', - derivedInputs = derived, - outputs = outs', - configFiles = cfp, - execOrder = exOrder, - cMap = constraintMap cs, - constants = const', - constMap = assocToMap const', - mods = ms, - sysinfodb = db, - sysInfo = sysInfo -- Reference to SystemInformation - } + pName = n, + authors = as, + inputs = allInputs, + extInputs = inputs', + derivedInputs = derived, + outputs = outs', + configFiles = cfp, + execOrder = exOrder, + cMap = constraintMap cs, + constants = const', + constMap = assocToMap const', + mods = ms, + sysinfodb = db, + _sysInfo = si + } -- medium hacks --- @@ -195,3 +195,5 @@ constraintvars (Range _ ri) m = map (codeChunk . varResolve m) $ nub $ eNamesRI ri constraintvars (Elem _ ri) m = map (codeChunk . varResolve m) $ eDep ri + +makeLenses ''CodeSpec \ No newline at end of file diff --git a/code/drasil-sysinfo/lib/SysInfo/Drasil.hs b/code/drasil-sysinfo/lib/SysInfo/Drasil.hs index 84b12639d8..69c7ea0b1f 100644 --- a/code/drasil-sysinfo/lib/SysInfo/Drasil.hs +++ b/code/drasil-sysinfo/lib/SysInfo/Drasil.hs @@ -1,6 +1,8 @@ module SysInfo.Drasil ( -- * System Information SystemInformation(..), Block(Parallel), sysinfodb + -- * Lenses + , purpose, background, scope, motivation -- * Reference Database , ReferenceDB, RefMap, Purpose, Background, Scope, Motivation , citeDB, rdb, simpleMap, citationDB, conceptDB From 085e146611e4c85306f6951012085a19bea9180e Mon Sep 17 00:00:00 2001 From: Stardew Date: Wed, 11 Sep 2024 07:56:32 -0400 Subject: [PATCH 13/17] Replaced direct field access with `sysInfo` lens in `CodeSpec`. Fix warnings. --- .../Drasil/Code/Imperative/Descriptions.hs | 5 ++-- .../Drasil/Code/Imperative/Generator.hs | 23 ++++++++++--------- .../lib/Language/Drasil/CodeSpec.hs | 4 ---- .../DocumentLanguage/TraceabilityGraph.hs | 2 +- .../DocumentLanguage/TraceabilityMatrix.hs | 2 +- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Descriptions.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Descriptions.hs index 2f7ce38a2d..4ae700108b 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Descriptions.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Descriptions.hs @@ -15,7 +15,7 @@ import Language.Drasil.Code.Imperative.DrasilState (GenState, DrasilState(..), genICName) import Language.Drasil.Choices (ImplementationType(..), Structure(..), InternalConcept(..)) -import Language.Drasil.CodeSpec (CodeSpec(..)) +import Language.Drasil.CodeSpec (CodeSpec(..), sysInfo) import Language.Drasil.Mod (Description) import Language.Drasil.Printers (SingleLine(OneLine), sentenceDoc) @@ -24,6 +24,7 @@ import qualified Data.Map as Map (filter, lookup, null) import Data.Maybe (mapMaybe) import Control.Lens ((^.)) import Control.Monad.State (get) +import SysInfo.Drasil hiding (sysinfodb) -- | Returns a module description based on a list of descriptions of what is -- contained in the module. @@ -40,7 +41,7 @@ unmodularDesc = do implTypeStr Program = "program" implTypeStr Library = "library" return $ show $ sentenceDoc (sysinfodb spec) Implementation OneLine $ capSent $ - foldlSent ([S "a", S (implTypeStr (implType g)), S "to"] ++ purpose spec) + foldlSent ([S "a", S (implTypeStr (implType g)), S "to"] ++ codeSpec g ^. sysInfo .purpose) -- | Returns description of what is contained in the Input Parameters module. -- If user chooses the 'Bundled' input parameter, this module will include the structure for holding the diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs index 4b0681fd96..4ce331bafb 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs @@ -32,7 +32,7 @@ import Language.Drasil.Code.Lang (Lang(..)) import Language.Drasil.Choices (Choices(..), Modularity(..), Architecture(..), Visibility(..), DataInfo(..), Constraints(..), choicesSent, DocConfig(..), LogConfig(..), OptionalFeatures(..), InternalConcept(..)) -import Language.Drasil.CodeSpec (CodeSpec(..), getODE) +import Language.Drasil.CodeSpec (CodeSpec(..), getODE, sysInfo) import Language.Drasil.Printers (SingleLine(OneLine), sentenceDoc) import Drasil.GOOL (OOProg, VisibilityTag(..), @@ -40,6 +40,7 @@ import Drasil.GOOL (OOProg, VisibilityTag(..), import qualified Drasil.GOOL as OO (GSProgram, SFile, ProgramSym(..), unCI) import Drasil.GProc (ProcProg) import qualified Drasil.GProc as Proc (GSProgram, SFile, ProgramSym(..), unCI) +import SysInfo.Drasil hiding (sysinfodb) import System.Directory (setCurrentDirectory, createDirectoryIfMissing, getCurrentDirectory) @@ -149,13 +150,13 @@ genPackage unRepr = do -- prps = show $ sentenceDoc db Implementation OneLine -- (foldlSent $ purpose $ codeSpec g) prps = show $ sentenceDoc db Implementation OneLine - (foldlSent $ sysInfo ^. purpose) + (foldlSent $ codeSpec g ^. sysInfo .purpose) bckgrnd = show $ sentenceDoc db Implementation OneLine - (foldlSent $ background $ codeSpec g) + (foldlSent $ codeSpec g ^. sysInfo . background) mtvtn = show $ sentenceDoc db Implementation OneLine - (foldlSent $ motivation $ codeSpec g) + (foldlSent $ codeSpec g ^. sysInfo . motivation) scp = show $ sentenceDoc db Implementation OneLine - (foldlSent $ scope $ codeSpec g) + (foldlSent $ codeSpec g ^. sysInfo . scope) i <- genSampleInput d <- genDoxConfig s rm <- genReadMe ReadMeInfo { @@ -182,7 +183,7 @@ genProgram = do g <- get ms <- chooseModules $ modular g let n = pName $ codeSpec g - let p = show $ sentenceDoc (sysinfodb $ codeSpec g) Implementation OneLine $ foldlSent $ purpose $ codeSpec g + let p = show $ sentenceDoc (sysinfodb $ codeSpec g) Implementation OneLine $ foldlSent $ codeSpec g ^. sysInfo .purpose return $ OO.prog n p ms -- | Generates either a single module or many modules, based on the users choice @@ -261,13 +262,13 @@ genPackageProc unRepr = do cfp = configFiles $ codeSpec g db = sysinfodb $ codeSpec g prps = show $ sentenceDoc db Implementation OneLine - (foldlSent $ purpose $ codeSpec g) + (foldlSent $ codeSpec g ^. sysInfo .purpose) bckgrnd = show $ sentenceDoc db Implementation OneLine - (foldlSent $ background $ codeSpec g) + (foldlSent $ codeSpec g ^. sysInfo . background) mtvtn = show $ sentenceDoc db Implementation OneLine - (foldlSent $ motivation $ codeSpec g) + (foldlSent $ codeSpec g ^. sysInfo . motivation) scp = show $ sentenceDoc db Implementation OneLine - (foldlSent $ scope $ codeSpec g) + (foldlSent $ codeSpec g ^. sysInfo . scope) i <- genSampleInput d <- genDoxConfig s rm <- genReadMe ReadMeInfo { @@ -294,7 +295,7 @@ genProgramProc = do g <- get ms <- chooseModulesProc $ modular g let n = pName $ codeSpec g - let p = show $ sentenceDoc (sysinfodb $ codeSpec g) Implementation OneLine $ foldlSent $ purpose $ codeSpec g + let p = show $ sentenceDoc (sysinfodb $ codeSpec g) Implementation OneLine $ foldlSent $ codeSpec g ^. sysInfo .purpose return $ Proc.prog n p ms -- | Generates either a single module or many modules, based on the users choice diff --git a/code/drasil-code/lib/Language/Drasil/CodeSpec.hs b/code/drasil-code/lib/Language/Drasil/CodeSpec.hs index 16dc54b376..2022d17b96 100644 --- a/code/drasil-code/lib/Language/Drasil/CodeSpec.hs +++ b/code/drasil-code/lib/Language/Drasil/CodeSpec.hs @@ -95,10 +95,6 @@ mapODE (Just ode) = map odeDef $ odeInfo ode codeSpec :: SystemInformation -> Choices -> [Mod] -> CodeSpec codeSpec si@SI{ _sys = sys , _authors = as - , _purpose = ps - , _background = bk - , _scope = scp - , _motivation = mtvtn , _instModels = ims , _datadefs = ddefs , _configFiles = cfp diff --git a/code/drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs b/code/drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs index 38ae6659fa..631af4344f 100644 --- a/code/drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs +++ b/code/drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs @@ -4,7 +4,7 @@ module Drasil.DocumentLanguage.TraceabilityGraph where import Language.Drasil import Database.Drasil hiding (cdb) -import SysInfo.Drasil +import SysInfo.Drasil hiding (purpose) import Control.Lens ((^.)) import qualified Data.Map as Map import Drasil.DocumentLanguage.TraceabilityMatrix (TraceViewCat, traceMReferees, traceMReferrers, diff --git a/code/drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityMatrix.hs b/code/drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityMatrix.hs index ddb2b24aa6..a50cca8efc 100644 --- a/code/drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityMatrix.hs +++ b/code/drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityMatrix.hs @@ -4,7 +4,7 @@ module Drasil.DocumentLanguage.TraceabilityMatrix where import Language.Drasil import Database.Drasil hiding (cdb) -import SysInfo.Drasil +import SysInfo.Drasil hiding (purpose) import qualified Language.Drasil.Sentence.Combinators as S import Data.Drasil.Concepts.Documentation (purpose, component, dependency, From b9488c2bf00a6939f07bc62907d594951d14a009 Mon Sep 17 00:00:00 2001 From: Stardew Date: Mon, 23 Sep 2024 16:58:37 -0400 Subject: [PATCH 14/17] stabilized --- code/stable/ssp/SRS/HTML/SSP_SRS.html | 2 +- code/stable/ssp/SRS/Jupyter/SSP_SRS.ipynb | 2 +- code/stable/ssp/SRS/PDF/SSP_SRS.tex | 2 +- code/stable/ssp/SRS/mdBook/src/SecIntro.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/stable/ssp/SRS/HTML/SSP_SRS.html b/code/stable/ssp/SRS/HTML/SSP_SRS.html index 422395865e..3c84ead516 100644 --- a/code/stable/ssp/SRS/HTML/SSP_SRS.html +++ b/code/stable/ssp/SRS/HTML/SSP_SRS.html @@ -893,7 +893,7 @@

Abbreviations and Acronyms

Introduction

- A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety. + A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety..

The following section provides an overview of the Software Requirements Specification (SRS) for a slope stability analysis problem. The developed program will be referred to as the Slope Stability analysis Program (SSP) based on the original, manually created version of SSP. This section explains the purpose of this document, the scope of the requirements, the characteristics of the intended reader, and the organization of the document. diff --git a/code/stable/ssp/SRS/Jupyter/SSP_SRS.ipynb b/code/stable/ssp/SRS/Jupyter/SSP_SRS.ipynb index 54160fedb7..9db4666436 100644 --- a/code/stable/ssp/SRS/Jupyter/SSP_SRS.ipynb +++ b/code/stable/ssp/SRS/Jupyter/SSP_SRS.ipynb @@ -211,7 +211,7 @@ "# Introduction\n", "\n", "\n", - "A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety.\n", + "A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety..\n", "\n", "The following section provides an overview of the Software Requirements Specification (SRS) for a slope stability analysis problem. The developed program will be referred to as the Slope Stability analysis Program (SSP) based on the original, manually created version of SSP. This section explains the purpose of this document, the scope of the requirements, the characteristics of the intended reader, and the organization of the document.\n", "\n", diff --git a/code/stable/ssp/SRS/PDF/SSP_SRS.tex b/code/stable/ssp/SRS/PDF/SSP_SRS.tex index 758fbabf25..470b51919a 100644 --- a/code/stable/ssp/SRS/PDF/SSP_SRS.tex +++ b/code/stable/ssp/SRS/PDF/SSP_SRS.tex @@ -298,7 +298,7 @@ \subsection{Abbreviations and Acronyms} \end{longtblr} \section{Introduction} \label{Sec:Intro} -A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety. +A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety.. The following section provides an overview of the Software Requirements Specification (SRS) for a slope stability analysis problem. The developed program will be referred to as the Slope Stability analysis Program (SSP) based on the original, manually created version of \hyperref{https://github.com/smiths/caseStudies/blob/master/CaseStudies/ssp}{}{}{SSP}. This section explains the purpose of this document, the scope of the requirements, the characteristics of the intended reader, and the organization of the document. diff --git a/code/stable/ssp/SRS/mdBook/src/SecIntro.md b/code/stable/ssp/SRS/mdBook/src/SecIntro.md index cb748773a0..cd92c9b275 100644 --- a/code/stable/ssp/SRS/mdBook/src/SecIntro.md +++ b/code/stable/ssp/SRS/mdBook/src/SecIntro.md @@ -1,5 +1,5 @@ # Introduction {#Sec:Intro} -A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety. +A slope of geological mass, composed of soil and rock and sometimes water, is subject to the influence of gravity on the mass. This can cause instability in the form of soil or rock movement. The effects of soil or rock movement can range from inconvenient to seriously hazardous, resulting in significant life and economic losses. Slope stability is of interest both when analysing natural slopes, and when designing an excavated slope. Slope stability analysis is the assessment of the safety of a slope, identifying the surface most likely to experience slip and an index of its relative stability known as the factor of safety.. The following section provides an overview of the Software Requirements Specification (SRS) for a slope stability analysis problem. The developed program will be referred to as the Slope Stability analysis Program (SSP) based on the original, manually created version of [SSP](https://github.com/smiths/caseStudies/blob/master/CaseStudies/ssp). This section explains the purpose of this document, the scope of the requirements, the characteristics of the intended reader, and the organization of the document. From f1a633bd5dc34649c4f7f2b9b6e44217510cc176 Mon Sep 17 00:00:00 2001 From: Stardew Date: Fri, 27 Sep 2024 16:32:03 -0400 Subject: [PATCH 15/17] Refactored `CodeSpec` structure by separating `OldCodeSpec`. - Extracted parts of the original `CodeSpec` into a new` OldCodeSpec` data type. - Used `makeClassyFor` to create accessor functions such as `pNameO`, `authorsO`, `inputsO`, etc., which are now used to access corresponding fields in `OldCodeSpec`. - Generated the `oldCodeSpec` lens, which allows easy access and modification of `OldCodeSpec` fields from a `CodeSpec` instance. - Updated `CodeSpec` to hold both `SystemInformation` and a reference to `OldCodeSpec`. - Modified related functions (e.g., `codeSpec`, `oldcodeSpec`) . --- .../lib/Language/Drasil/CodeSpec.hs | 190 +++++++++++++----- 1 file changed, 136 insertions(+), 54 deletions(-) diff --git a/code/drasil-code/lib/Language/Drasil/CodeSpec.hs b/code/drasil-code/lib/Language/Drasil/CodeSpec.hs index 2022d17b96..8e612a5dfd 100644 --- a/code/drasil-code/lib/Language/Drasil/CodeSpec.hs +++ b/code/drasil-code/lib/Language/Drasil/CodeSpec.hs @@ -1,11 +1,13 @@ {-# LANGUAGE GADTs, TemplateHaskell #-} +{-# LANGUAGE InstanceSigs #-} -- | Defines the CodeSpec structure and related functions. module Language.Drasil.CodeSpec where import Language.Drasil hiding (None, new) import Language.Drasil.Display (Symbol(Variable)) import Database.Drasil -import SysInfo.Drasil hiding (sysinfodb) +import qualified SysInfo.Drasil as SI +import SysInfo.Drasil (HasSystemInformation(..)) import Theory.Drasil (DataDefinition, qdEFromDD, getEqModQdsFromIm) @@ -19,7 +21,7 @@ import Language.Drasil.Mod (Func(..), FuncData(..), FuncDef(..), Mod(..), Name) import Utils.Drasil (subsetOf) -import Control.Lens ((^.), makeLenses) +import Control.Lens ((^.), makeLenses, Lens', makeClassyFor) import Data.List (intercalate, nub, (\\)) import qualified Data.Map as Map import Data.Maybe (mapMaybe) @@ -36,44 +38,118 @@ type Const = CodeDefinition type Derived = CodeDefinition -- | Mathematical definition. type Def = CodeDefinition +-- | Maps constants to their respective 'CodeDefinition'. +type ConstantMap = Map.Map UID CodeDefinition --- | Code specifications. Holds information needed to generate code. -data CodeSpec where - CodeSpec :: (HasName a) => { +-- | Old Code specifications. Holds information needed to generate code. +data OldCodeSpec = OldCodeSpec { -- | Program name. - pName :: Name, + _pName :: Name, -- | Authors. - authors :: [a], + _authors :: People, -- | All inputs. - inputs :: [Input], + _inputs :: [Input], -- | Explicit inputs (values to be supplied by a file). - extInputs :: [Input], + _extInputs :: [Input], -- | Derived inputs (each calculated from explicit inputs in a single step). - derivedInputs :: [Derived], + _derivedInputs :: [Derived], -- | All outputs. - outputs :: [Output], + _outputs :: [Output], -- | List of files that must be in same directory for running the executable. - configFiles :: [FilePath], + _configFiles :: [FilePath], -- | Mathematical definitions, ordered so that they form a path from inputs to -- outputs. - execOrder :: [Def], + _execOrder :: [Def], -- | Map from 'UID's to constraints for all constrained chunks used in the problem. - cMap :: ConstraintCEMap, + _cMap :: ConstraintCEMap, -- | List of all constants used in the problem. - constants :: [Const], + _constants :: [Const], -- | Map containing all constants used in the problem. - constMap :: ConstantMap, + _constMap :: ConstantMap, -- | Additional modules required in the generated code, which Drasil cannot yet -- automatically define. - mods :: [Mod], -- medium hack + _mods :: [Mod], -- medium hack -- | The database of all chunks used in the problem. - sysinfodb :: ChunkDB, - -- | Reference to the system information. - _sysInfo :: SystemInformation - } -> CodeSpec + _sysinfodb :: ChunkDB + } --- | Maps constants to their respective 'CodeDefinition'. -type ConstantMap = Map.Map UID CodeDefinition +makeClassyFor "HasOldCodeSpec" "oldCodeSpec" + [ ("_pName", "pNameO") + , ("_authors", "authorsO") + , ("_inputs", "inputsO") + , ("_extInputs", "extInputsO") + , ("_derivedInputs", "derivedInputsO") + , ("_outputs", "outputsO") + , ("_configFiles", "configFilesO") + , ("_execOrder", "execOrderO") + , ("_cMap", "cMapO") + , ("_constants", "constantsO") + , ("_constMap", "constMapO") + , ("_mods", "modsO") + , ("_sysinfodb", "sysinfodbO") + ] ''OldCodeSpec + +-- | New Code Specification. Holds system information and a reference to `OldCodeSpec`. +data CodeSpec = CS { + _sysInfo :: SI.SystemInformation, + _oldCode :: OldCodeSpec +} +makeLenses ''CodeSpec + +instance HasSystemInformation CodeSpec where + systemInformation :: Lens' CodeSpec SI.SystemInformation + systemInformation = sysInfo + background :: Lens' CodeSpec SI.Background + background = systemInformation . SI.background + purpose :: Lens' CodeSpec SI.Purpose + purpose = systemInformation . SI.purpose + scope :: Lens' CodeSpec SI.Scope + scope = systemInformation . SI.scope + motivation :: Lens' CodeSpec SI.Motivation + motivation = systemInformation . SI.motivation + +instance HasOldCodeSpec CodeSpec where + oldCodeSpec :: Lens' CodeSpec OldCodeSpec + oldCodeSpec = oldCode + + pNameO :: Lens' CodeSpec Name + pNameO = oldCode . pNameO + + authorsO :: Lens' CodeSpec People + authorsO = oldCode . authorsO + + inputsO :: Lens' CodeSpec [Input] + inputsO = oldCode . inputsO + + extInputsO :: Lens' CodeSpec [Input] + extInputsO = oldCode . extInputsO + + derivedInputsO :: Lens' CodeSpec [Derived] + derivedInputsO = oldCode . derivedInputsO + + outputsO :: Lens' CodeSpec [Output] + outputsO = oldCode . outputsO + + configFilesO :: Lens' CodeSpec [FilePath] + configFilesO = oldCode . configFilesO + + execOrderO :: Lens' CodeSpec [Def] + execOrderO = oldCode . execOrderO + + cMapO :: Lens' CodeSpec ConstraintCEMap + cMapO = oldCode . cMapO + + constantsO :: Lens' CodeSpec [Const] + constantsO = oldCode . constantsO + + constMapO :: Lens' CodeSpec ConstantMap + constMapO = oldCode . constMapO + + modsO :: Lens' CodeSpec [Mod] + modsO = oldCode . modsO + + sysinfodbO :: Lens' CodeSpec ChunkDB + sysinfodbO = oldCode . sysinfodbO -- | Converts a list of chunks that have 'UID's to a Map from 'UID' to the associated chunk. assocToMap :: HasUID a => [a] -> Map.Map UID a @@ -90,19 +166,28 @@ mapODE :: Maybe ODE -> [CodeDefinition] mapODE Nothing = [] mapODE (Just ode) = map odeDef $ odeInfo ode --- | Defines a 'CodeSpec' based on the 'SystemInformation', 'Choices', and 'Mod's --- defined by the user. -codeSpec :: SystemInformation -> Choices -> [Mod] -> CodeSpec -codeSpec si@SI{ _sys = sys - , _authors = as - , _instModels = ims - , _datadefs = ddefs - , _configFiles = cfp - , _inputs = ins - , _outputs = outs - , _constraints = cs - , _constants = cnsts - , _sysinfodb = db} chs ms = +-- | Creates a 'CodeSpec' using the provided 'SystemInformation', 'Choices', and 'Mod's. +-- The 'CodeSpec' consists of the system information and a corresponding 'OldCodeSpec'. +codeSpec :: SI.SystemInformation -> Choices -> [Mod] -> CodeSpec +codeSpec si chs ms = CS { + _sysInfo = si, + _oldCode = oldcodeSpec si chs ms +} + +-- | Generates an 'OldCodeSpec' from 'SystemInformation', 'Choices', and a list of 'Mod's. +-- This function extracts various components (e.g., inputs, outputs, constraints, etc.) +-- from 'SystemInformation' to populate the 'OldCodeSpec' structure. +oldcodeSpec :: SI.SystemInformation -> Choices -> [Mod] -> OldCodeSpec +oldcodeSpec SI.SI{ SI._sys = sys + , SI._authors = as + , SI._instModels = ims + , SI._datadefs = ddefs + , SI._configFiles = cfp + , SI._inputs = ins + , SI._outputs = outs + , SI._constraints = cs + , SI._constants = cnsts + , SI._sysinfodb = db } chs ms = let n = programName sys inputs' = map quantvar ins const' = map qtov (filter ((`Map.notMember` conceptMatch (maps chs)) . (^. uid)) @@ -115,21 +200,20 @@ codeSpec si@SI{ _sys = sys outs' = map quantvar outs allInputs = nub $ inputs' ++ map quantvar derived exOrder = getExecOrder rels (allInputs ++ map quantvar cnsts) outs' db - in CodeSpec { - pName = n, - authors = as, - inputs = allInputs, - extInputs = inputs', - derivedInputs = derived, - outputs = outs', - configFiles = cfp, - execOrder = exOrder, - cMap = constraintMap cs, - constants = const', - constMap = assocToMap const', - mods = ms, - sysinfodb = db, - _sysInfo = si + in OldCodeSpec { + _pName = n, + _authors = as, + _inputs = allInputs, + _extInputs = inputs', + _derivedInputs = derived, + _outputs = outs', + _configFiles = cfp, + _execOrder = exOrder, + _cMap = constraintMap cs, + _constants = const', + _constMap = assocToMap const', + _mods = ms, + _sysinfodb = db } @@ -190,6 +274,4 @@ constraintvars :: ConstraintCE -> ChunkDB -> [CodeChunk] constraintvars (Range _ ri) m = map (codeChunk . varResolve m) $ nub $ eNamesRI ri constraintvars (Elem _ ri) m = - map (codeChunk . varResolve m) $ eDep ri - -makeLenses ''CodeSpec \ No newline at end of file + map (codeChunk . varResolve m) $ eDep ri \ No newline at end of file From 6e7045b07bb8de87971df179c73afa73a2b42b2f Mon Sep 17 00:00:00 2001 From: Stardew Date: Fri, 27 Sep 2024 16:34:38 -0400 Subject: [PATCH 16/17] Refactored SystemInformation with classy lenses - Introduced `makeClassy` to generate the `HasSystemInformation` type class and associated lenses for the `SystemInformation` data structure. - Updated `CodeSpec` to use the `HasSystemInformation` type class. --- .../lib/SysInfo/Drasil/SystemInformation.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs b/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs index c94b0cfb63..f29cb0090c 100644 --- a/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs +++ b/code/drasil-sysinfo/lib/SysInfo/Drasil/SystemInformation.hs @@ -10,8 +10,7 @@ module SysInfo.Drasil.SystemInformation ( -- ** Types SystemInformation(..), Block(..), -- ** Lenses - instModels, datadefs, configFiles, inputs, purpose, background, scope, - motivation, defSequence, constraints, constants, sysinfodb, usedinfodb, + HasSystemInformation(..), -- ** Lookup Functions citeDB, citationsFromBibMap, -- * Reference Database @@ -27,7 +26,7 @@ import Language.Drasil import Theory.Drasil import Database.Drasil (ChunkDB) -import Control.Lens ((^.), makeLenses) +import Control.Lens ((^.), makeLenses, makeClassy) import Data.Function (on) import Data.List (groupBy, sortBy) import Data.Maybe (mapMaybe) @@ -41,13 +40,13 @@ data SystemInformation where --There should be a way to remove redundant "Quantity" constraint. -- I'm thinking for getting concepts that are also quantities, we could -- use a lookup of some sort from their internal (Drasil) ids. - SI :: (CommonIdea a, Idea a, Idea b, HasName c, + SI :: (CommonIdea a, Idea a, Idea b, Quantity e, Eq e, MayHaveUnit e, Quantity f, MayHaveUnit f, Concept f, Eq f, Quantity h, MayHaveUnit h, Quantity i, MayHaveUnit i, HasUID j, Constrained j) => { _sys :: a , _kind :: b - , _authors :: [c] + , _authors :: People , _purpose :: Purpose , _background :: Background , _scope :: Scope @@ -147,6 +146,7 @@ data ReferenceDB = RDB -- organized in order of appearance in SmithEtAl template } makeLenses ''ReferenceDB +makeClassy ''SystemInformation -- | Smart constructor for creating a reference database from a bibliography and concept instances. rdb :: BibRef -> [ConceptInstance] -> ReferenceDB @@ -180,6 +180,4 @@ conceptMap cs = Map.fromList $ zip (map (^. uid) (concat grp)) $ concatMap -- | Compare two things by their 'UID's. uidSort :: HasUID c => c -> c -> Ordering -uidSort = compare `on` (^. uid) - -makeLenses ''SystemInformation \ No newline at end of file +uidSort = compare `on` (^. uid) \ No newline at end of file From 10ae63bb17694d27ba808c26ad5fb28462f9c2e1 Mon Sep 17 00:00:00 2001 From: Stardew Date: Fri, 27 Sep 2024 16:37:28 -0400 Subject: [PATCH 17/17] Refactored access to sysinfodb using lens in CodeSpec --- code/drasil-code/lib/Language/Drasil/Code.hs | 7 ++- .../Drasil/Code/Imperative/Comments.hs | 6 +- .../Drasil/Code/Imperative/Descriptions.hs | 20 +++---- .../Drasil/Code/Imperative/DrasilState.hs | 36 ++++++------ .../Drasil/Code/Imperative/GenerateGOOL.hs | 13 ++--- .../Drasil/Code/Imperative/Generator.hs | 54 +++++++++--------- .../Drasil/Code/Imperative/Helpers.hs | 5 +- .../Language/Drasil/Code/Imperative/Import.hs | 26 ++++----- .../Drasil/Code/Imperative/Modules.hs | 56 +++++++++---------- .../Drasil/Code/Imperative/Parameters.hs | 28 +++++----- .../lib/Drasil/DocumentLanguage.hs | 4 +- .../lib/Language/Drasil/Generate.hs | 7 ++- code/drasil-sysinfo/lib/SysInfo/Drasil.hs | 4 +- .../lib/Drasil/Website/CaseStudy.hs | 2 +- 14 files changed, 136 insertions(+), 132 deletions(-) diff --git a/code/drasil-code/lib/Language/Drasil/Code.hs b/code/drasil-code/lib/Language/Drasil/Code.hs index d9681fcb12..55c2cf450d 100644 --- a/code/drasil-code/lib/Language/Drasil/Code.hs +++ b/code/drasil-code/lib/Language/Drasil/Code.hs @@ -9,8 +9,8 @@ module Language.Drasil.Code ( OptionalFeatures(..), makeOptFeats, ExtLib(..), ImplementationType(..), Logging(..), Modularity(..), Structure(..), ConstantStructure(..), ConstantRepr(..), CodeConcept(..), matchConcepts, SpaceMatch, matchSpaces, AuxFile(..), - getSampleData, Visibility(..), defaultChoices, CodeSpec(..), funcUID, asVC, - codeSpec, ($:=), Mod(Mod), StateVariable, Func, FuncStmt(..), pubStateVar, + getSampleData, Visibility(..), defaultChoices, CodeSpec(..), OldCodeSpec(..), codeSpec, + HasOldCodeSpec(..), funcUID, asVC, ($:=), Mod(Mod), StateVariable, Func, FuncStmt(..), pubStateVar, privStateVar, fDecDef, ffor, fforRange, funcData, funcDef, packmod, junkLine, multiLine, repeated, singleLine, singleton, ExternalLibrary, Step, FunctionInterface, Argument, externalLib, choiceSteps, @@ -93,7 +93,8 @@ import Language.Drasil.Choices (Choices(..), Comments(..), Verbosity(..), makeDocConfig, makeLogConfig, LogConfig(..), OptionalFeatures(..), makeOptFeats, ExtLib(..)) -import Language.Drasil.CodeSpec (CodeSpec(..), funcUID, asVC, codeSpec) +import Language.Drasil.CodeSpec (CodeSpec(..), OldCodeSpec(..), HasOldCodeSpec(..), + codeSpec, funcUID, asVC) import Language.Drasil.Mod (($:=), Mod(Mod), StateVariable, Func, FuncStmt(..), pubStateVar, privStateVar, fDecDef, ffor, fforRange, funcData, funcDef, packmod) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Comments.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Comments.hs index 861c1fea3a..ba729417e6 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Comments.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Comments.hs @@ -6,7 +6,7 @@ module Language.Drasil.Code.Imperative.Comments ( import Language.Drasil import Database.Drasil (defTable) import Language.Drasil.Code.Imperative.DrasilState (GenState, DrasilState(..)) -import Language.Drasil.CodeSpec (CodeSpec(..)) +import Language.Drasil.CodeSpec (HasOldCodeSpec(..)) import Language.Drasil.Printers (SingleLine(OneLine), sentenceDoc, unitDoc) import qualified Data.Map as Map (lookup) @@ -18,7 +18,7 @@ import Text.PrettyPrint.HughesPJ (Doc, (<+>), colon, empty, parens, render) getTermDoc :: (CodeIdea c) => c -> GenState Doc getTermDoc c = do g <- get - let db = sysinfodb $ codeSpec g + let db = codeSpec g ^. sysinfodbO return $ sentenceDoc db Implementation OneLine $ phraseNP $ codeChunk c ^. term -- | Gets a plain rendering of the definition of a chunk, preceded by a colon @@ -27,7 +27,7 @@ getTermDoc c = do getDefnDoc :: (CodeIdea c) => c -> GenState Doc getDefnDoc c = do g <- get - let db = sysinfodb $ codeSpec g + let db = codeSpec g ^. sysinfodbO return $ maybe empty ((<+>) colon . sentenceDoc db Implementation OneLine . (^. defn) . fst) (Map.lookup (codeChunk c ^. uid) $ defTable db) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Descriptions.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Descriptions.hs index 4ae700108b..623d7e9ef2 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Descriptions.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Descriptions.hs @@ -15,7 +15,7 @@ import Language.Drasil.Code.Imperative.DrasilState (GenState, DrasilState(..), genICName) import Language.Drasil.Choices (ImplementationType(..), Structure(..), InternalConcept(..)) -import Language.Drasil.CodeSpec (CodeSpec(..), sysInfo) +import Language.Drasil.CodeSpec (HasOldCodeSpec(..)) import Language.Drasil.Mod (Description) import Language.Drasil.Printers (SingleLine(OneLine), sentenceDoc) @@ -40,8 +40,8 @@ unmodularDesc = do let spec = codeSpec g implTypeStr Program = "program" implTypeStr Library = "library" - return $ show $ sentenceDoc (sysinfodb spec) Implementation OneLine $ capSent $ - foldlSent ([S "a", S (implTypeStr (implType g)), S "to"] ++ codeSpec g ^. sysInfo .purpose) + return $ show $ sentenceDoc (spec ^. sysinfodbO) Implementation OneLine $ capSent $ + foldlSent ([S "a", S (implTypeStr (implType g)), S "to"] ++ codeSpec g ^. purpose) -- | Returns description of what is contained in the Input Parameters module. -- If user chooses the 'Bundled' input parameter, this module will include the structure for holding the @@ -122,7 +122,7 @@ constModDesc = do let cDesc [] = "" cDesc _ = "the structure for holding constant values" return $ cDesc $ filter (flip member (Map.filter (cname ==) - (clsMap g)) . codeName) (constants $ codeSpec g) + (clsMap g)) . codeName) (codeSpec g ^. constantsO) -- | Returns a description of what is contained in the Output Format module, -- if it exists. @@ -146,9 +146,9 @@ inputClassDesc = do inIPMap = filter ((`member` ipMap) . codeName) inClassD True = "" inClassD _ = "Structure for holding the " ++ stringList [ - inPs $ inIPMap $ extInputs $ codeSpec g, - dVs $ inIPMap $ map quantvar $ derivedInputs $ codeSpec g, - cVs $ inIPMap $ map quantvar $ constants $ codeSpec g] + inPs $ inIPMap $ codeSpec g ^. extInputsO, + dVs $ inIPMap $ map quantvar $ codeSpec g ^. derivedInputsO, + cVs $ inIPMap $ map quantvar $ codeSpec g ^. constantsO] inPs [] = "" inPs _ = "input values" dVs [] = "" @@ -167,7 +167,7 @@ constClassDesc = do let ccDesc [] = "" ccDesc _ = "Structure for holding the constant values" return $ ccDesc $ filter (flip member (Map.filter (cname ==) - (clsMap g)) . codeName) (constants $ codeSpec g) + (clsMap g)) . codeName) (codeSpec g ^. constantsO) -- | Returns a description for the generated function that reads input from a -- file, if it exists. @@ -221,8 +221,8 @@ woFuncDesc = do physAndSfwrCons :: GenState Description physAndSfwrCons = do g <- get - let cns = concat $ mapMaybe ((`Map.lookup` (cMap $ codeSpec g)) . (^. uid)) - (inputs $ codeSpec g) + let cns = concat $ mapMaybe ((`Map.lookup` (codeSpec g ^. cMapO)) . (^. uid)) + (codeSpec g ^. inputsO) return $ stringList [ if not (any isPhysC cns) then "" else "physical constraints", if not (any isSfwrC cns) then "" else "software constraints"] diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/DrasilState.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/DrasilState.hs index 1dbedc6564..d0a8587b26 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/DrasilState.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/DrasilState.hs @@ -17,7 +17,7 @@ import Language.Drasil.Choices (Choices(..), Architecture (..), DataInfo(..), MatchedConceptMap, ConstantRepr, ConstantStructure(..), ConstraintBehaviour, Logging, Structure(..), InternalConcept(..)) import Language.Drasil.CodeSpec (Input, Const, Derived, Output, Def, - CodeSpec(..), getConstraints) + CodeSpec(..), OldCodeSpec(..), getConstraints) import Language.Drasil.Mod (Mod(..), Name, Version, Class(..), StateVariable(..), fname) @@ -100,23 +100,23 @@ addLoggedSpace s t = over loggedSpaces ((s,t):) -- | Builds the module export map, mapping each function and state variable name -- in the generated code to the name of the generated module that exports it. -modExportMap :: CodeSpec -> Choices -> [Mod] -> ModExportMap -modExportMap cs@CodeSpec { - pName = prn, - inputs = ins, - extInputs = extIns, - derivedInputs = ds, - constants = cns +modExportMap :: OldCodeSpec -> Choices -> [Mod] -> ModExportMap +modExportMap cs@OldCodeSpec { + _pName = prn, + _inputs = ins, + _extInputs = extIns, + _derivedInputs = ds, + _constants = cns } chs@Choices { architecture = m } ms = fromList $ nubOrd $ concatMap mpair ms ++ getExpInput prn chs ins ++ getExpConstants prn chs cns ++ getExpDerived prn chs ds - ++ getExpConstraints prn chs (getConstraints (cMap cs) ins) + ++ getExpConstraints prn chs (getConstraints (_cMap cs) ins) ++ getExpInputFormat prn chs extIns - ++ getExpCalcs prn chs (execOrder cs) - ++ getExpOutput prn chs (outputs cs) + ++ getExpCalcs prn chs (_execOrder cs) + ++ getExpOutput prn chs (_outputs cs) where mpair (Mod n _ _ cls fs) = map (, defModName (modularity m) n) (map className cls @@ -127,17 +127,17 @@ modExportMap cs@CodeSpec { -- | Builds the class definition map, mapping each generated method and state -- variable name to the name of the generated class where it is defined. -clsDefMap :: CodeSpec -> Choices -> [Mod] -> ClassDefinitionMap -clsDefMap cs@CodeSpec { - inputs = ins, - extInputs = extIns, - derivedInputs = ds, - constants = cns +clsDefMap :: OldCodeSpec -> Choices -> [Mod] -> ClassDefinitionMap +clsDefMap cs@OldCodeSpec { + _inputs = ins, + _extInputs = extIns, + _derivedInputs = ds, + _constants = cns } chs ms = fromList $ nub $ concatMap modClasses ms ++ getInputCls chs ins ++ getConstantsCls chs cns ++ getDerivedCls chs ds - ++ getConstraintsCls chs (getConstraints (cMap cs) ins) + ++ getConstraintsCls chs (getConstraints (_cMap cs) ins) ++ getInputFormatCls chs extIns where modClasses (Mod _ _ _ cls _) = concatMap (\cl -> let cln = className cl in diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GenerateGOOL.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GenerateGOOL.hs index c9a11b91a6..5637de3c36 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/GenerateGOOL.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/GenerateGOOL.hs @@ -9,7 +9,7 @@ import Language.Drasil.Code.Imperative.DrasilState (GenState, DrasilState(..)) import Language.Drasil.Code.Imperative.GOOL.ClassInterface (AuxiliarySym(..)) import Language.Drasil.Code.Imperative.ReadMe.Import (ReadMeInfo(..)) import Language.Drasil.Choices (Comments(..), AuxFile(..)) -import Language.Drasil.CodeSpec (CodeSpec(..)) +import Language.Drasil.CodeSpec (HasOldCodeSpec(..)) import Language.Drasil.Mod (Name, Description, Import) import Drasil.GOOL (VSType, SVariable, SValue, MSStatement, SMethod, @@ -26,6 +26,7 @@ import Data.Bifunctor (second) import qualified Data.Map as Map (lookup) import Data.Maybe (catMaybes) import Control.Monad.State (get, modify) +import Control.Lens ((^.)) -- | Defines a GOOL module. If the user chose 'CommentMod', the module will have -- Doxygen comments. If the user did not choose 'CommentMod' but did choose @@ -38,8 +39,7 @@ genModuleWithImports :: (OOProg r) => Name -> Description -> [Import] -> genModuleWithImports n desc is maybeMs maybeCs = do g <- get modify (\s -> s { currentModule = n }) - -- Below line of code cannot be simplified because authors has a generic type - let as = case codeSpec g of CodeSpec {authors = a} -> map name a + let as = map name (codeSpec g ^. authorsO ) cs <- sequence maybeCs ms <- sequence maybeMs let commMod | CommentMod `elem` commented g = OO.docMod desc @@ -59,7 +59,7 @@ genModule n desc = genModuleWithImports n desc [] genDoxConfig :: (AuxiliarySym r) => GOOLState -> GenState (Maybe (r (Auxiliary r))) genDoxConfig s = do g <- get - let n = pName $ codeSpec g + let n = codeSpec g ^. pNameO cms = commented g v = doxOutput g return $ if not (null cms) then Just (doxConfig n s v) else Nothing @@ -68,7 +68,7 @@ genDoxConfig s = do genReadMe :: (AuxiliarySym r) => ReadMeInfo -> GenState (Maybe (r (Auxiliary r))) genReadMe rmi = do g <- get - let n = pName $ codeSpec g + let n = codeSpec g ^. pNameO return $ getReadMe (auxiliaries g) rmi {caseName = n} -- | Helper for generating a README file. @@ -179,8 +179,7 @@ genModuleWithImportsProc :: (ProcProg r) => Name -> Description -> [Import] -> genModuleWithImportsProc n desc is maybeMs = do g <- get modify (\s -> s { currentModule = n }) - -- Below line of code cannot be simplified because authors has a generic type - let as = case codeSpec g of CodeSpec {authors = a} -> map name a + let as = map name (codeSpec g ^. authorsO ) ms <- sequence maybeMs let commMod | CommentMod `elem` commented g = Proc.docMod desc as (date g) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs index 4ce331bafb..e56ccd5ca4 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Generator.hs @@ -32,7 +32,7 @@ import Language.Drasil.Code.Lang (Lang(..)) import Language.Drasil.Choices (Choices(..), Modularity(..), Architecture(..), Visibility(..), DataInfo(..), Constraints(..), choicesSent, DocConfig(..), LogConfig(..), OptionalFeatures(..), InternalConcept(..)) -import Language.Drasil.CodeSpec (CodeSpec(..), getODE, sysInfo) +import Language.Drasil.CodeSpec (CodeSpec(..), HasOldCodeSpec(..), getODE) import Language.Drasil.Printers (SingleLine(OneLine), sentenceDoc) import Drasil.GOOL (OOProg, VisibilityTag(..), @@ -97,12 +97,12 @@ generator l dt sd chs spec = DrasilState { ((pth, elmap, lname), libLog) = runState (chooseODELib l $ getODE $ extLibs chs) [] els = map snd elmap nms = [lname] - mem = modExportMap spec chs modules' + mem = modExportMap (spec ^. oldCodeSpec) chs modules' lem = fromList (concatMap (^. modExports) els) - cdm = clsDefMap spec chs modules' - modules' = mods spec ++ concatMap (^. auxMods) els + cdm = clsDefMap (spec ^. oldCodeSpec) chs modules' + modules' = (spec ^. modsO) ++ concatMap (^. auxMods) els nonPrefChs = choicesSent chs - des = vcat . map (sentenceDoc (sysinfodb spec) Implementation OneLine) $ + des = vcat . map (sentenceDoc (spec ^. sysinfodbO) Implementation OneLine) $ (nonPrefChs ++ concLog ++ libLog) -- OO Versions -- @@ -144,19 +144,19 @@ genPackage unRepr = do (reprPD, s) = runState p info pd = unRepr reprPD m = makefile (libPaths g) (implType g) (commented g) s pd - as = case codeSpec g of CodeSpec {authors = a} -> map name a - cfp = configFiles $ codeSpec g - db = sysinfodb $ codeSpec g + as = map name (codeSpec g ^. authorsO) + cfp = codeSpec g ^. configFilesO + db = codeSpec g ^. sysinfodbO -- prps = show $ sentenceDoc db Implementation OneLine -- (foldlSent $ purpose $ codeSpec g) prps = show $ sentenceDoc db Implementation OneLine - (foldlSent $ codeSpec g ^. sysInfo .purpose) + (foldlSent $ codeSpec g ^. purpose) bckgrnd = show $ sentenceDoc db Implementation OneLine - (foldlSent $ codeSpec g ^. sysInfo . background) + (foldlSent $ codeSpec g ^. background) mtvtn = show $ sentenceDoc db Implementation OneLine - (foldlSent $ codeSpec g ^. sysInfo . motivation) + (foldlSent $ codeSpec g ^. motivation) scp = show $ sentenceDoc db Implementation OneLine - (foldlSent $ codeSpec g ^. sysInfo . scope) + (foldlSent $ codeSpec g ^. scope) i <- genSampleInput d <- genDoxConfig s rm <- genReadMe ReadMeInfo { @@ -182,8 +182,8 @@ genProgram :: (OOProg r) => GenState (OO.GSProgram r) genProgram = do g <- get ms <- chooseModules $ modular g - let n = pName $ codeSpec g - let p = show $ sentenceDoc (sysinfodb $ codeSpec g) Implementation OneLine $ foldlSent $ codeSpec g ^. sysInfo .purpose + let n = codeSpec g ^. pNameO + let p = show $ sentenceDoc (codeSpec g ^. sysinfodbO) Implementation OneLine $ foldlSent $ codeSpec g ^. purpose return $ OO.prog n p ms -- | Generates either a single module or many modules, based on the users choice @@ -200,11 +200,11 @@ genUnmodular = do giName <- genICName GetInput dvName <- genICName DerivedValuesFn icName <- genICName InputConstraintsFn - let n = pName $ codeSpec g + let n = codeSpec g ^. pNameO cls = any (`member` clsMap g) [giName, dvName, icName] genModuleWithImports n umDesc (concatMap (^. imports) (elems $ extLibMap g)) (genMainFunc - : map (fmap Just) (map genCalcFunc (execOrder $ codeSpec g) + : map (fmap Just) (map genCalcFunc (codeSpec g ^. execOrderO) ++ concatMap genModFuncs (modules g)) ++ ((if cls then [] else [genInputFormat Pub, genInputDerived Pub, genInputConstraints Pub]) ++ [genOutputFormat])) @@ -258,17 +258,17 @@ genPackageProc unRepr = do (reprPD, s) = runState p info pd = unRepr reprPD m = makefile (libPaths g) (implType g) (commented g) s pd - as = case codeSpec g of CodeSpec {authors = a} -> map name a - cfp = configFiles $ codeSpec g - db = sysinfodb $ codeSpec g + as = map name (codeSpec g ^. authorsO) + cfp = codeSpec g ^. configFilesO + db = codeSpec g ^. sysinfodbO prps = show $ sentenceDoc db Implementation OneLine - (foldlSent $ codeSpec g ^. sysInfo .purpose) + (foldlSent $ codeSpec g ^. purpose) bckgrnd = show $ sentenceDoc db Implementation OneLine - (foldlSent $ codeSpec g ^. sysInfo . background) + (foldlSent $ codeSpec g ^. background) mtvtn = show $ sentenceDoc db Implementation OneLine - (foldlSent $ codeSpec g ^. sysInfo . motivation) + (foldlSent $ codeSpec g ^. motivation) scp = show $ sentenceDoc db Implementation OneLine - (foldlSent $ codeSpec g ^. sysInfo . scope) + (foldlSent $ codeSpec g ^. scope) i <- genSampleInput d <- genDoxConfig s rm <- genReadMe ReadMeInfo { @@ -294,8 +294,8 @@ genProgramProc :: (ProcProg r) => GenState (Proc.GSProgram r) genProgramProc = do g <- get ms <- chooseModulesProc $ modular g - let n = pName $ codeSpec g - let p = show $ sentenceDoc (sysinfodb $ codeSpec g) Implementation OneLine $ foldlSent $ codeSpec g ^. sysInfo .purpose + let n = codeSpec g ^. pNameO + let p = show $ sentenceDoc (codeSpec g ^. sysinfodbO) Implementation OneLine $ foldlSent $ codeSpec g ^. purpose return $ Proc.prog n p ms -- | Generates either a single module or many modules, based on the users choice @@ -312,12 +312,12 @@ genUnmodularProc = do giName <- genICName GetInput dvName <- genICName DerivedValuesFn icName <- genICName InputConstraintsFn - let n = pName $ codeSpec g + let n = codeSpec g ^. pNameO cls = any (`member` clsMap g) [giName, dvName, icName] if cls then error "genUnmodularProc: Procedural renderers do not support classes" else genModuleWithImportsProc n umDesc (concatMap (^. imports) (elems $ extLibMap g)) (genMainFuncProc - : map (fmap Just) (map genCalcFuncProc (execOrder $ codeSpec g) + : map (fmap Just) (map genCalcFuncProc (codeSpec g ^. execOrderO) ++ concatMap genModFuncsProc (modules g)) ++ ([genInputFormatProc Pub, genInputDerivedProc Pub, genInputConstraintsProc Pub] ++ [genOutputFormatProc])) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Helpers.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Helpers.hs index 296e436fac..5532a2246c 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Helpers.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Helpers.hs @@ -6,10 +6,11 @@ import Language.Drasil (UID, QuantityDict) import Database.Drasil (symbResolve) import Language.Drasil.Code.Imperative.DrasilState (DrasilState(..), ScopeType(..)) -import Language.Drasil.CodeSpec (CodeSpec(..)) +import Language.Drasil.CodeSpec (HasOldCodeSpec(..)) import Drasil.GOOL (SharedProg, ScopeSym(..)) import Control.Monad.State (State) +import Control.Lens ((^.)) -- | Puts a state-dependent value into a singleton list. liftS :: State a b -> State a [b] @@ -17,7 +18,7 @@ liftS = fmap (: []) -- | Gets the 'QuantityDict' corresponding to a 'UID'. lookupC :: DrasilState -> UID -> QuantityDict -lookupC g = symbResolve (sysinfodb $ codeSpec g) +lookupC g = symbResolve (codeSpec g ^. sysinfodbO) -- | Converts a 'ScopeType' to a 'Scope' convScope :: (SharedProg r) => ScopeType -> r (Scope r) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Import.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Import.hs index 5e806c1986..18a55a872f 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Import.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Import.hs @@ -31,7 +31,7 @@ import Language.Drasil.Chunk.Parameter (ParameterChunk(..), PassBy(..), pcAuto) import Language.Drasil.Code.CodeQuantityDicts (inFileName, inParams, consts) import Language.Drasil.Choices (Comments(..), ConstantRepr(..), ConstantStructure(..), Structure(..), InternalConcept(..)) -import Language.Drasil.CodeSpec (CodeSpec(..)) +import Language.Drasil.CodeSpec (HasOldCodeSpec(..)) import Language.Drasil.Code.DataDesc (DataItem, LinePattern(Repeat, Straight), Data(Line, Lines, JunkData, Singleton), DataDesc, isLine, isLines, getInputs, getPatternInputs) @@ -87,7 +87,7 @@ value :: (OOProg r) => UID -> Name -> VSType r -> GenState (SValue r) value u s t = do g <- get let cs = codeSpec g - mm = constMap cs + mm = cs ^. constMapO constDef = do cd <- Map.lookup u mm maybeInline (conStruct g) cd @@ -110,9 +110,9 @@ variable s t = do let cs = codeSpec g defFunc Var = var defFunc Const = staticConst - if s `elem` map codeName (inputs cs) + if s `elem` map codeName (cs ^. inputsO) then inputVariable (inStruct g) Var (var s t) - else if s `elem` map codeName (constants $ codeSpec g) + else if s `elem` map codeName (cs ^. constantsO) then constVariable (conStruct g) (conRepr g) ((defFunc $ conRepr g) s t) else return $ var s t @@ -323,7 +323,7 @@ convExpr (New c x ns) = convCall c x ns (\m _ -> ctorCall m) (\m _ -> libNewObjMixedArgs m) convExpr (Message a m x ns) = do g <- get - let info = sysinfodb $ codeSpec g + let info = codeSpec g ^. sysinfodbO objCd = quantvar (symbResolve info a) o <- mkVal objCd convCall m x ns @@ -390,7 +390,7 @@ convCall :: (OOProg r) => UID -> [CodeExpr] -> [(UID, CodeExpr)] -> -> NamedArgs r -> SValue r) -> GenState (SValue r) convCall c x ns f libf = do g <- get - let info = sysinfodb $ codeSpec g + let info = codeSpec g ^. sysinfodbO mem = eMap g lem = libEMap g funcCd = quantfunc (symbResolve info c) @@ -550,7 +550,7 @@ genFunc f svs (FDef (FuncDef n desc parms o rd s)) = do g <- get modify (\st -> st {currentScope = Local}) stmts <- mapM convStmt s - vars <- mapM mkVar (fstdecl (sysinfodb $ codeSpec g) s + vars <- mapM mkVar (fstdecl (codeSpec g ^. sysinfodbO) s \\ (map quantvar parms ++ map stVar svs)) t <- spaceCodeType o f n (convTypeOO t) desc parms rd [block $ map (`varDec` local) vars, block stmts] @@ -561,7 +561,7 @@ genFunc _ svs (FDef (CtorDef n desc parms i s)) = do initvars <- mapM ((\iv -> fmap (var (codeName iv) . convTypeOO) (codeType iv)) . fst) i stmts <- mapM convStmt s - vars <- mapM mkVar (fstdecl (sysinfodb $ codeSpec g) s + vars <- mapM mkVar (fstdecl (codeSpec g ^. sysinfodbO) s \\ (map quantvar parms ++ map stVar svs)) genInitConstructor n desc parms (zip initvars inits) [block $ map (`varDec` local) vars, block stmts] @@ -780,7 +780,7 @@ valueProc :: (SharedProg r) => UID -> Name -> VSType r -> GenState (SValue r) valueProc u s t = do g <- get let cs = codeSpec g - mm = constMap cs + mm = cs ^. constMapO constDef = do cd <- Map.lookup u mm maybeInline (conStruct g) cd @@ -804,9 +804,9 @@ variableProc s t = do let cs = codeSpec g defFunc Var = var defFunc Const = constant -- This might be wrong - if s `elem` map codeName (inputs cs) + if s `elem` map codeName (cs ^. inputsO) then inputVariableProc (inStruct g) Var (var s t) - else if s `elem` map codeName (constants $ codeSpec g) + else if s `elem` map codeName (cs ^. constantsO) then constVariableProc (conStruct g) (conRepr g) ((defFunc $ conRepr g) s t) else return $ var s t @@ -910,7 +910,7 @@ genFuncProc f svs (FDef (FuncDef n desc parms o rd s)) = do g <- get modify (\st -> st {currentScope = Local}) stmts <- mapM convStmtProc s - vars <- mapM mkVarProc (fstdecl (sysinfodb $ codeSpec g) s + vars <- mapM mkVarProc (fstdecl (codeSpec g ^. sysinfodbO) s \\ (map quantvar parms ++ map stVar svs)) t <- spaceCodeType o f n (convType t) desc parms rd [block $ map (`varDec` local) vars, block stmts] @@ -1091,7 +1091,7 @@ convCallProc :: (SharedProg r) => UID -> [CodeExpr] -> [(UID, CodeExpr)] -> -> NamedArgs r -> SValue r) -> GenState (SValue r) convCallProc c x ns f libf = do g <- get - let info = sysinfodb $ codeSpec g + let info = codeSpec g ^. sysinfodbO mem = eMap g lem = libEMap g funcCd = quantfunc (symbResolve info c) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Modules.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Modules.hs index c767b5feb0..e10a140b09 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Modules.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Modules.hs @@ -48,7 +48,7 @@ import Language.Drasil.Code.ExtLibImport (defs, imports, steps) import Language.Drasil.Choices (Comments(..), ConstantStructure(..), ConstantRepr(..), ConstraintBehaviour(..), ImplementationType(..), Logging(..), Structure(..), hasSampleInput, InternalConcept(..)) -import Language.Drasil.CodeSpec (CodeSpec(..)) +import Language.Drasil.CodeSpec (HasOldCodeSpec(..)) import Language.Drasil.Expr.Development (Completeness(..)) import Language.Drasil.Printers (SingleLine(OneLine), codeExprDoc, showHasSymbImpl) @@ -102,7 +102,7 @@ genMainFunc = do co <- initConsts ip <- getInputDecl ics <- genAllInputCalls - varDef <- mapM genCalcCall (execOrder $ codeSpec g) + varDef <- mapM genCalcCall (codeSpec g ^. execOrderO) wo <- genOutputCall return $ Just $ (if CommentFunc `elem` commented g then docMain else mainFunction) $ bodyStatements $ initLogFileVar (logKind g) mainFn @@ -131,7 +131,7 @@ getInputDecl = do cps <- mapM mkVal constrParams cname <- genICName InputParameters let getDecl ([],[]) = constIns (partition (flip member (eMap g) . - codeName) (map quantvar $ constants $ codeSpec g)) (conRepr g) + codeName) (map quantvar $ codeSpec g ^. constantsO)) (conRepr g) (conStruct g) getDecl ([],ins) = do vars <- mapM mkVar ins @@ -146,7 +146,7 @@ getInputDecl = do constIns cs Var WithInputs = getDecl cs constIns _ _ _ = return Nothing getDecl (partition (flip member (eMap g) . codeName) - (inputs $ codeSpec g)) + (codeSpec g ^. inputsO)) -- | If constants are 'Unbundled', declare them individually using 'varDecDef' if -- representation is 'Var' and 'constDecDef' if representation is 'Const'. @@ -163,7 +163,7 @@ initConsts = do let scp = convScope $ currentScope g v_consts <- mkVar (quantvar consts) cname <- genICName Constants - let cs = constants $ codeSpec g + let cs = codeSpec g ^. constantsO getDecl (Store Unbundled) _ = declVars getDecl (Store Bundled) _ = gets (declObj cs . conRepr) getDecl WithInputs Unbundled = declVars @@ -224,8 +224,8 @@ genInputClass scp = do g <- get modify (\st -> st {currentScope = Local}) cname <- genICName InputParameters - let ins = inputs $ codeSpec g - cs = constants $ codeSpec g + let ins = codeSpec g ^. inputsO + cs = codeSpec g ^. constantsO filt :: (CodeIdea c) => [c] -> [c] filt = filter ((Just cname ==) . flip Map.lookup (clsMap g) . codeName) constructors :: (OOProg r) => GenState [SMethod r] @@ -284,7 +284,7 @@ genInputDerived s = do g <- get modify (\st -> st {currentScope = Local}) dvName <- genICName DerivedValuesFn - let dvals = derivedInputs $ codeSpec g + let dvals = codeSpec g ^. derivedInputsO getFunc Pub = publicInOutFunc getFunc Priv = privateInOutMethod genDerived :: (OOProg r) => Bool -> GenState @@ -306,7 +306,7 @@ genInputConstraints s = do g <- get modify (\st -> st {currentScope = Local}) icName <- genICName InputConstraintsFn - let cm = cMap $ codeSpec g + let cm = codeSpec g ^. cMapO getFunc Pub = publicFunc getFunc Priv = privateMethod genConstraints :: (OOProg r) => Bool -> GenState @@ -314,7 +314,7 @@ genInputConstraints s = do genConstraints False = return Nothing genConstraints _ = do parms <- getConstraintParams - let varsList = filter (\i -> member (i ^. uid) cm) (inputs $ codeSpec g) + let varsList = filter (\i -> member (i ^. uid) cm) (codeSpec g ^. inputsO) sfwrCs = map (sfwrLookup cm) varsList physCs = map (physLookup cm) varsList sf <- sfwrCBody sfwrCs @@ -412,7 +412,7 @@ printConstraint :: (OOProg r) => String -> ConstraintCE -> GenState [MSStatement r] printConstraint v c = do g <- get - let db = sysinfodb $ codeSpec g + let db = codeSpec g ^. sysinfodbO printConstraint' :: (OOProg r) => String -> ConstraintCE -> GenState [MSStatement r] printConstraint' _ (Range _ (Bounded (_, e1) (_, e2))) = do @@ -469,7 +469,7 @@ genDataDesc :: GenState DataDesc genDataDesc = do g <- get return $ junkLine : - intersperse junkLine (map singleton (extInputs $ codeSpec g)) + intersperse junkLine (map singleton (codeSpec g ^. extInputsO)) -- | Generates a sample input file compatible with the generated program, -- if the user chose to. @@ -478,7 +478,7 @@ genSampleInput = do g <- get dd <- genDataDesc if hasSampleInput (auxiliaries g) then return . Just $ sampleInput - (sysinfodb $ codeSpec g) dd (sampleData g) else return Nothing + (codeSpec g ^. sysinfodbO) dd (sampleData g) else return Nothing ----- CONSTANTS ----- @@ -497,7 +497,7 @@ genConstClass scp = do g <- get modify (\st -> st {currentScope = Local}) cname <- genICName Constants - let cs = constants $ codeSpec g + let cs = codeSpec g ^. constantsO genClass :: (OOProg r) => [CodeDefinition] -> GenState (Maybe (SClass r)) genClass [] = return Nothing @@ -524,7 +524,7 @@ genCalcMod = do cName <- genICName Calculations let elmap = extLibMap g genModuleWithImports cName calcModDesc (concatMap (^. imports) $ - elems elmap) (map (fmap Just . genCalcFunc) (execOrder $ codeSpec g)) [] + elems elmap) (map (fmap Just . genCalcFunc) (codeSpec g ^. execOrderO)) [] -- | Generates a calculation function corresponding to the 'CodeDefinition'. -- For solving ODEs, the 'ExtLibState' containing the information needed to @@ -617,7 +617,7 @@ genOutputFormat = do v <- mkVal x return [ printFileStr v_outfile (codeName x ++ " = "), printFileLn v_outfile v - ] ) (outputs $ codeSpec g) + ] ) (codeSpec g ^. outputsO) desc <- woFuncDesc mthd <- publicFunc woName void desc (map pcAuto parms) Nothing [block $ [ @@ -650,7 +650,7 @@ genMainFuncProc = do co <- initConstsProc ip <- getInputDeclProc ics <- genAllInputCallsProc - varDef <- mapM genCalcCallProc (execOrder $ codeSpec g) + varDef <- mapM genCalcCallProc (codeSpec g ^. execOrderO) wo <- genOutputCallProc return $ Just $ (if CommentFunc `elem` commented g then docMain else mainFunction) $ bodyStatements $ initLogFileVar (logKind g) mainFn @@ -674,7 +674,7 @@ initConstsProc :: (SharedProg r) => GenState (Maybe (MSStatement r)) initConstsProc = do g <- get let scp = convScope $ currentScope g - cs = constants $ codeSpec g + cs = codeSpec g ^. constantsO getDecl (Store Unbundled) _ = declVars getDecl (Store Bundled) _ = error "initConstsProc: Procedural renderers do not support bundled constants." getDecl WithInputs Unbundled = declVars @@ -696,7 +696,7 @@ checkConstClass :: GenState Bool checkConstClass = do g <- get cName <- genICName Constants - let cs = constants $ codeSpec g + let cs = codeSpec g ^. constantsO checkClass :: [CodeDefinition] -> GenState Bool checkClass [] = return False checkClass _ = return True @@ -723,8 +723,8 @@ checkInputClass :: GenState Bool checkInputClass = do g <- get cname <- genICName InputParameters - let ins = inputs $ codeSpec g - cs = constants $ codeSpec g + let ins = codeSpec g ^. inputsO + cs = codeSpec g ^. constantsO filt :: (CodeIdea c) => [c] -> [c] filt = filter ((Just cname ==) . flip Map.lookup (clsMap g) . codeName) checkClass :: [CodeVarChunk] -> [CodeDefinition] -> GenState Bool @@ -749,7 +749,7 @@ getInputDeclProc = do return $ Just $ multi $ map (`varDec` scp) vars getDecl _ = error "getInputDeclProc: Procedural renderers do not support bundled inputs" getDecl (partition (flip member (eMap g) . codeName) - (inputs $ codeSpec g)) + (codeSpec g ^. inputsO)) -- | Generates a module containing calculation functions. genCalcModProc :: (ProcProg r) => GenState (Proc.SFile r) @@ -758,7 +758,7 @@ genCalcModProc = do cName <- genICName Calculations let elmap = extLibMap g genModuleWithImportsProc cName calcModDesc (concatMap (^. imports) $ - elems elmap) (map (fmap Just . genCalcFuncProc) (execOrder $ codeSpec g)) + elems elmap) (map (fmap Just . genCalcFuncProc) (codeSpec g ^. execOrderO)) -- | Generates a calculation function corresponding to the 'CodeDefinition'. -- For solving ODEs, the 'ExtLibState' containing the information needed to @@ -851,7 +851,7 @@ genInputDerivedProc s = do g <- get modify (\st -> st {currentScope = Local}) dvName <- genICName DerivedValuesFn - let dvals = derivedInputs $ codeSpec g + let dvals = codeSpec g ^. derivedInputsO getFunc Pub = publicInOutFuncProc getFunc Priv = privateInOutFuncProc genDerived :: (SharedProg r) => Bool -> GenState @@ -873,7 +873,7 @@ genInputConstraintsProc s = do g <- get modify (\st -> st {currentScope = Local}) icName <- genICName InputConstraintsFn - let cm = cMap $ codeSpec g + let cm = codeSpec g ^. cMapO getFunc Pub = publicFuncProc getFunc Priv = privateFuncProc genConstraints :: (SharedProg r) => Bool -> GenState @@ -881,7 +881,7 @@ genInputConstraintsProc s = do genConstraints False = return Nothing genConstraints _ = do parms <- getConstraintParams - let varsList = filter (\i -> member (i ^. uid) cm) (inputs $ codeSpec g) + let varsList = filter (\i -> member (i ^. uid) cm) (codeSpec g ^. inputsO) sfwrCs = map (sfwrLookup cm) varsList physCs = map (physLookup cm) varsList sf <- sfwrCBodyProc sfwrCs @@ -961,7 +961,7 @@ printConstraintProc :: (SharedProg r) => ConstraintCE -> GenState [MSStatement r] printConstraintProc c = do g <- get - let db = sysinfodb $ codeSpec g + let db = codeSpec g ^. sysinfodbO printConstraint' :: (SharedProg r) => ConstraintCE -> GenState [MSStatement r] printConstraint' (Range _ (Bounded (_, e1) (_, e2))) = do @@ -1005,7 +1005,7 @@ genOutputFormatProc = do v <- mkValProc x return [ printFileStr v_outfile (codeName x ++ " = "), printFileLn v_outfile v - ] ) (outputs $ codeSpec g) + ] ) (codeSpec g ^. outputsO) desc <- woFuncDesc mthd <- publicFuncProc woName void desc (map pcAuto parms) Nothing [block $ [ diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Parameters.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Parameters.hs index f3259460db..5b400945d1 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/Parameters.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/Parameters.hs @@ -11,7 +11,7 @@ import Language.Drasil.Choices (Structure(..), ConstantStructure(..), import Language.Drasil.Code.CodeQuantityDicts (inFileName, inParams, consts) import Language.Drasil.Code.Imperative.DrasilState (GenState, DrasilState(..), genICName) -import Language.Drasil.CodeSpec (CodeSpec(..), constraintvars, getConstraints) +import Language.Drasil.CodeSpec (HasOldCodeSpec(..), constraintvars, getConstraints) import Language.Drasil.Mod (Name) import Data.List (nub, (\\), delete) @@ -56,7 +56,7 @@ getInputFormatOuts :: GenState [CodeVarChunk] getInputFormatOuts = do g <- get giName <- genICName GetInput - getParams giName Out $ extInputs $ codeSpec g + getParams giName Out $ codeSpec g ^. extInputsO -- | The inputs to the function for calculating derived inputs are any variables -- used in the equations for the derived inputs. @@ -64,8 +64,8 @@ getDerivedIns :: GenState [CodeVarChunk] getDerivedIns = do g <- get let s = codeSpec g - dvals = derivedInputs s - reqdVals = concatMap (flip codevars (sysinfodb s) . (^. codeExpr)) dvals + dvals = s ^. derivedInputsO + reqdVals = concatMap (flip codevars (s ^. sysinfodbO) . (^. codeExpr)) dvals dvName <- genICName DerivedValuesFn getParams dvName In reqdVals @@ -74,7 +74,7 @@ getDerivedOuts :: GenState [CodeVarChunk] getDerivedOuts = do g <- get dvName <- genICName DerivedValuesFn - getParams dvName Out $ map codeChunk $ derivedInputs $ codeSpec g + getParams dvName Out $ map codeChunk $ codeSpec g ^. derivedInputsO -- | The parameters to the function for checking constraints on the inputs are -- any inputs with constraints, and any variables used in the expressions of @@ -82,9 +82,10 @@ getDerivedOuts = do getConstraintParams :: GenState [CodeVarChunk] getConstraintParams = do g <- get - let cm = cMap $ codeSpec g - db = sysinfodb $ codeSpec g - varsList = filter (\i -> member (i ^. uid) cm) (inputs $ codeSpec g) + let s = codeSpec g + cm = s ^. cMapO + db = s ^. sysinfodbO + varsList = filter (\i -> member (i ^. uid) cm) (s ^. inputsO) reqdVals = nub $ varsList ++ map quantvar (concatMap (`constraintvars` db) (getConstraints cm varsList)) icName <- genICName InputConstraintsFn @@ -96,14 +97,14 @@ getCalcParams :: CodeDefinition -> GenState [CodeVarChunk] getCalcParams c = do g <- get getParams (codeName c) In $ delete (quantvar c) $ concatMap (`codevars'` - (sysinfodb $ codeSpec g)) (c ^. codeExpr : c ^. auxExprs) + (codeSpec g ^. sysinfodbO)) (c ^. codeExpr : c ^. auxExprs) -- | The parameters to the function for printing outputs are the outputs. getOutputParams :: GenState [CodeVarChunk] getOutputParams = do g <- get woName <- genICName WriteOutput - getParams woName In $ outputs $ codeSpec g + getParams woName In $ codeSpec g ^. outputsO -- | Passes parameters that are inputs to 'getInputVars' for further processing. -- Passes parameters that are constants to 'getConstVars' for further processing. @@ -113,9 +114,10 @@ getParams :: (Quantity c, MayHaveUnit c) => Name -> ParamType -> [c] -> GenState [CodeVarChunk] getParams n pt cs' = do g <- get - let cs = map quantvar cs' - ins = inputs $ codeSpec g - cnsnts = map quantvar $ constants $ codeSpec g + let s = codeSpec g + cs = map quantvar cs' + ins = s ^. inputsO + cnsnts = map quantvar $ s ^. constantsO inpVars = filter (`elem` ins) cs conVars = filter (`elem` cnsnts) cs csSubIns = filter ((`notMember` concMatches g) . (^. uid)) diff --git a/code/drasil-docLang/lib/Drasil/DocumentLanguage.hs b/code/drasil-docLang/lib/Drasil/DocumentLanguage.hs index f14b57cfa9..041971d04b 100644 --- a/code/drasil-docLang/lib/Drasil/DocumentLanguage.hs +++ b/code/drasil-docLang/lib/Drasil/DocumentLanguage.hs @@ -66,8 +66,8 @@ import Drasil.Sections.ReferenceMaterial (emptySectSentPlu) -- * Main Function -- | Creates a document from a document description, a title combinator function, and system information. mkDoc :: SRSDecl -> (IdeaDict -> IdeaDict -> Sentence) -> SystemInformation -> Document -mkDoc dd comb si@SI {_sys = sys, _kind = kind, _authors = authors} = - Document (nw kind `comb` nw sys) (foldlList Comma List $ map (S . name) authors) (findToC l) $ +mkDoc dd comb si@SI {_sys = sys, _kind = kind, _authors = docauthors} = + Document (nw kind `comb` nw sys) (foldlList Comma List $ map (S . name) docauthors) (findToC l) $ mkSections fullSI l where fullSI = fillcdbSRS dd si l = mkDocDesc fullSI dd diff --git a/code/drasil-gen/lib/Language/Drasil/Generate.hs b/code/drasil-gen/lib/Language/Drasil/Generate.hs index 7bde607f5e..7ec2185cf8 100644 --- a/code/drasil-gen/lib/Language/Drasil/Generate.hs +++ b/code/drasil-gen/lib/Language/Drasil/Generate.hs @@ -28,8 +28,8 @@ import Language.Drasil.Printers (DocType(SRS, Website, Lesson), makeCSS, genHTML genTeX, Format(TeX, HTML, Jupyter, MDBook), genJupyter, genMDBook, PrintingInformation, outputDot, makeBook, makeRequirements) import Language.Drasil.Code (generator, generateCode, generateCodeProc, - Choices(..), CodeSpec(..), Lang(..), getSampleData, readWithDataDesc, - sampleInputDD, unPP, unJP, unCSP, unCPPP, unSP, unJLP) + Choices(..), CodeSpec(..), HasOldCodeSpec(..), Lang(..), + getSampleData, readWithDataDesc, sampleInputDD, unPP, unJP, unCSP, unCPPP, unSP, unJLP) import Language.Drasil.Output.Formats(Filename, DocSpec(DocSpec), DocChoices(DC)) import Language.Drasil.TypeCheck @@ -37,6 +37,7 @@ import Language.Drasil.Dump import Drasil.GOOL (unJC, unPC, unCSC, unCPPC, unSC) import Drasil.GProc (unJLC) +import Control.Lens ((^.)) -- | Generate a number of artifacts based on a list of recipes. gen :: DocSpec -> Document -> PrintingInformation -> IO () @@ -160,7 +161,7 @@ genCode chs spec = do workingDir <- getCurrentDirectory time <- getCurrentTime sampData <- maybe (return []) (\sd -> readWithDataDesc sd $ sampleInputDD - (extInputs spec)) (getSampleData chs) + (spec ^. extInputsO)) (getSampleData chs) createDirectoryIfMissing False "src" setCurrentDirectory "src" let genLangCode Java = genCall Java unJC unJP diff --git a/code/drasil-sysinfo/lib/SysInfo/Drasil.hs b/code/drasil-sysinfo/lib/SysInfo/Drasil.hs index 69c7ea0b1f..e470f690c9 100644 --- a/code/drasil-sysinfo/lib/SysInfo/Drasil.hs +++ b/code/drasil-sysinfo/lib/SysInfo/Drasil.hs @@ -1,8 +1,8 @@ module SysInfo.Drasil ( -- * System Information - SystemInformation(..), Block(Parallel), sysinfodb + SystemInformation(..), Block(Parallel) -- * Lenses - , purpose, background, scope, motivation + , HasSystemInformation(..) -- * Reference Database , ReferenceDB, RefMap, Purpose, Background, Scope, Motivation , citeDB, rdb, simpleMap, citationDB, conceptDB diff --git a/code/drasil-website/lib/Drasil/Website/CaseStudy.hs b/code/drasil-website/lib/Drasil/Website/CaseStudy.hs index ad4ee17f7f..4d2b1fd70a 100644 --- a/code/drasil-website/lib/Drasil/Website/CaseStudy.hs +++ b/code/drasil-website/lib/Drasil/Website/CaseStudy.hs @@ -4,7 +4,7 @@ module Drasil.Website.CaseStudy where import Language.Drasil hiding (E, Var) -import Language.Drasil.Code +import Language.Drasil.Code hiding (CS) import SysInfo.Drasil import Drasil.GOOL (CodeType(..))