mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-07 10:12:51 -06:00
define default depths for shell and server only once
This commit is contained in:
@@ -571,6 +571,8 @@ limit, depth :: CGI (Maybe Int)
|
||||
limit = readInput "limit"
|
||||
depth = readInput "depth"
|
||||
|
||||
default_depth_server = 4
|
||||
|
||||
start :: CGI Int
|
||||
start = maybe 0 id # readInput "start"
|
||||
|
||||
@@ -781,7 +783,7 @@ doRandom pgf mcat mdepth mlimit to =
|
||||
| tree <- limit trees]
|
||||
where cat = fromMaybe (PGF.startCat pgf) mcat
|
||||
limit = take (fromMaybe 1 mlimit)
|
||||
depth = fromMaybe 4 mdepth
|
||||
depth = fromMaybe default_depth_server mdepth
|
||||
|
||||
doGenerate :: PGF -> Maybe PGF.Type -> Maybe Int -> Maybe Int -> To -> JSValue
|
||||
doGenerate pgf mcat mdepth mlimit tos =
|
||||
@@ -794,7 +796,7 @@ doGenerate pgf mcat mdepth mlimit tos =
|
||||
trees = PGF.generateAllDepth pgf cat (Just depth)
|
||||
cat = fromMaybe (PGF.startCat pgf) mcat
|
||||
limit = take (fromMaybe 1 mlimit)
|
||||
depth = fromMaybe 4 mdepth
|
||||
depth = fromMaybe default_depth_server mdepth
|
||||
|
||||
doGrammar :: (UTCTime,PGF) -> Either IOError (UTCTime,l) -> Maybe (Accept Language) -> CGI CGIResult
|
||||
doGrammar (t1,pgf) elbls macc = out t $ showJSON $ makeObj
|
||||
|
||||
Reference in New Issue
Block a user