Commit d03a27cd authored by Pietro Abate's avatar Pietro Abate

[r2003-07-03 15:45:00 by cvscast] Empty log message

Original author: cvscast
Date: 2003-07-03 15:45:01+00:00
parent 708d234c
......@@ -41,18 +41,6 @@ Important notes:
- pcre-ocaml: you may also need to install the PCRE library
from http://www.pcre.org/
./configure --prefix=<prefix directory> --disable-shared
If pcre was installed in non standard place then in Makefile.conf:
export STATIC = yes #this may help but first try without
export INCDIRS := <prefix_directory>/include
export LIBDIRS := <prefix_directory>/lib
After make all && make opt:
cd lib
cp ../META .
ocamlfind install pcre META *.a *.cma *.cmxa *.cmi *.mli
- PXP:
CDuce requires a development version >= 1.1.93.
......@@ -84,12 +72,15 @@ distribution. It defines the following goals:
- make webiface
compiles the CDuce web interface interpreter (to be used as a CGI script)
- make local_website
- make webpages
compiles in the web/www/ subdirectory the HTML files for the CDuce website
(including the tutorial and manual)
- make install_web
compiles webiface and webpages, and install everything (see Makefile.conf)
- make all
equivalent to (make cduce; make dtd2cduce; make local_website)
equivalent to (make cduce dtd2cduce webiface webpages)
Makefile accepts the following options, which can take the values
......@@ -120,7 +111,7 @@ expat/README).
If you have the expat C library installed, you can build
the OCaml wrapper:
cd expact
cd expat
make all (* may need to modify Makefile.conf *)
make install (* may require root privileges *)
cd ..
......
......@@ -34,10 +34,6 @@ install_web_distant:
make webpages PHP=true
scp web/www/*.php web/cduce.css cduce@iris:public_html/
scp webiface cduce@iris:cgi-bin/cduce
#
#website: web/files
# scp web/www/*.php web/cduce.css cduce@iris.ens.fr:public_html/
# Packaging
......@@ -45,7 +41,7 @@ DISTRIB = $(DIRS) expat tools web depend INSTALL INSTALL.WIN32 CHANGES LICENSE R
PACKAGE = cduce-$(VERSION)
.PHONY: package
package:
package: clean
rm -Rf $(PACKAGE)
mkdir $(PACKAGE)
cp -R $(DISTRIB) $(PACKAGE)/
......@@ -53,7 +49,7 @@ package:
(cd $(PACKAGE); \
rm -f types/IDEAS; \
headache -h ../header $(DEPEND))
tar czf $(PACKAGE).tar.gz --exclude CVS --exclude ".#*" --exclude IDEAS $(PACKAGE)
tar czf $(PACKAGE).tar.gz --exclude CVS --exclude ".#*" $(PACKAGE)
rm -Rf $(PACKAGE)
......@@ -58,8 +58,7 @@ else
LINK = $(CAMLC) -custom -linkpkg gramlib.cma
endif
# all: cduce dtd2cduce local_website
all: cduce dtd2cduce local_website validate
all: cduce dtd2cduce website validate
# Source directories
......@@ -102,7 +101,6 @@ ALL_OBJECTS = $(OBJECTS) \
DEPEND = $(ALL_OBJECTS:.cmo=.ml) $(ALL_OBJECTS:.cmo=.mli)
# DEPEND = $(DIRS:=/*.ml) $(DIRS:=/*.mli)
INCLUDES = $(DIRS:%=-I %)
cduce: $(CDUCE:.cmo=.$(EXTENSION))
......@@ -158,7 +156,7 @@ include depend
# CDuce-generated files
driver/examples.ml: cduce web/examples/build.cd web/examples/examples.xml
(cd web/examples; ../../cduce --quiet build.cd)
(cd web/examples; ../../cduce --quiet build.cd --arg examples.xml)
webpages: cduce web/site.cd
(cd web; ../cduce --quiet site.cd --arg $(PHP_ARG) site.xml)
......
let examples = [ "functions","(* Simple functions can be defined this way: *)
let examples = [ "xml","(* Syntax for XML elements *)
type A = <a x=String y=?String>[ B* ]
type B = <b>[ A? ]
let x : A = <a x=\"Bla\" y=\"Blo\">[ <b>[] <b>[ <a x=\"Foo\">[] ] ]
";"functions","(* Simple functions can be defined this way: *)
let f1 (x : Int) : Int = x + 3
;;
f1 5
......@@ -341,7 +347,9 @@ bold [doc];;
let [x] = bold [doc] in print_xml x;;
"; ]
let present = "<ul><li><a href=\"/cgi-bin/cduce?example=functions\">Functions.</a>
let present = "<ul><li><a href=\"/cgi-bin/cduce?example=xml\">XML elements.</a>
XML elements.
</li><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>
Mutual toplevel definition for types and functions.
......
......@@ -256,13 +256,14 @@ EXTEND
| "no_appl"
[ c = const -> exp loc (Cst c)
| "("; l = LIST1 expr SEP ","; ")" -> exp loc (tuple l)
| "["; l = LIST0 seq_elem; e = OPT [ ";"; e = expr -> e ]; "]" ->
| "["; l = LIST0 seq_elem; e = OPT [ ";"; e = expr -> e ];
(_,loc_end) = ["]" -> loc] ->
let e = match e with Some e -> e | None -> cst_nil in
let l = List.fold_right
(fun x q ->
match x with
| `String (loc,i,j,s) -> exp loc (String (i,j,s,q))
| `Elems l -> tuple_queue l q
| `Elems ((loc,_),x) -> exp (loc,loc_end) (Pair(x,q))
| `Explode x -> Op ("@",[x;q])
) l e
in
......@@ -296,7 +297,7 @@ EXTEND
[ x = STRING1 ->
let s = U.mk x in
`String (loc, U.start_index s, U.end_index s, s)
| e = expr LEVEL "no_appl" -> `Elems [e]
| e = expr LEVEL "no_appl" -> `Elems (loc,e)
| "!"; e = expr LEVEL "no_appl" -> `Explode e
]
];
......@@ -505,7 +506,13 @@ EXTEND
attrib_spec:
[ [ r = record_spec -> mk loc (Record (true,r))
[ [ r = LIST0 [ l = [LIDENT | UIDENT | keyword ]; "=";
o = [ "?" -> true | -> false];
x = pat; OPT ";" ->
let x = if o then mk loc (Optional x) else x in
(label l, x)
] ->
mk loc (Record (true,r))
| "("; t = pat; ")" -> t
| "{"; r = record_spec; "}" -> mk loc (Record (true,r))
| "{|"; r = record_spec; "|}" -> mk loc (Record (false,r))
......@@ -515,12 +522,16 @@ EXTEND
[ [ r = LIST1
[ l = [LIDENT | UIDENT | keyword ]; "="; x = expr ->
(label l,x) ]
SEP ";" ->
SEP ";" ->
exp loc (RecordLitt r)
] ];
expr_attrib_spec:
[ [ r = expr_record_spec -> r ]
[ [ r = LIST1
[ l = [LIDENT | UIDENT | keyword ]; "="; x = expr LEVEL "no_appl"; OPT ";" ->
(label l,x) ] ->
exp loc (RecordLitt r)
]
| [ e = expr LEVEL "no_appl" -> e
| -> exp loc (RecordLitt [])
]
......
......@@ -6,10 +6,17 @@ include "../xhtml-categ.cd" (* Categories (Inline, ...) from this DTD *)
(* Input documents: CDuce examples *)
type Examples = <examples>[Example+]
type Example = <example code=Latin1; title=Latin1>Latin1
type Example = <example code=Latin1 title=Latin1>Latin1
(** Command line **)
let input =
match argv with
| [ s ] -> s
| _ -> raise "Please specify an input file on the command line"
let examples =
match load_xml "examples.xml" with
match load_xml input with
| Examples & <_>e -> e
| _ -> raise "Invalid input document"
......@@ -18,8 +25,8 @@ let script (code : Latin1) : Latin1 =
"/cgi-bin/cduce?example=" @ code
let do_example (Example -> Xli)
<_ code=c; title=t>a ->
<li>[ <a href = script c >[ !t '.' ] ' ' !a ]
<_ code=c title=t>a ->
<li>[ <a href = (script c) >[ !t '.' ] ' ' !a ]
let protect_quote (s : Latin1) : Latin1 =
transform s with '"' -> [ '\\"' ] | c -> [c]
......
<?xml version="1.0" encoding="iso-8859-1"?>
<examples>
<example code="xml" title="XML elements">
XML elements.
</example>
<example code="functions" title="Functions">
Several syntaxes to define functions.
</example>
......
(* Syntax for XML elements *)
type A = <a x=String y=?String>[ B* ]
type B = <b>[ PCDATA A? PCDATA ]
let x : A =
<a x="Bla" y="Blo">[
<b>[ 'blabla' ]
<b>[
<a x="Foo">[] 'bla' 'bla'
]
]
......@@ -21,7 +21,7 @@ type Page = <page name=String>[ <title>String <banner>[InlineText*]? Item* ]
type External = <external {|href=String; title=String; name=String |}>[]
type Item =
<box title=String; subtitle=?String; link=String>Content
<box title=String subtitle=?String link=String>Content
| <meta>Content
| <left>Content
| Page
......@@ -36,7 +36,7 @@ type Slides =
<slides file=String>[ <title>String Author+ <comment>[InlineText*] ]
type Link =
<link url=String; title=String>[ InlineText* ]
<link url=String title=String>[ InlineText* ]
type Content =
[ ( <p {||}>[InlineText*]
......@@ -175,7 +175,7 @@ let compute_sitemap ((Page|External) -> Tree)
<page name=name>[ <title>title (c::(Page|External) | _)* ] ->
let children = map c with p -> compute_sitemap p in
{ name = name; url = url_of_name name; title = title; children =children }
|<external name=name; href=h; title=t>[] ->
|<external name=name href=h title=t>[] ->
{ name = name; url = h; title = t; children = [] }
let display_sitemap (h : Tree) : Xli =
......@@ -220,7 +220,7 @@ match page with
[ <div class="code">[ <pre>s ] ]
| <sample>s ->
[ <div class="code">[ <pre>(highlight s) ] ]
| <link url=url; title=title>com ->
| <link url=url title=title>com ->
[ <a href=url>title '. ' !(text com) ]
| <ul>lis ->
[ <ul>(map lis with <li>x -> <li>(content x)) ]
......@@ -231,12 +231,12 @@ match page with
let toc =
transform items with
| Page & p -> [ <li>[ (link_to p) ] ]
| <external href=l; title=t>[] -> [ <li>[ <a href=l>t ] ] in
| <external href=l title=t>[] -> [ <li>[ <a href=l>t ] ] in
(match toc with [] -> [] | lis -> [ <ul>lis ])
| <boxes-toc>[] ->
let toc =
transform items with
<box title=t; link=l>_ -> [ <li>[ <a href=('#',l)>t ] ] in
<box title=t link=l>_ -> [ <li>[ <a href=('#',l)>t ] ] in
(match toc with [] -> [] | lis -> [ <ul>lis ])
| <site-toc>[] ->
[ <ul>[ (display_sitemap sitemap) ] ]
......@@ -258,7 +258,7 @@ match page with
[ <div class="box">[
<h2>(r . title)
!(match r with { subtitle = t } -> [<b>t] | _ -> [])
<a name=r . link>[]
<a name=(r . link)>[]
!(content c) ] ]
| <meta>c -> [ <div class="meta">(content c) ]
in
......@@ -277,13 +277,13 @@ match page with
let next = match next with [] -> []
| <page name=n>[ <title>t; _ ] ->
[ <a href=(url_of_name n)>[
<img width="16"; height="16"; class="icon"; alt="Next page"; src="img/right.gif">[]
<img width="16" height="16" class="icon" alt="Next page" src="img/right.gif">[]
' ' !t
] ] in
let prev = match prev with [] -> []
| <page name=n>[ <title>t; _ ] ->
[ <a href=(url_of_name n)>[
<img width="16"; height="16"; class="icon"; alt="Previous page"; src="img/left.gif">[]
<img width="16" height="16" class="icon" alt="Previous page" src="img/left.gif">[]
' ' !t
] ] in
let navig : [ Xdiv* ] =
......@@ -295,7 +295,7 @@ match page with
<html>[
<head>[
<title>[ 'CDuce: ' !title ]
<meta content="text/html; charset=iso-8859-1"; http-equiv="Content-Type">[]
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">[]
<meta content="css">[] (* Placeholder for PHP code *)
]
<body>[
......
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