Commit 018a8bfa authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-03-16 21:54:37 by cvscast] ::

Original author: cvscast
Date: 2003-03-16 21:54:38+00:00
parent f8981fa3
...@@ -160,7 +160,8 @@ driver/examples.ml: cduce tests/web.cd tests/examples.xml ...@@ -160,7 +160,8 @@ driver/examples.ml: cduce tests/web.cd tests/examples.xml
./cduce -quiet tests/web.cd ./cduce -quiet tests/web.cd
WEB_FILES = web/site.xml web/index.xml web/memento.xml web/team.xml web/bench.xml WEB_FILES = web/site.xml web/index.xml web/memento.xml web/team.xml \
web/bench.xml web/examples.xml web/papers.xml
web/index.html: cduce.opt web/site.cd $(WEB_FILES) web/index.html: cduce.opt web/site.cd $(WEB_FILES)
(cd web; ../cduce.opt -quiet site.cd) (cd web; ../cduce.opt -quiet site.cd)
......
...@@ -166,6 +166,7 @@ EXTEND ...@@ -166,6 +166,7 @@ EXTEND
| |
[ op = [ LIDENT "flatten" [ op = [ LIDENT "flatten"
| LIDENT "load_xml" | LIDENT "load_xml"
| LIDENT "load_file"
| LIDENT "load_html" | LIDENT "load_html"
| LIDENT "print_xml" | LIDENT "print_xml"
| LIDENT "print" | LIDENT "print"
......
...@@ -66,6 +66,7 @@ let rec eval env e0 = ...@@ -66,6 +66,7 @@ let rec eval env e0 =
| Typed.Op ("mod", [e1; e2]) -> eval_mod (eval env e1) (eval env e2) | Typed.Op ("mod", [e1; e2]) -> eval_mod (eval env e1) (eval env e2)
| Typed.Op ("load_xml", [e]) -> eval_load_xml (eval env e) | Typed.Op ("load_xml", [e]) -> eval_load_xml (eval env e)
| Typed.Op ("load_html", [e]) -> eval_load_html (eval env e) | Typed.Op ("load_html", [e]) -> eval_load_html (eval env e)
| Typed.Op ("load_file", [e]) -> eval_load_file (eval env e)
| Typed.Op ("print_xml", [e]) -> eval_print_xml (eval env e) | Typed.Op ("print_xml", [e]) -> eval_print_xml (eval env e)
| Typed.Op ("print", [e]) -> eval_print (eval env e) | Typed.Op ("print", [e]) -> eval_print (eval env e)
| Typed.Op ("int_of", [e]) -> eval_int_of (eval env e) | Typed.Op ("int_of", [e]) -> eval_int_of (eval env e)
...@@ -163,6 +164,15 @@ and eval_load_xml e = ...@@ -163,6 +164,15 @@ and eval_load_xml e =
and eval_load_html e = and eval_load_html e =
Load_xml.load_html (get_string e) Load_xml.load_html (get_string e)
and eval_load_file e =
Location.protect_op "load_file";
let ic = open_in (get_string e) in
let len = in_channel_length ic in
let s = String.create len in
really_input ic s 0 len;
close_in ic;
Value.string s
and eval_int_of e = and eval_int_of e =
let s = get_string e in let s = get_string e in
try Integer (Intervals.mk s) try Integer (Intervals.mk s)
......
...@@ -897,6 +897,10 @@ and type_op loc op args = ...@@ -897,6 +897,10 @@ and type_op loc op args =
check loc1 t1 Sequence.string check loc1 t1 Sequence.string
"The argument of load_xml must be a string (filename)"; "The argument of load_xml must be a string (filename)";
Types.any Types.any
| "load_file", [loc1,t1] ->
check loc1 t1 Sequence.string
"The argument of load_file must be a string (filename)";
Sequence.string
| "load_html", [loc1,t1] -> | "load_html", [loc1,t1] ->
check loc1 t1 Sequence.string check loc1 t1 Sequence.string
"The argument of load_html must be a string (filename)"; "The argument of load_html must be a string (filename)";
......
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