pg printnames

This commit is contained in:
aarne
2005-04-20 19:09:19 +00:00
parent 78108f7817
commit b60b42ccef
4 changed files with 29 additions and 12 deletions

View File

@@ -5,9 +5,9 @@
-- Stability : (stable) -- Stability : (stable)
-- Portability : (portable) -- Portability : (portable)
-- --
-- > CVS $Date: 2005/03/08 15:51:17 $ -- > CVS $Date: 2005/04/20 20:09:19 $
-- > CVS $Author: bringert $ -- > CVS $Author: aarne $
-- > CVS $Revision: 1.10 $ -- > CVS $Revision: 1.11 $
-- --
-- canonical GF. AR 10\/9\/2002 -- 9\/5\/2003 -- 21\/9 -- canonical GF. AR 10\/9\/2002 -- 9\/5\/2003 -- 21\/9
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
@@ -19,6 +19,7 @@ module GFC (Context,
CanonAbs, CanonAbs,
Info(..), Info(..),
Printname, Printname,
prPrintnamesGrammar,
mapInfoTerms, mapInfoTerms,
setFlag setFlag
) where ) where
@@ -69,3 +70,17 @@ mapInfoTerms f i = case i of
setFlag :: String -> String -> [Flag] -> [Flag] setFlag :: String -> String -> [Flag] -> [Flag]
setFlag n v fs = Flg (IC n) (IC v):[f | f@(Flg (IC n') _) <- fs, n' /= n] setFlag n v fs = Flg (IC n) (IC v):[f | f@(Flg (IC n') _) <- fs, n' /= n]
-- for Ha-Jo 20/2/2005
prPrintnamesGrammar :: CanonGrammar -> String
prPrintnamesGrammar gr = unlines $ filter (not . null) [prPrint j |
(_,M.ModMod m) <- M.modules gr,
M.isModCnc m,
j <- tree2list $ M.jments m
]
where
prPrint j = case j of
(c,CncCat _ _ p) -> "printname cat" +++ A.prt_ c +++ "=" +++ A.prt_ p
(c,CncFun _ _ _ p) -> "printname fun" +++ A.prt_ c +++ "=" +++ A.prt_ p
_ -> []

View File

@@ -5,9 +5,9 @@
-- Stability : (stable) -- Stability : (stable)
-- Portability : (portable) -- Portability : (portable)
-- --
-- > CVS $Date: 2005/02/18 19:21:13 $ -- > CVS $Date: 2005/04/20 20:09:19 $
-- > CVS $Author: peb $ -- > CVS $Author: aarne $
-- > CVS $Revision: 1.11 $ -- > CVS $Revision: 1.12 $
-- --
-- AR 7\/12\/1999 - 1\/4\/2000 - 10\/5\/2003 -- AR 7\/12\/1999 - 1\/4\/2000 - 10\/5\/2003
-- --
@@ -41,6 +41,7 @@ import qualified PrintGFC as C
import qualified AbsGFC as A import qualified AbsGFC as A
import Values import Values
import GrammarToSource import GrammarToSource
--- import GFC (CanonGrammar) --- cycle of modules
import Option import Option
import Ident import Ident

View File

@@ -5,9 +5,9 @@
-- Stability : (stable) -- Stability : (stable)
-- Portability : (portable) -- Portability : (portable)
-- --
-- > CVS $Date: 2005/04/18 14:55:33 $ -- > CVS $Date: 2005/04/20 20:09:19 $
-- > CVS $Author: peb $ -- > CVS $Author: aarne $
-- > CVS $Revision: 1.56 $ -- > CVS $Revision: 1.57 $
-- --
-- A database for customizable GF shell commands. -- A database for customizable GF shell commands.
-- --
@@ -240,6 +240,7 @@ customGrammarPrinter =
,(strCI "fullform",prFullForm . stateMorpho) ,(strCI "fullform",prFullForm . stateMorpho)
,(strCI "opts", prOpts . stateOptions) ,(strCI "opts", prOpts . stateOptions)
,(strCI "words", unwords . stateGrammarWords) ,(strCI "words", unwords . stateGrammarWords)
,(strCI "printnames", C.prPrintnamesGrammar . stateGrammarST)
{- ---- {- ----
(strCI "gf", prt . st2grammar . stateGrammarST) -- DEFAULT (strCI "gf", prt . st2grammar . stateGrammarST) -- DEFAULT
,(strCI "canon", showCanon "Lang" . stateGrammarST) ,(strCI "canon", showCanon "Lang" . stateGrammarST)

View File

@@ -4,9 +4,9 @@
-- Stability : (stable) -- Stability : (stable)
-- Portability : (portable) -- Portability : (portable)
-- --
-- > CVS $Date: 2005/04/17 17:29:51 $ -- > CVS $Date: 2005/04/20 20:09:19 $
-- > CVS $Author: aarne $ -- > CVS $Author: aarne $
-- > CVS $Revision: 1.8 $ -- > CVS $Revision: 1.9 $
-- --
-- chop an HTML file into separate files, each linked to the next and previous. -- chop an HTML file into separate files, each linked to the next and previous.
-- the names of the files are n-file, with n = 01,02,... -- the names of the files are n-file, with n = 01,02,...
@@ -64,7 +64,7 @@ separator = "<!-- NEW -->"
link :: FilePath -> Int -> Int -> String link :: FilePath -> Int -> Int -> String
link file mx n = link file mx n =
(if n >= mx then "" else (" <a href=\"" ++ file' ++ "\">Next</a>")) ++ (if n >= mx-1 then "" else (" <a href=\"" ++ file' ++ "\">Next</a>")) ++
(if n == 1 then "" else (" <a href=\"" ++ file_ ++ "\">Previous</a>")) ++ (if n == 1 then "" else (" <a href=\"" ++ file_ ++ "\">Previous</a>")) ++
(" <a href=\"" ++ file0 ++ "\">Contents</a>") ++ (" <a href=\"" ++ file0 ++ "\">Contents</a>") ++
(" <a href=\"" ++ file1 ++ "\">First</a>") ++ (" <a href=\"" ++ file1 ++ "\">First</a>") ++