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

[r2003-03-16 19:05:12 by cvscast] Empty log message

Original author: cvscast
Date: 2003-03-16 19:12:01+00:00
parent 0a23a2bd
......@@ -159,8 +159,10 @@ include depend
driver/examples.ml: cduce tests/web.cd tests/examples.xml
./cduce -quiet tests/web.cd
web/index.html: cduce web/site.cd web/site.xml
(cd web; ../cduce -quiet site.cd)
WEB_FILES = web/site.xml web/index.xml web/memento.xml web/team.xml
web/index.html: cduce.opt web/site.cd $(WEB_FILES)
(cd web; ../cduce.opt -quiet site.cd)
# Site-specific installation
build_web:
......@@ -172,6 +174,4 @@ install_web_local:
build_website:
rsh cedre ". .env; cd IMPLEM/CDUCE; make web/index.html"
scp web/index.html web/cduce.css cduce@iris:public_html/
scp web/*.html web/cduce.css cduce@iris:public_html/
......@@ -61,7 +61,7 @@ let html_header p =
<head>
<meta content=\"text/html; charset=iso-8859-1\"
http-equiv=\"Content-Type\"/>
<link type=\"text/css\" href=\"/cduce2.css\" rel=\"stylesheet\"/>
<link type=\"text/css\" href=\"/cduce.css\" rel=\"stylesheet\"/>
<title>CDuce online prototype</title>
</head>
<body>
......
......@@ -106,7 +106,9 @@ and eval_let_decl env l =
List.map (fun (x,i) -> (x, if (i = -1) then v else bindings.(i))) (IdMap.get bind)
and eval_map env brs = function
| Pair (x,y) -> Pair (eval_branches env brs x, eval_map env brs y)
| Pair (x,y) ->
let x = eval_branches env brs x in
Pair (x, eval_map env brs y)
| String (_,_,_,_) as v -> eval_map env brs (normalize v)
| q -> q
......@@ -115,7 +117,9 @@ and eval_flatten = function
| q -> q
and eval_transform env brs = function
| Pair (x,y) -> eval_concat (eval_branches env brs x) (eval_transform env brs y)
| Pair (x,y) ->
let x = eval_branches env brs x in
eval_concat x (eval_transform env brs y)
| String (_,_,_,_) as v -> eval_transform env brs (normalize v)
| q -> q
......@@ -169,8 +173,8 @@ and eval_print_xml v =
and eval_print v =
Location.protect_op "print";
let s = get_string v in
print_endline s;
print_string (get_string v);
flush stdout;
Value.nil
and eval_dump_to_file f v =
......
......@@ -12,6 +12,14 @@
<toc/>
<box>
<ul>
<li><a href="/cgi-bin/cduce">Online demo</a></li>
<li><a href="team.html">CDuce team</a></li>
<li><a href="plan.html">Site map</a></li>
</ul>
</box>
<box>
<p> CDuce ("seduce") is a new typed functional language with
......@@ -339,7 +347,8 @@ title="XML: Some hyperlinks minus the hype"> By Philip Wadler. </link>
</a>
</p>
<p>
<a href="mailto:Alain.Frisch@ens.fr">Mail the webmaster</a>
<a href="mailto:Alain.Frisch@ens.fr">Webmaster</a> -
<a href="plan.html">Site map</a>
</p>
</meta>
......
include "xhtml-strict.cd";;
include "xhtml-categ.cd";;
type Site = <site>[ <page {|input=String; output=String|}>[]* ];;
type SitePage =
<page {|input=String; output=String|}>[]
| <external {|href=String; title=String|}>[];;
type Site = <site>[ SitePage* ];;
type Page = <page>[
<title>String
......@@ -110,12 +113,22 @@ let fun page2html (Page -> Xhtml)
]
];;
let fun do_page((String,String) -> [])
(inf,outf) ->
let _ = print [ 'Loading ' !inf '... ' ] in
let page = match load_xml inf with
| Page & p -> p
| _ -> raise ("Invalid input document: " @ inf) in
type P = (String,<title>String);;
let fun make_plan (l : [ P+ ]) : Page =
<page>[ <title>"CDuce site"
<banner>"CDuce site"
<navig>[ <box>[ <a href="/">"Home" ] ]
<main>[
<box title="Pages"; link="pages">[
<ul>(map l with (file,<title>t) -> <li>[<a href=file>t]) ]
<meta>[
'This page was automatically generated by a CDuce program.'
]
]
];;
let fun do_page((Page,String) -> [])
(page,outf) ->
let _ = print [ 'Generating html ... ' ] in
let html : String =
[ '<?xml version="1.0" encoding="iso-8859-1"?>'
......@@ -124,12 +137,26 @@ let fun do_page((String,String) -> [])
!(print_xml (page2html page)) ] in
let _ = print [ 'Saving to ' !outf '...\n' ] in
dump_to_file outf html;;
let fun do_file((String,String) -> P)
(inf,outf) ->
let _ = print [ 'Loading ' !inf '... ' ] in
let page = match load_xml inf with
| Page & p -> p
| _ -> raise ("Invalid input document: " @ inf) in
let _ = do_page (page,outf) in
let tit = match [page]/<title>_ with [t] -> t in
(outf, tit);;
let site =
let _ = print [ 'Loading site.xml ...\n' ] in
match load_xml "site.xml" with
| Site & <site>s ->
(transform s with <page input=inf; output=outf>[] ->
do_page(inf,outf))
let ts = map s with
| <page input=inf; output=outf>_ -> do_file(inf,outf)
| <external href=url; title=t>_ -> (url,<title>t) in
let _ = print [ 'Create plan... ' ] in
let plan = make_plan (ts @ [("plan.html", <title>"CDuce site")]) in
do_page(plan,"plan.html")
| _ -> raise "Invalid site.xml";;
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<site>
<page input="index.xml" output="index.html"/>
<external href="cgi-bin/cduce" title="CDuce prototype"/>
<page input="memento.xml" output="memento.html"/>
<page input="team.xml" output="team.html"/>
</site>
......@@ -26,16 +26,16 @@ This page briefly presents the syntax of the CDuce language.
<box title="CDuce @ ENS (Paris)" link="ens">
<ul>
<li>
<a href="http://www.eleves.ens.fr/home/frisch/">
Alain Frisch
</a> (Ph.D. student at ENS)
</li>
<li>
<a href="http://www.di.ens.fr/~castagna/">
Giuseppe Castagna
</a> (CNRS researcher)
</li>
<li>
<a href="http://www.eleves.ens.fr/home/frisch/">
Alain Frisch
</a> (Ph.D. student at ENS)
</li>
</ul>
</box>
......
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