Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
curry-packages
spicey
Commits
c5ae0e38
Commit
c5ae0e38
authored
Jan 25, 2018
by
Michael Hanus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code refactoring
parent
2fb8b418
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
24 deletions
+15
-24
src/Spicey/GenerationHelper.curry
src/Spicey/GenerationHelper.curry
+8
-16
src/Spicey/ViewGeneration.curry
src/Spicey/ViewGeneration.curry
+7
-8
No files found.
src/Spicey/GenerationHelper.curry
View file @
c5ae0e38
...
...
@@ -262,22 +262,14 @@ hasDateAttribute = any isDate
_ -> False
combinator :: Int -> QName
combinator n =
case n of
0 -> error "GenerationHelper.combinator: empty attribute list"
1 -> error "GenerationHelper.combinator: no combinator for list of length 1"
2 -> (wui "wPair")
3 -> (wui "wTriple")
4 -> (wui "w4Tuple")
5 -> (wui "w5Tuple")
6 -> (wui "w6Tuple")
7 -> (wui "w7Tuple")
8 -> (wui "w8Tuple")
9 -> (wui "w9Tuple")
10 -> (wui "w10Tuple")
11 -> (wui "w11Tuple")
12 -> (wui "w12Tuple")
_ -> error "GenerationHelper.combinator: attribute list too long"
combinator n
| n==0 = error "GenerationHelper.combinator: empty attribute list"
| n==1
= error "GenerationHelper.combinator: no combinator for list of length 1"
| n>14 = error "GenerationHelper.combinator: attribute list too long"
| n==2 = (wui "wPair")
| n==3 = (wui "wTriple")
| otherwise = (wui $ "w" ++ show n ++ "Tuple")
-- Associate to each attribute of the argument list a WUI specification
-- as an abstract Curry program
...
...
src/Spicey/ViewGeneration.curry
View file @
c5ae0e38
...
...
@@ -44,7 +44,7 @@ wuiSpec erdname (Entity entityName attrlist) relationships allEntities =
manyToManyEntities = manyToMany allEntities (Entity entityName attrlist)
manyToOneEntities = manyToOne (Entity entityName attrlist) relationships
argumentCount = length attrlist + length manyToOneEntities
+ length manyToManyEntities
+ length manyToManyEntities
in
stCmtFunc
("The WUI specification for the entity type "++entityName++".\n"++
...
...
@@ -65,13 +65,12 @@ wuiSpec erdname (Entity entityName attrlist) relationships allEntities =
head (attrWidgets attrlist)
else
applyF (combinator argumentCount)
(
(attrWidgets attrlist) ++
(map (\e -> applyF (wui "wSelect")
( attrWidgets attrlist ++
map (\e -> applyF (wui "wSelect")
[constF (erdname, lowerFirst e++"ToShortView"),
CVar (1, lowerFirst $ e ++ "List")])
manyToOneEntities
)
++
(
map (\e ->
manyToOneEntities ++
map (\e ->
applyF (wui "wMultiCheckSelect")
[CLambda [CPVar (1, lowerFirst e)]
(list2ac [
...
...
@@ -80,8 +79,8 @@ wuiSpec erdname (Entity entityName attrlist) relationships allEntities =
[CVar (1, lowerFirst e)]
]]),
CVar (1, lowerFirst $ e ++ "List")
]) manyToManyEntities
)
)
]) manyToManyEntities
)
),
applyF (spiceyModule, "renderLabels")
[constF (entitiesToHtmlModule erdname,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment