summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraarne <unknown>2005-02-11 15:08:10 +0000
committeraarne <unknown>2005-02-11 15:08:10 +0000
commit1befa19e222c0c44142696e4aaf7d942ae348653 (patch)
tree001a79112a9de263f5f3b11677c8d8ea4a440f24
parentb90332065c022332eb7a8d0505ef737e925914a1 (diff)
command vg
-rw-r--r--src/GF/Shell.hs8
-rw-r--r--src/GF/Shell/PShell.hs3
-rw-r--r--src/GF/Shell/ShellCommands.hs1
-rw-r--r--src/HelpFile3
-rw-r--r--src/HelpFile.hs3
5 files changed, 17 insertions, 1 deletions
diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs
index c98adfb66..1874bc4d5 100644
--- a/src/GF/Shell.hs
+++ b/src/GF/Shell.hs
@@ -30,6 +30,7 @@ import GetTree
import ShellCommands
+import VisualizeGrammar (visualizeCanonGrammar, visualizeSourceGrammar)
import API
import IOGrammar
import Compile
@@ -244,6 +245,13 @@ execC co@(comm, opts0) sa@((st,(h,_)),a) = checkOptions st co >> case comm of
CPrintMultiGrammar -> do
sa' <- changeState purgeShellState sa
returnArg (AString (optPrintMultiGrammar opts cgr)) sa'
+ CShowGrammarGraph -> do
+ ---- sa' <- changeState purgeShellState sa
+ let g0 = writeFile "grphtmp.dot" $ visualizeCanonGrammar cgr
+ g1 = system "dot -Tps grphtmp.dot >grphtmp.ps"
+ g2 = system "gv grphtmp.ps &"
+ g3 = return () ---- system "rm -f grphtmp.*"
+ justOutput opts (g0 >> g1 >> g2 >> g3 >> return ()) sa
CPrintSourceGrammar ->
returnArg (AString (visualizeSourceGrammar src)) sa
diff --git a/src/GF/Shell/PShell.hs b/src/GF/Shell/PShell.hs
index 08ba2a4e1..dd797be5e 100644
--- a/src/GF/Shell/PShell.hs
+++ b/src/GF/Shell/PShell.hs
@@ -129,7 +129,8 @@ pCommand ws = case ws of
"pxs" : [] -> aUnit CPrintCanonXMLStruct
"px" : [] -> aUnit CPrintCanonXML
"pm" : [] -> aUnit CPrintMultiGrammar
- "sg" : [] -> aUnit CPrintSourceGrammar
+ "vg" : [] -> aUnit CShowGrammarGraph
+ "sg" : [] -> aUnit CPrintSourceGrammar
"po" : [] -> aUnit CPrintGlobalOptions
"pl" : [] -> aUnit CPrintLanguages
"h" : c : [] -> aUnit $ CHelp (Just (abbrevCommand c))
diff --git a/src/GF/Shell/ShellCommands.hs b/src/GF/Shell/ShellCommands.hs
index be1137440..c28bcad48 100644
--- a/src/GF/Shell/ShellCommands.hs
+++ b/src/GF/Shell/ShellCommands.hs
@@ -73,6 +73,7 @@ data Command =
| CPrintInformation I.Ident
| CPrintMultiGrammar
| CPrintSourceGrammar
+ | CShowGrammarGraph
| CPrintGramlet
| CPrintCanonXML
| CPrintCanonXMLStruct
diff --git a/src/HelpFile b/src/HelpFile
index 9c53ec498..4b54bd0a6 100644
--- a/src/HelpFile
+++ b/src/HelpFile
@@ -87,6 +87,9 @@ pm, print_multigrammar: pm
pm | wf Letter.gfcm -- print the grammar into the file Letter.gfcm
pm -printer=graph | wf D.dot -- then do 'dot -Tps D.dot > D.ps'
+vg, visualize_graph: vg
+ Show the dependency graph of multilingual grammar via dot and gv.
+
po, print_options: po
Print what modules there are in the state. Also
prints those flag values in the current state that differ from defaults.
diff --git a/src/HelpFile.hs b/src/HelpFile.hs
index 27d8e2551..94a479c58 100644
--- a/src/HelpFile.hs
+++ b/src/HelpFile.hs
@@ -116,6 +116,9 @@ txtHelpFile =
"\n pm | wf Letter.gfcm -- print the grammar into the file Letter.gfcm" ++
"\n pm -printer=graph | wf D.dot -- then do 'dot -Tps D.dot > D.ps'" ++
"\n" ++
+ "\nvg, visualize_graph: vg" ++
+ "\n Show the dependency graph of multilingual grammar via dot and gv." ++
+ "\n" ++
"\npo, print_options: po" ++
"\n Print what modules there are in the state. Also" ++
"\n prints those flag values in the current state that differ from defaults." ++