[m-rev.] For review: use XML browser to browse terms in mdb
Ian MacLarty
maclarty at cs.mu.OZ.AU
Fri Dec 10 14:59:51 AEDT 2004
On Fri, Dec 10, 2004 at 03:04:41AM +1100, Julien Fischer wrote:
> > Allow terms to be saved as XML in mdb and allow an XML browser to be invoked on
> > browsable objects in mdb. The user can set two options which control where the
> > XML is dumped and the command used to browse the XML. The defaults assume
> > xsltproc and mozilla are installed.
> >
> You could get configure to check if they are. What happens if they are
> not?
>
You would just get whatever error the shell would give you and be returned to
mdb.
I've made configure look for mozilla or firefox as well as xsltproc:
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.407
diff -u -r1.407 configure.in
--- configure.in 5 Dec 2004 15:53:09 -0000 1.407
+++ configure.in 10 Dec 2004 03:24:10 -0000
@@ -3808,6 +3808,30 @@
MERCURY_CHECK_READLINE
#-----------------------------------------------------------------------------#
+#-----------------------------------------------------------------------------#
+# Check for a XUL browser and xslrproc and if we find both then set the
+# default xml_browser_command and xml_tmp_filename mdb options.
+#
+
+AC_PATH_PROGS(XUL_BROWSER, firefox mozilla, "")
+
+AC_PATH_PROGS(XSLTPROC, xsltproc, "")
+
+if test "$XUL_BROWSER" != "" && test "$XSLTPROC" != ""; then
+ DEFAULT_XML_BROWSER_CMD="$XSLTPROC $DEFAULT_MERCURY_DEBUGGER_INIT_DIR/xul_tree.xsl /tmp/mdbtmp.xml > /tmp/mdbtmp.xul && $XUL_BROWSER file:///tmp/mdbtmp.xul"
+ DEFAULT_XML_TMP_FILENAME="/tmp/mdbtmp.xml"
+else
+ DEFAULT_XML_BROWSER_CMD=""
+ DEFAULT_XML_TMP_FILENAME=""
+fi
+
+AC_SUBST(DEFAULT_XML_BROWSER_CMD)
+AC_SUBST(DEFAULT_XML_TMP_FILENAME)
+
+#-----------------------------------------------------------------------------#
+
+
+
Then I've changed mdbrc.in to use mozilla and xsltproc if they're available:
Index: mdbrc.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mdbrc.in,v
retrieving revision 1.4
diff -u -r1.4 mdbrc.in
--- mdbrc.in 19 Jul 2000 01:35:01 -0000 1.4
+++ mdbrc.in 10 Dec 2004 03:26:21 -0000
@@ -15,3 +15,5 @@
alias e exception
alias EMPTY step
alias NUMBER step
+set xml_browser_cmd '@DEFAULT_XML_BROWSER_CMD@'
+set xml_tmp_filename '@DEFAULT_XML_TMP_FILENAME@'
And I've also changed mercury_trace_internal.c to display a more useful error
message if either xml_tmp_filename or xml_browser_cmd are not set.
> > browser/browse.m
> > Add a predicate to save a browser term as XML to a file.
> >
> > doc/user_guide.texi
> > Document new --xml option for the mdb `browse' command.
> > Document new --xml option for the mdb `save_to_file' command.
> > Document the `set xml_tmp_filename' and `set xml_browser_cmd' commands.
> >
> > scripts/Mmakefile
> > Copy extras/xml_stylesheets/xul_tree.xsl to the mdb install
> > directory so it can be used by the default XML browser command.
> >
> It would be preferable if any stylesheets needed by the debugger lived
> in the browser directory not in extras (perhaps in a subdirectory of the
> browser directory).
>
I don't really see that as a problem as extras is part of the same cvs module.
The xul_tree.xsl stylesheet is not really part of the browser - it's just
an example stylesheet that can be used to browse terms if you have a XUL
browser.
> If I have my own stylesheet is there a way to tell the debugger to use
> that rather than the one above? (I think you partially address this
> in the changes to the user guide but it's not entirely clear how I would go
> about this).
>
There is no place where you explicitly tell mdb what stylesheet you want to
use. This is all done by the command you tell mdb to execute to invoke the
browser.
I've changed the xml_browser_cmd doc to:
@samp{xml_browser_cmd} is the shell command(s) used to invoke your XML browser.
If you want a stylesheet to be applied to the XML before the browser is invoked
then you should do that in this command using the appropriate program (such as
xsltproc). By default if xsltproc and mozilla (or firefox) are available,
xsltproc is invoked to apply the xul_tree.xsl stylesheet in
extras/xml_stylesheets, then mozilla is invoked on the resulting XUL file.
@sp 1
You can use the apostrophe character (') to quote the command string when using
the @samp{set} command, for example "set xml_browser_cmd 'firefox
file:///tmp/mdbtmp.xml'".
Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list