Skip to content

Commit

Permalink
Enable referencing for data types (#979)
Browse files Browse the repository at this point in the history
* Work In Progress

* Changes to previous commit as discussed in comments within the commit

* W.I.P Update with Section as record type and removal of HasShortName instance of Contents

* W.I.P adjusted relToQD and convertRel to take Label

* reduced errors in Utils.hs; still breaking (see #695 for error message and potential solutions)

* added Maybe Label field to RelationConcept

* update RefFromType temporarily to be the same as makeRef

* started adding labels to get past errors resulting from missing Labels

* continued work on adding labels to example

* made makeRA' and makeRA'' constructors; updated more examples to not break

* added labels to SSP references

* fixed typos (whoops)

* worked on getting past SSP when make is run for Label updates

* broken; added LabelledContent as a SecCons; started to implement datCon as LabelledContent instead of Contents

* updated some definitions to be of correct types; inlined labelled will need to be pulled out

* continued updating Contents use to LablledContent use

* made Label an instance of Referable class to allow use of just labels for referencing (removes some uses of missingP hack)

* updated SSP for PSD as labelledcontents

* continued work on DataConstraints section update; fixed some typos; added a crucial(?) fixme as a reminder

* created Labels.hs file for SWHS to avoid import cycles created from attempt to inter-reference TM and IM (removes another hack)

* continued work on labels/referencing for SWHS; new issues will be opened soon with regard to Fixmes

* removed use of refFromType that was causing errors from expecting Contents to have a Label

* work on SWHS continued; some errors removed that resulted from previous merge

* updated traceGIntro to not include text that is not related to SRS content

* WIP: clearing errors from SWHS

* finally breaks outside of SWHS (with uncomment of horrible swhsIMods' hack)

* started work on NoPCM; will be pausing work on this branch until yuzhi branch is merged in

* removed redundant imports; fixing up implementation to break where it was breaking before merge of master into this branch; adding labels to SSP

* removed decrepit code from SSP body; cleaned up import lists; working on getting make to run past SWHS

* removed duplicate function from SWHS; make now breaks in GamePhysics

* GamePhysics Tmods and References updated for labels

* GamePhysics Imodels updated for labels

* shortened lines of code in GamePhysics Body

* updating NoPCM and SWHS for label updates

* continuing work on label integration; breaking in GlassBR

* removed definition of ref from GlassBR TMods

* continued work on GlassBR

* continued work on getting examples to run through use of LabelledContent instead of Contents

* replaced testing1 function use with that of gbrIMods for referencing purposes

* GlassBR broken due to TheoryModels and referencing infrastructure

* temporarily commented out line causing error in GlassBR; cleaned up imports; moving onto SSP example

* cleaned up NoPCM asssumptions; Examples compile

* worked on rendering labels; still need to view if implementation works

* general definition implementation updated for LabelledContent type instead of Contents

* cleaned up some examples; updated some functions for Label updates

* running make now gets to logs after GlassBR is completely commented out in makefile

* removed appearance of fixmelabel0 in all logs; hardcoded missing "Table:" so that logs reduce slightly

* created DataDefinitions for HGHC example; no more occurrences of "fixmelabel4" in logs

* updated Tiny stable for changes made in previous commit

* updated Assumptions section to expect [LabelledContent] instead of [Contents]; need to determine why lay is being used instead of lay prime

* removed find' and acroTest

* reset makefile to not have commented out code

* updated examples for change made to assumpF; "fixmelabel8" no longer shows up in logs

* dataDefnF now expects [LabelledContent] instead of [Contents]; attempting to determine how to remove presence of "fixmelabel3" from logs

* removed hardcoded "LC"s as discussed in previous commit comment discussions; made IOrgSec accept a label instead of a section for referencing; removed accidentally added wreq.png file

* merge issue321 branch into addLabels

* removed errors and warnings so that original errors show up

* updated accessContents definitions as suggested

* started use of HasMaybeLabel instead of HasLabel for LabelledContent; broken

* made updates in files (some makeRef -> makeRefSec)

* updated definition of ModRow to use LabelledContent instead of Contents; mkIMField updated for these changes

* finished updated functions for new ModRow definition; occurrences of "fixmelabel3" in logs has reduced

* makefile revert

* updated inModel section generation to use LabelledContents; further reduces appearance of "fixmelabel3" in logs

* removed all appearances of "fixmelabel3" in logs

* removed missingP hack; relates to #374

* Fix the bug in symbol collecting.

* fixing errors that resulted from mrege; currently breaking in GlassBR

* GlassBR updated for merged implementation; working on compiling SWHS successfully

* multiple fixmes and some obsolete code removed from SWHS; SWHS now compiles; working on NoPCM

* NoPCM fixed; few fixmes worked on; working on Tiny example

* tiny example compiles; moving onto fixing SSP

* SSP example compiles; working on GamePhysics updates

* examples now compile

* removed datadefn from Drasil

* updated stable to be the same as it was before the merge of PR #962; removed some mkEmptyLabels from implementation

* small implementation fixes suggested in pr #962

* removed some mkEmptyLabel instances

* W.I.P. correcting generated

* removed some more mkEmptyLabel instances from implementation

* mkEmptyLabel removed from reldefn

* [Small PR] Improved GlassBR Code (#965)

* Moved functional_requirements_req6_pulledList as per #902

* Changed underscores in function names to camelCase in Body

* Changed is_safe1 and is_safe2 to is_safePb and is_safeLR

* removed a series of warnings in Drasil

* Attempt at assumption referencing in Chipmunk and make Glass compile

* replaced some empty labels with an UnlabelledContent where appropriate

* removed enumitem from stable that was accidentally reinserted (originally removed in PR #958)

* Creating mkRawLC to append prefixes to labels

* Finished mkRawLC

* removed decrepit RefAdd fields from RawContents

* fixed error; replaced one more instance of mkEmptyLabel

* Implementing mkRawLC for LikelyChanges

* Update stable?

* Removed '_Label' from labels in SWHS

* updated tiny stable equation labels, removed another mkEmptyLabel

* made labels of sections not have the same refadd and shortname; reduces "Sec:"-related discrepancies in the logs; reintroduced repUnd hack since its removal was causing unrelated discrepancies

* updated definition of ddefn' and mkRawLC; tiny log now empty

* updated Definitions.hs to use mkRawLC more; updated intro in CP to match that of manual version

* updated stable GamePhysics Assumptions to remove redundant 'A's in labels of some assumptions

* updated labels in TMods and IMods for GamePhysics to match stable

* slightly cleaned up implementation of mkRawLC

* Fixed Chipmunk Assumption links

* updated stable SSP netforce labels to match generated; fixed error from merge and removed some duplication from chipmunk

* W.I.P. reintroducing repUnd

* displays updated in stable to the desired output as mentioned in #970

* more updates in stable SSP for changes in label display

* reduced discrepancies in SSP_log

* Reduced Chipmunk log significantly

* Removed space in stable

* trivial updates to NoPCM SRS

* some trivial updates to stable; removal of the use of UID for labels for Requirement and Change LabelledContents

* Fix the symptom of #891. It does not fix the issue of ExprRelat itself, but may result in more relToQD being removed, so that the issue may become less important.

* updated stable for trivial updates in NoPCM stable

* Finished emptying Chipmunk log

* Updated SSP stable with equation labels

* more trivial updates to stable for NoPCM

* removed reldefn from Drasil completely; insuccessfully attempted to run GlassBR

* 1. improve error message for when things fail. 2. add defined_fun to definition too, just in case.

* Fixing SWSW log

* Make RelationConcept have a full Label (this is a bit of a hack, but since RelationConcept is likely to disappear, not so bad). Propagate this change throughout the code and the examples. Still not quite right, but it feels closer.

* some comments as to next steps

* cleaned up implementation of mkRawLC by creating setLabel function; implemented a function's use from makeRef; removes discrepancies occurring from underscores that were not being replaced with periods upon makeRef use

* removed refAdd field from Goal and PSD

* moved DType and makePairs for use in shortname setting hack; removed Data, Data', Theory that were causing import cycles with move (#926)

* implemented extra space after some shortname acronyms as mentioned in #970; logs need cleaning

* Corrected melfFrac issue in SWHS

* Updated Chipmunk stable

* Updated SSP stable

* Updated NoPCM stable except for 'Sec:' issue

* Generating different prefixes for Functional/Non-Functional requirements

* no longer exports lbl field for Goal or PhysSystDesc

* NoPCM stable updated for trivial fixes; refaddresses now no longer depend on UIDs of chunks for refaddresses

* minor typo fix

* Correcting SWHS log

* GlassBR compiles - updated Makefile and added missing quantities to gbInputs

* added RefType as a field to Label; feels like a very roundabout and messy implementation that I'd like some feedback on before propagating changes to remaining chunks

* Started clearing GlassBR log

* Fixed trivial diffs in GlassBR log

* label constructor created for AssumpChunk Labels; generated HTML list of assumptions currently has prepended A: that was asked about in issue #970

* SWHS log fixed

* reverted changes that caused A: to be appended to the shortname upon creation of label; fixed typo in NoPCM

* replaced mkLabelRA'' with mkLabelSame as suggested

* Updating stable for NoPCM log

* NoPCM stable update

* Completed NoPCM stable update

* implemented newer design implementation; <<loop>> error is back; looking into it

* replaced mkLabelRA'' with mkLabelSame as suggested

* implemented newer design implementation; <<loop>> error is back; looking into it

* Fix #961 loop issue (again). This had a different cause

* Remove tab characters and fix whitespace

* updated package version numbers and dependencies; working on logs

* removed obsolete mkLabelRA

* removed duplicate tags that were being printed with some refaddresses; continue to clear log

* removed unitToEmptyS function accidentally added

* workaround for traceability infrmation in reference addresses

* shortnames displayed with acronyms and spaces when appropriate (#970)

* GlassBR DDs' shortnames now appear in traceability matrices

* trivial updates made to stable versions of examples

* GlassBR now generates

* Fixed some referencing in SWHS and NoPCM

* Removed warnings

* R6 in glassbr now displayed in output; has a working link to it as well

* Removed warnings

* added reftype as a field to Label as a hack; clears logs; ready for merge to master

* Fixed GlassBR inputs hack

* Minor updates to Makefile
  • Loading branch information
niazim3 authored and JacquesCarette committed Aug 8, 2018
1 parent 04ef35f commit e6fc580
Show file tree
Hide file tree
Showing 103 changed files with 2,392 additions and 2,375 deletions.
30 changes: 15 additions & 15 deletions code/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
TINY_PREF = Tiny_
TINY_PREF = Tiny_
GLASS_PREF = GlassBR_
NoPCM_PREF = NoPCM_
SWHS_PREF = SWHS_
SSP_PREF = SSP_
GAME_PREF = Chipmunk_
SWHS_PREF = SWHS_
SSP_PREF = SSP_
GAME_PREF = Chipmunk_

TINY_DIR = Tiny
TINY_DIR = Tiny
GLASS_DIR = GlassBR
NoPCM_DIR = NoPCM
SWHS_DIR = SWHS
SSP_DIR = SSP
GAME_DIR = Chipmunk
SWHS_DIR = SWHS
SSP_DIR = SSP
GAME_DIR = Chipmunk

LANG_DIR = drasil-lang
CODE_DIR = drasil-code
Expand All @@ -20,12 +20,12 @@ DATA_DIR = drasil-data
DOCL_DIR = drasil-docLang
EXAM_DIR = drasil-example

TINY_EXE = tiny
GLASS_EXE= glassbr
NoPCM_EXE = nopcm
SWHS_EXE = swhs
SSP_EXE = ssp
GAME_EXE = chipmunkdocs
TINY_EXE = tiny
GLASS_EXE = glassbr
NoPCM_EXE = nopcm
SWHS_EXE = swhs
SSP_EXE = ssp
GAME_EXE = chipmunkdocs

DIRS = $(TINY_DIR) $(GLASS_DIR) $(NoPCM_DIR) $(SWHS_DIR) $(SSP_DIR) $(GAME_DIR) $(DATA_DIR) $(LANG_DIR) $(DOCL_DIR) $(EXAM_DIR) $(CODE_DIR) $(GEN_DIR) $(PRINT_DIR)
DIFF = diff --strip-trailing-cr --ignore-all-space
Expand Down Expand Up @@ -194,4 +194,4 @@ clean_build: clean_logs
- rm -r ./build

clean_logs:
- rm *.log
- rm *.log
14 changes: 8 additions & 6 deletions code/drasil-code/Language/Drasil/CodeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ codeSpec (SI {_sys = sys
let inputs' = map codevar ins
const' = map qtov constants
derived = map qtov $ getDerivedInputs ddefs defs' inputs' const' db
rels = (map qtoc (defs'++(map qdFromDD ddefs))) \\ derived
rels = (map qtoc ({-defs'++-}(map qdFromDD ddefs))) \\ derived
mods' = prefixFunctions $ (packmod "Calculations" $ map FCD rels):ms
mem = modExportMap mods' inputs' const'
outs' = map codevar outs
Expand Down Expand Up @@ -147,11 +147,11 @@ defaultChoices = Choices {
type Name = String

-- medium hacks ---
relToQD :: (ExprRelat c, HasShortName c, HasSymbolTable ctx) => ctx -> c -> QDefinition
relToQD sm r = convertRel sm (r ^. relat) (shortname r)
relToQD :: (ExprRelat c, HasLabel c, HasSymbolTable ctx) => ctx -> c -> QDefinition
relToQD sm r = convertRel sm (r ^. relat) (r ^. getLabel)

convertRel :: (HasSymbolTable ctx) => ctx -> Expr -> ShortName -> QDefinition
convertRel sm (BinaryOp Eq (C x) r) sn = ec (symbLookup x (sm ^. symbolTable)) r sn
convertRel :: (HasSymbolTable ctx) => ctx -> Expr -> Label -> QDefinition
convertRel sm (BinaryOp Eq (C x) r) lbe = ec (symbLookup x (sm ^. symbolTable)) r lbe
convertRel _ _ _ = error "Conversion failed"

data Mod = Mod Name [Func]
Expand Down Expand Up @@ -316,7 +316,9 @@ getExecOrder d k' n' sm = getExecOrder' [] d k' (n' \\ k')
kNew = k ++ cnew
nNew = n \\ cnew
in if null new
then error "Cannot find path from inputs to outputs"
then error ("Cannot find path from inputs to outputs: " ++ (show $ map (^. uid) n)
++ " given Defs as " ++ (show $ map (^. uid) defs')
++ " and Knowns as " ++ (show $ map (^. uid) k) )
else getExecOrder' (ord ++ new) (defs' \\ new) kNew nNew

subsetOf :: (Eq a) => [a] -> [a] -> Bool
Expand Down
2 changes: 1 addition & 1 deletion code/drasil-code/drasil-code.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ library
split >= 0.2.3.1,
MissingH >= 1.4.0.1,
parsec >= 3.1.9,
drasil-lang >= 0.1.6
drasil-lang >= 0.1.17
default-language: Haskell2010
ghc-options: -Wall -O2

Expand Down
20 changes: 19 additions & 1 deletion code/drasil-data/Data/Drasil/Citations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,31 @@ import Data.Drasil.Software.Products (sciCompS)
campidelli, koothoor2013, parnasClements1986, smithLai2005 :: Citation

campidelli = cBooklet "campidelli"
(S "Glass-BR Software for the design and risk assessment of glass facades subjected to blast loading") [author [mCampidelli]]
(S "Glass-BR Software for the design and risk assessment of glass facades subjected to blast loading")
[author [mCampidelli]]
campidelliLabel
where
campidelliLabel :: Label
campidelliLabel = mkLabelRA' "campidelliLabel" "campidelli" Cite

koothoor2013 =
cMThesis "koothoor2013" [nKoothoor]
(S "A document drive approach to certifying" +:+ phrase sciCompS)
(S "McMaster University") 2013 [address (S "Hamilton, ON, Canada")]
koothoor2013Label
where
koothoor2013Label :: Label
koothoor2013Label = mkLabelRA' "koothoor2013Label" "koothoor2013" Cite

parnasClements1986 = cArticle "parnasClements1986" [dParnas, pcClements]
(S "A rational design process: How and why to fake it")
(S "IEEE Transactions on Software Engineering") 1986
[month Feb, volume 12, number 2, pages [251,257], address (S "Washington, USA")]
parnasClements1986Label
where
parnasClements1986Label :: Label
parnasClements1986Label = mkLabelRA' "parnasClements1986Label" "parnasClements1986" Cite


smithLai2005 = cInProceedings "smithLai2005" [spencerSmith, lLai]
(S "A new requirements template for scientific computing")
Expand All @@ -35,6 +49,10 @@ smithLai2005 = cInProceedings "smithLai2005" [spencerSmith, lLai]
, pages [107,121],
note (S "In conjunction with 13th IEEE International Requirements" +:+
S "Engineering Conference,")]
smithLai2005Label
where
smithLai2005Label :: Label
smithLai2005Label = mkLabelRA' "smithLai2005Label" "smithLai2005" Cite

------------------------
-- COMMON CITE-FIELDS --
Expand Down
3 changes: 2 additions & 1 deletion code/drasil-data/Data/Drasil/Concepts/Documentation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ year = nc "year" (cn' "year" )


orgOfDoc, prpsOfDoc, refmat, scpOfReq, consVals,
termAndDef, tOfSymb, traceyMandG, corSol, charOfIR, propOfCorSol, vav :: NamedChunk
termAndDef, tOfSymb, traceyMandG, corSol, charOfIR, propOfCorSol,
vav :: NamedChunk

corSol = nc "corSol" (cn' "correct solution")
charOfIR = nc "charOfIR" (characteristic `of__` intReader)
Expand Down
6 changes: 3 additions & 3 deletions code/drasil-data/Data/Drasil/SentenceStructures.hs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ tableShows ref trailing = (mkRefFrmLbl ref) +:+ S "shows the" +:+

-- | Function that creates (a label for) a figure
--FIXME: Is `figureLabel` defined in the correct file?
figureLabel :: NamedIdea c => Int -> c -> Sentence -> [Char]-> String -> LabelledContent
figureLabel num traceyMG contents filePath rn = llcc (mkLabelRA'' rn) $
figureLabel :: NamedIdea c => Int -> c -> Sentence -> [Char] -> String -> LabelledContent
figureLabel num traceyMG contents filePath rn = llcc (mkLabelRAFig rn) $
Figure (titleize figure +:
(S (show num)) +:+ (showingCxnBw traceyMG contents)) filePath 100 rn
(S (show num)) +:+ (showingCxnBw traceyMG contents)) filePath 100

showingCxnBw :: NamedIdea c => c -> Sentence -> Sentence
showingCxnBw traceyVar contents = titleize traceyVar +:+ S "Showing the" +:+
Expand Down
19 changes: 6 additions & 13 deletions code/drasil-data/Data/Drasil/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module Data.Drasil.Utils
, zipSentList
, makeTMatrix
, itemRefToSent
, refFromType
, noRefs
, noRefsLT
, makeListRef
Expand Down Expand Up @@ -37,8 +36,8 @@ import Data.Drasil.Concepts.Math (unit_)
eqUnR :: Expr -> Label -> LabelledContent
eqUnR e lbl = llcc lbl $ EqnBlock e

eqUnR' :: Label -> Expr -> LabelledContent
eqUnR' lbl e = llcc lbl $ EqnBlock e
eqUnR' :: Expr -> Contents
eqUnR' e = UlC $ ulcc $ EqnBlock e

-- | fold helper functions applies f to all but the last element, applies g to
-- last element and the accumulator
Expand Down Expand Up @@ -106,23 +105,18 @@ makeTMatrix colName col row = zipSentList [] colName [zipFTable [] x row | x <-

-- | takes a list of wrapped variables and creates an Input Data Table for uses in Functional Requirments
mkInputDatTb :: (Quantity a) => [a] -> LabelledContent
mkInputDatTb inputVar = llcc (mkLabelRA'' "inDataTable") $
mkInputDatTb inputVar = llcc (mkLabelSame "inDataTable" Tab) $
Table [titleize symbol_, titleize unit_,
S "Name"]
(mkTable [ch , fmtU EmptyS, phrase] inputVar)
(S "Required" +:+ titleize' input_) True "inDataTable"
(S "Required" +:+ titleize' input_) True

-- | makes sentences from an item and its reference
-- a - String title of reference
-- b - Sentence containing the full reference
itemRefToSent :: String -> Sentence -> Sentence
itemRefToSent a b = S a +:+ sParen b

-- | refFromType takes a function and returns a reference sentence
--FIXME: will be removed when labels are added to all data types
refFromType :: (a -> DType) -> a -> Sentence
refFromType f = makeRef . llcc mkEmptyLabel . Definition . f

-- | makeListRef takes a list and a reference and generates references to
-- match the length of the list
-- l - list whos length is to be matched
Expand Down Expand Up @@ -171,7 +165,6 @@ noRefsLT :: [(Sentence, ItemType)] -> [ListTuple]
noRefsLT a = uncurry zip3 (unzip a) $ repeat Nothing

prodUCTbl :: [[Sentence]] -> LabelledContent
prodUCTbl cases = llcc (mkLabelRA'' "useCaseTable") $ --FIXME: do we want labels across examples to be unique?
prodUCTbl cases = llcc (mkLabelSame "useCaseTable" Tab) $ --FIXME: do we want labels across examples to be unique?
Table [S "Actor", titleize input_ +:+ S "and" +:+ titleize output_]
cases
(titleize useCaseTable) True "useCaseTable"
cases (titleize useCaseTable) True
4 changes: 2 additions & 2 deletions code/drasil-data/drasil-data.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: drasil-data
Version: 0.1.4
Version: 0.1.5
Cabal-Version: >= 1.18
Author: Dan Szymczak, Steven Palmer, Jacques Carette, Spencer Smith
build-type: Simple
Expand Down Expand Up @@ -45,7 +45,7 @@ library
MissingH >= 1.4.0.1,
parsec >= 3.1.9,
data-fix (>= 0.0.4 && <= 1.0),
drasil-lang >= 0.1.6
drasil-lang >= 0.1.17
default-language: Haskell2010
ghc-options: -Wall

Expand Down
8 changes: 4 additions & 4 deletions code/drasil-docLang/Drasil/DocLang.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Drasil.DocLang (
TSIntro(..), UCsSec(..), mkDoc, mkLklyChnk, mkRequirement,
mkUnLklyChnk, srsDomains, tsymb, tsymb'', mkConCC, mkConCC', mkEnumCC,
-- DocumentLanguage.Definitions
Field(..), Fields, InclUnits(IncludeUnits), Verbosity(Verbose),
Field(..), Fields, InclUnits(IncludeUnits), Verbosity(Verbose), ddefn',
-- DocumentLanguage.RefHelpers
ModelDB, cite, ddRefDB, mdb, refA, refDD,
-- DocumentLanguage.TraceabilityMatrix
Expand All @@ -30,7 +30,7 @@ module Drasil.DocLang (
siUQI, siUQO,
-- Sections.SpecificSystemDescription
assumpF, dataConstraintUncertainty, dataDefnF, goalStmtF, inDataConstTbl,
inModelF, outDataConstTbl, physSystDesc, probDescF, specSysDescr, termDefnF,
inModelF, outDataConstTbl, physSystDesc, probDescF, termDefnF, specSysDescr,
-- Sections.Stakeholders
-- Sections.TableOfAbbAndAcronyms
-- Sections.TableOfSymbols
Expand All @@ -50,7 +50,7 @@ import Drasil.DocumentLanguage (AppndxSec(..), AuxConstntSec(..),
mkLklyChnk, mkRequirement, mkUnLklyChnk, srsDomains, tsymb, tsymb'', mkConCC, mkConCC',
mkEnumCC)
import Drasil.DocumentLanguage.Definitions (Field(..), Fields,
InclUnits(IncludeUnits), Verbosity(Verbose))
InclUnits(IncludeUnits), Verbosity(Verbose), ddefn')
import Drasil.DocumentLanguage.RefHelpers (ModelDB, cite, ddRefDB, mdb, refA,
refDD)
--import Drasil.DocumentLanguage.TraceabilityMatrix
Expand All @@ -64,7 +64,7 @@ import Drasil.Sections.SolutionCharacterSpec (SubSec, assembler, sSubSec, siCon,
siDDef, siIMod, siSTitl, siSent, siTMod, siUQI, siUQO)
import Drasil.Sections.SpecificSystemDescription (assumpF,
dataConstraintUncertainty, dataDefnF, goalStmtF, inDataConstTbl, inModelF,
outDataConstTbl, physSystDesc, probDescF, specSysDescr, termDefnF)
outDataConstTbl, physSystDesc, probDescF, termDefnF, specSysDescr)
--import Drasil.Sections.Stakeholders
--import Drasil.Sections.TableOfAbbAndAcronyms
--import Drasil.Sections.TableOfSymbols
Expand Down
84 changes: 42 additions & 42 deletions code/drasil-docLang/Drasil/DocLang/SRS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Drasil.DocLang.SRS
physSystLabel, datConLabel, genDefnLabel, thModelLabel, dataDefnLabel,
inModelLabel, likeChgLabel, tOfSymbLabel, valsOfAuxConsLabel, referenceLabel,
indPRCaseLabel, unlikeChgLabel, assumptLabel, funcReqLabel,
tOfSymb, srsDom) where
tOfSymb, srsDom, solCharSpecLabel) where
--Temporary file for keeping the "srs" document constructor until I figure out
-- a better place for it. Maybe Data.Drasil or Language.Drasil.Template?

Expand Down Expand Up @@ -64,71 +64,71 @@ userChar cs ss = section' (titleize' Doc.userCharacteristic) cs ss "UserCha
sysCon cs ss = section' (titleize' Doc.systemConstraint) cs ss "SysConstraints"

scpOfTheProj cs ss = section' (at_start (Doc.scpOfTheProj titleize)) cs ss "ProjScope"
prodUCTable cs ss = section' (titleize Doc.prodUCTable) cs ss "UseCaseTable"
indPRCase cs ss = section' (titleize' Doc.indPRCase) cs ss "IndividualProdUC" --FIXME: label is available
prodUCTable cs ss = section' (titleize Doc.prodUCTable) cs ss "UseCaseTable"
indPRCase cs ss = section (titleize' Doc.indPRCase) cs ss indPRCaseLabel

specSysDes cs ss = section' (titleize Doc.specificsystemdescription) cs ss "SpecSystDesc"
probDesc cs ss = section' (titleize Doc.problemDescription) cs ss "ProbDesc"
termAndDefn cs ss = section' (titleize' Doc.termAndDef) cs ss "TermDefs"
termogy cs ss = section' (titleize Doc.terminology) cs ss "Terminology"
physSyst cs ss = section' (titleize Doc.physSyst) cs ss "PhysSyst" --FIXME: label is available
physSyst cs ss = section (titleize Doc.physSyst) cs ss physSystLabel
goalStmt cs ss = section' (titleize' Doc.goalStmt) cs ss "GoalStmt"
solCharSpec cs ss = section' (titleize Doc.solutionCharSpec) cs ss "SolCharSpec"
assumpt cs ss = section' (titleize' Doc.assumption) cs ss "Assumps" --FIXME: label is available
thModel cs ss = section' (titleize' Doc.thModel) cs ss "TMs" --FIXME: label is available
genDefn cs ss = section' (titleize' Doc.genDefn) cs ss "GDs" --FIXME: label is available
inModel cs ss = section' (titleize' Doc.inModel) cs ss "IMs" --FIXME: label is available
dataDefn cs ss = section' (titleize' Doc.dataDefn) cs ss "DDs" --FIXME: label is available
datCon cs ss = section' (titleize' Doc.datumConstraint) cs ss "DataConstraints" --FIXME: label is available
solCharSpec cs ss = section (titleize Doc.solutionCharSpec) cs ss solCharSpecLabel
assumpt cs ss = section (titleize' Doc.assumption) cs ss assumptLabel
thModel cs ss = section (titleize' Doc.thModel) cs ss thModelLabel
genDefn cs ss = section (titleize' Doc.genDefn) cs ss genDefnLabel
inModel cs ss = section (titleize' Doc.inModel) cs ss inModelLabel
dataDefn cs ss = section (titleize' Doc.dataDefn) cs ss dataDefnLabel
datCon cs ss = section (titleize' Doc.datumConstraint) cs ss datConLabel

propCorSol cs ss = section' (titleize' Doc.propOfCorSol) cs ss "CorSolProps"

require cs ss = section' (titleize' Doc.requirement) cs ss "Requirements"
nonfuncReq cs ss = section' (titleize' Doc.nonfunctionalRequirement) cs ss "NFRs"
funcReq cs ss = section' (titleize' Doc.functionalRequirement) cs ss "FRs" --FIXME: label is available
funcReq cs ss = section (titleize' Doc.functionalRequirement) cs ss funcReqLabel

likeChg cs ss = section' (titleize' Doc.likelyChg) cs ss "LCs" --FIXME: label is available
unlikeChg cs ss = section' (titleize' Doc.unlikelyChg) cs ss "UCs" --FIXME: label is available
likeChg cs ss = section (titleize' Doc.likelyChg) cs ss likeChgLabel
unlikeChg cs ss = section (titleize' Doc.unlikelyChg) cs ss unlikeChgLabel

traceyMandG cs ss = section' (titleize' Doc.traceyMandG) cs ss "TraceMatrices"
traceyMandG cs ss = section' (titleize' Doc.traceyMandG) cs ss "TraceMatrices"
valsOfAuxCons cs ss = section (titleize Doc.consVals) cs ss valsOfAuxConsLabel
appendix cs ss = section' (titleize Doc.appendix) cs ss "Appendix"

valsOfAuxCons cs ss = section' (titleize Doc.consVals) cs ss "AuxConstants" --FIXME: label is available

appendix cs ss = section' (titleize Doc.appendix) cs ss "Appendix"

reference cs ss = section' (titleize' Doc.reference) cs ss "References" --FIXME: label is available
reference cs ss = section (titleize' Doc.reference) cs ss referenceLabel
offShelfSol cs ss = section' (titleize' Doc.offShelfSolution) cs ss "ExistingSolns"

tOfSymb cs ss = section' (titleize Doc.tOfSymb) cs ss "ToS" --FIXME: label is available
tOfSymb cs ss = section (titleize Doc.tOfSymb) cs ss tOfSymbLabel

--Root SRS Domain
srsDom :: CommonConcept
srsDom = dcc' "srsDom" (Doc.srs ^. term) "srs" ""

--function that sets the shortname of each section to be the reference address
section' :: Sentence -> [Contents] -> [Section] -> RefAdd -> Section
section' a b c d = section a b c d (shortname' $ getStr a) --FIXME: getStr hack
section' :: Sentence -> [Contents] -> [Section] -> String -> Section
section' a b c d = section a b c (mkLabelRASec d (toString a))
where
getStr :: Sentence -> String
getStr (S s) = s
getStr ((:+:) s1 s2) = getStr s1 ++ getStr s2
getStr _ = error "Term is not a string"
toString :: Sentence -> String --FIXME: same as getStr hack, import instead?
toString (S x) = x
toString ((:+:) s1 s2) = toString s1 ++ toString s2
toString _ = error "Term is not a string"

--Labels--
--FIXME: create using section information somehow?
physSystLabel, datConLabel, genDefnLabel, thModelLabel, dataDefnLabel,
inModelLabel, likeChgLabel, tOfSymbLabel, valsOfAuxConsLabel, referenceLabel,
indPRCaseLabel, unlikeChgLabel, assumptLabel, funcReqLabel :: Label
physSystLabel = mkLabelRA "PhysSyst" "PhysSyst" "Physical System Description"
datConLabel = mkLabelRA'' "DataConstraints"
genDefnLabel = mkLabelRA'' "GDs"
thModelLabel = mkLabelRA'' "TMs"
dataDefnLabel = mkLabelRA "DDs" "DDs" "Data Definitions"
inModelLabel = mkLabelRA'' "IMs"
likeChgLabel = mkLabelRA'' "LCs"
unlikeChgLabel = mkLabelRA'' "UCs"
tOfSymbLabel = mkLabelRA'' "ToS"
valsOfAuxConsLabel = mkLabelRA "AuxConstants" "AuxConstants" "Values of Auxiliary Constants"
referenceLabel = mkLabelRA'' "References"
indPRCaseLabel = mkLabelRA "IndividualProdUC" "IndividualProdUC" "Individual Product Use Cases"
assumptLabel = mkLabelRA "Assumps" "Assumps" "Assumptions"
funcReqLabel = mkLabelRA "FRs" "FRs" "Functional Requirements"
indPRCaseLabel, unlikeChgLabel, assumptLabel, funcReqLabel, solCharSpecLabel :: Label
physSystLabel = mkLabelRASec "PhysSyst" "Physical System Description"
datConLabel = mkLabelRASec "DataConstraints" "Data Constraints"
genDefnLabel = mkLabelRASec "GDs" "General Definitions"
thModelLabel = mkLabelRASec "TMs" "Theoretical Models"
dataDefnLabel = mkLabelRASec "DDs" "Data Definitions"
inModelLabel = mkLabelRASec "IMs" "Instance Models"
likeChgLabel = mkLabelRASec "LCs" "Likely Changes"
unlikeChgLabel = mkLabelRASec "UCs" "Unlikely Changes"
tOfSymbLabel = mkLabelRASec "ToS" "Table of Symbols"
valsOfAuxConsLabel = mkLabelRASec "AuxConstants" "Values of Auxiliary Constants" --DO NOT CHANGE OR THINGS WILL BREAK -- see Language.Drasil.Document.Extract
referenceLabel = mkLabelRASec "References" "References"
indPRCaseLabel = mkLabelRASec "IndividualProdUC" "Individual Product Use Cases"
assumptLabel = mkLabelRASec "Assumps" "Assumptions"
funcReqLabel = mkLabelRASec "FRs" "Functional Requirements"
solCharSpecLabel = mkLabelRASec "SolCharSpec" "Solution Characteristics Specification"
Loading

0 comments on commit e6fc580

Please sign in to comment.