Commit aa3882f7 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2002-12-11 22:33:40 by cvscast] Empty log message

Original author: cvscast
Date: 2002-12-11 22:33:41+00:00
parent 9a656035
......@@ -292,66 +292,24 @@ let titles_concat = [bib]/<paper>_/<title>_/Char;;
"; ];;
let present = "<ul
><li
><a href=\"/cgi-bin/cduce?example=functions\"
>Functions.</a
>
let present = "<ul><li><a href=\"/cgi-bin/cduce?example=functions\">Functions.</a>
Several syntaxes to define functions.
</li
><li
><a href=\"/cgi-bin/cduce?example=mutrec\"
>Mutual recursion.</a
>
</li><li><a href=\"/cgi-bin/cduce?example=mutrec\">Mutual recursion.</a>
Mutual toplevel definition for types and functions.
</li
><li
><a href=\"/cgi-bin/cduce?example=seq\"
>Sequence literals.</a
>
</li><li><a href=\"/cgi-bin/cduce?example=seq\">Sequence literals.</a>
How to write sequences.
</li
><li
><a href=\"/cgi-bin/cduce?example=seqtypes\"
>Sequence types.</a
>
</li><li><a href=\"/cgi-bin/cduce?example=seqtypes\">Sequence types.</a>
Types for sequences.
</li
><li
><a href=\"/cgi-bin/cduce?example=integers\"
>The factorial function.</a
>
</li><li><a href=\"/cgi-bin/cduce?example=integers\">The factorial function.</a>
What about computing 10000! ?
</li
><li
><a href=\"/cgi-bin/cduce?example=sumtype\"
>Sum types.</a
>
</li><li><a href=\"/cgi-bin/cduce?example=sumtype\">Sum types.</a>
How to simulate ML sum types.
</li
><li
><a href=\"/cgi-bin/cduce?example=ovfun\"
>Overloaded functions.</a
>
</li><li><a href=\"/cgi-bin/cduce?example=ovfun\">Overloaded functions.</a>
This examples demonstrates the use of overloaded functions.
</li
><li
><a href=\"/cgi-bin/cduce?example=note\"
>Footnotes.</a
>
</li><li><a href=\"/cgi-bin/cduce?example=note\">Footnotes.</a>
This example shows how to bind an XML element with surrounding text.
</li
><li
><a href=\"/cgi-bin/cduce?example=biblio\"
>Bibliography.</a
>
</li><li><a href=\"/cgi-bin/cduce?example=biblio\">Bibliography.</a>
The good old XML bibliography example.
</li
><li
><a href=\"/cgi-bin/cduce?example=projection\"
>Projection.</a
>
</li><li><a href=\"/cgi-bin/cduce?example=projection\">Projection.</a>
Syntactic sugar for projection.
</li
></ul
>";;
\ No newline at end of file
</li></ul>";;
\ No newline at end of file
......@@ -43,60 +43,89 @@ let example code =
try List.assoc code Examples.examples
with Not_found -> ""
let begin_table =
"<table width='100%' border=0 cellspacing=0 cellpadding=2 bgcolor=black>
<tr><td>
<table width='100%' border=0 cellspacing=0 cellpadding=3 bgcolor=white>
<tr><td>"
let end_table = "</td></tr></table></td></tr></table><br>"
let begin_table = "<div class=\"box\">"
let end_table = "</div>"
let persistant = ref false
let session_id = ref ""
let (|||) p x = p x; p
let (||=) p () = ()
let html_header p =
p "<html><head><title>CDuce online prototype</title></head>";
p "<body bgcolor='#BBDDFF'>";
p begin_table;
p "<h1>CDuce online prototype</h1>";
p end_table;
p "
<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html>
<head>
<meta content=\"text/html; charset=iso-8859-1\"
http-equiv=\"Content-Type\"/>
<link type=\"text/css\" href=\"/cduce2.css\" rel=\"stylesheet\"/>
<title>CDuce online prototype</title>
</head>
<body>
<div class=\"title\"> <h1>CDuce online prototype</h1> </div>
<div id=\"Sidelog\">
<div class=\"box\">
<ul>
<li><a href=\"/\">Main page</a></li>
<li><a href=\"/memento.html\">CDuce Memento</a></li>
</ul>
</div>
";
if !persistant then
(p begin_table;
p "You're running the CDuce prototype in session mode: values and
p "
</div>
<div id=\"Content\">
<div class=\"box\">
<p>You're running the CDuce prototype in session mode: values and
types accepted by CDuce when you click 'Submit' will be available
for subsequent requests.";
(* p "<small> (session #"; p !session_id; p ")</small>"; *)
p end_table)
for subsequent requests.</p>
</div>
"
else
(p begin_table;
p "This page is a front-end to a prototype implementation of CDuce.";
p "You can start from one of the predefined examples below or try ";
p "with you own program...";
p "The session mode remembers CDuce definitions across requests.";
p Examples.present;
p end_table)
p ||| "
<div class=\"box\">
<p>
You can start from one of the predefined examples below or try
with you own program...</p>
" ||| Examples.present ||| "</div></div><div id=\"Content\">"
||= ()
let html_form p content =
p begin_table;
p "<h2>Input</h2>";
p "<form method=post>";
p "<input type=submit name=exec value='Submit to CDuce'>";
if !persistant then(
p "<input type=submit name=dump value='Show current environment'>";
p "<input type=submit name=close value='Close session'>";
p "<input type=hidden name=session value='"; p !session_id; p "'>";
) else (
p "<input type=submit name=open value=\"Initiate session\">";
);
p "<br><textarea name=prog cols=80 rows=25>"; p content; p "</textarea>";
p "</form>";
p end_table
p "
<div class=\"box\">
<h2>Input</h2>
<form method=\"post\" action=\"/cgi-bin/cduce\">
<p><input type=\"submit\" name=\"exec\" value=\"Submit to CDuce\"/> ";
if !persistant then
p ||| "
<input type=\"submit\" name=\"dump\" value=\"Show current environment\"/>
<input type=\"submit\" name=\"close\" value=\"Close session\"/>
<input type=\"hidden\" name=\"session\" value=\"" ||| !session_id
||| "\"/>" ||= ()
else
p "<input type=\"submit\" name=\"open\" value=\"Initiate session\"/>
<small>
The session mode remembers CDuce definitions across requests.
</small>
";
p ||| "</p><p><textarea name=\"prog\" cols=\"80\" rows=\"25\">"
||| content
||| "</textarea></p></form></div>"
||= ()
let html_footer p =
p "</body></html>\n"
p "
</div>
</body>
</html>
"
let () =
......@@ -171,7 +200,7 @@ let main (cgi : Netcgi.std_activation) =
try
let nb_sessions = flush_sessions () in
cgi # set_header
~content_type:"text/html; charset=\"iso-8859-1\""
(* ~content_type:"text/html; charset=\"iso-8859-1\"" *)
();
let cmd =
......@@ -227,10 +256,8 @@ let main (cgi : Netcgi.std_activation) =
let ok = Cduce.run ppf ppf input in
if ok then Format.fprintf ppf "@\nOk.@\n";
let res = Format.flush_str_formatter () in
p begin_table;
p "<h2>Results</h2>";
p "<pre>"; cut (cgi # output # output_char) 80 res; p "</pre>";
p end_table;
p "<div class=\"box\"><h2>Results</h2><pre>";
cut (cgi # output # output_char) 80 res; p "</pre></div>";
if ok then (dialog ""; store_state ()) else dialog src;
in
......@@ -240,10 +267,8 @@ let main (cgi : Netcgi.std_activation) =
Cduce.dump_env ppf;
let res = Format.flush_str_formatter () in
p begin_table;
p "<h2>Current session environment</h2>";
p ("<pre>" ^ res ^ "</pre>");
p end_table;
p "<div class=\"box\"><h2>Current session environment</h2>";
p ("<pre>" ^ res ^ "</pre></div>");
dialog src
in
......@@ -260,21 +285,19 @@ let main (cgi : Netcgi.std_activation) =
| `Close -> dialog ""
| `Example -> dialog (example (cgi # argument_value "example"))
);
p begin_table;
p "<h2>About the prototype</h2>";
p "CDuce is under active development; some features may not work properly.";
p "We are planning a beta release for the beginning of 2003. ";
p "The prototype is written in ";
p "<a href='http://www.caml.inria.fr'>Objective Caml</a>, ";
p "and uses several OCaml packages: ";
p "<a href='http://caml.inria.fr/camlp4'>Camlp4</a>, ";
p "<a href='http://ocamlnet.sourceforge.net/'>OCamlnet</a>, ";
p "<a href='http://www.ocaml-programming.de/programming/pxp.html'>PXP</a>, ";
p "<a href='http://www.eleves.ens.fr/home/frisch/soft#wlex'>wlex</a>.";
p "<p>";
p "<a href='mailto:Alain.Frisch@ens.fr'>Webmaster</a>";
p end_table;
p "
<div class=\"box\"><h2>About the prototype</h2>
<p>
CDuce is under active development; some features may not work properly.
We are planning a beta release for the beginning of 2003.
The prototype is written in
<a href='http://www.caml.inria.fr'>Objective Caml</a>,
and uses several OCaml packages:
<a href='http://caml.inria.fr/camlp4'>Camlp4</a>,
<a href='http://ocamlnet.sourceforge.net/'>OCamlnet</a>,
<a href='http://www.ocaml-programming.de/programming/pxp.html'>PXP</a>,
<a href='http://www.eleves.ens.fr/home/frisch/soft#wlex'>wlex</a>.</p>
<p><a href='mailto:Alain.Frisch@ens.fr'>Webmaster</a></p></div>";
html_footer p;
cgi # output # commit_work()
with
......
......@@ -78,7 +78,7 @@ let html_hilight ppf (i,j) =
let i0 = beg_of_line s i in
let j0 = end_of_line s j in
Format.fprintf ppf
"<i>%s<font color=red><b>%s</b></font>%s</i>@."
"<i>%s<font color=\"red\"><b>%s</b></font>%s</i>@."
(extr s i0 i)
(extr s i j)
(extr s j j0)
......
......@@ -29,10 +29,10 @@ let string_of_xml v=
let comment s = wms ("<!--" ^ s ^ "-->")
and write_att (n,v) = wms (" " ^ n ^ "=\""); wds v; wms "\"" in
let element_start name attrs =
wms ("<" ^ name); List.iter write_att attrs; wms "\n>"
wms ("<" ^ name); List.iter write_att attrs; wms ">"
and empty_element name attrs =
wms ("<" ^ name); List.iter write_att attrs; wms "/>"
and element_end name = wms ("</" ^ name ^ "\n>")
and element_end name = wms ("</" ^ name ^ ">")
and document_start () =
(* wms ("<?xml version='1.0' encoding='" ^
Netconversion.string_of_encoding to_enc ^
......
......@@ -40,6 +40,9 @@ p {
text-align: justify;
margin: 1ex 1em 0 1em;
}
pre {
margin: 1ex 1em 0 1em;
}
div.abstract {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment