Commit 6fdcb42b authored by Kim Nguyễn's avatar Kim Nguyễn
Browse files

.

parent b6af8d1f
......@@ -334,14 +334,14 @@ cduce_js_runtime: $(CDUCE_JS_RUNTIME)
@echo "Build $@"
$(HIDE)$(CAMLC) -custom -linkpkg camlp4lib.cma $(INCLUDES) -o $@ $^ $(EXTRA_LINK_OPTS)
cduce_js_runtime.bytecode:
cduce_js_runtime.js:
@echo "Build $@"
$(HIDE) $(MAKE) NATIVE=false ML_INTERFACE=false PXP=false EXPAT=false \
CURL=false NETCLIENT=false NETCLIENT4=false NETSTRING=false \
CGI=false PXP_WLEX=false\
cduce_js_runtime
$(HIDE) cp cduce_js_runtime cduce_js_runtime.bytecode
#js_of_ocaml +nat.js +weak.js +toplevel.js cduce_js_runtime
$(HIDE) mv cduce_js_runtime cduce_js_runtime.bytecode
$(HIDE) js_of_ocaml +nat.js +weak.js +toplevel.js cduce_js_runtime.bytecode
cducetop_js_runtime: $(CDUCETOP_JS_RUNTIME)
@echo "Build $@"
......
namespace cduce_ = "http://www.cduce.org/#UNSAFE"
let fact (n : Int) : Int =
if n <= 0 then 1
else n * fact (n - 1)
......@@ -6,16 +8,17 @@ let fact (n : Int) : Int =
let x = fact 24
let [] = print (string_of x)
let doc = load_xml "foo"
let [] = replace_outer "foo" (print_xml <div id="bar1">[])
let [] = cduce_:replace_outer "foo"
(print_xml <div id="bar1">[])
(* "<div id='bar' />" *)
let [] = replace_inner "bar1" (print_xml <div id="bar2">[])
let [] = cduce_:replace_inner "bar1" (print_xml <div id="bar2">[])
let [] = print (print_xml doc)
let h (id : Latin1) (ev : { .. }) : [] =
let h (_ : Latin1) (ev : { .. }) : [] =
print (string_of { foo="bar" });
print (string_of ev);
print "Handler appelé\n"
;;
let [] = register_event "baz" "click" h
let [] = cduce_:register_event "baz" "click" h
;;
......@@ -255,7 +255,7 @@ register_fun2 ~ns:Ns.cduce_unsafe_ns "replace_inner"
Value.nil
);;
register_fun2 "replace_outer"
register_fun2 ~ns:Ns.cduce_unsafe_ns "replace_outer"
string_latin1 string_latin1 nil
(fun id str ->
!Print_xml.replace_outer
......@@ -269,7 +269,7 @@ let htype = Types.( arrow
(cons (arrow (cons empty_open_record) (cons nil)))
);;
register_fun3 "register_event"
register_fun3 ~ns:Ns.cduce_unsafe_ns "register_event"
string_latin1 string_latin1 htype nil
(fun id event handler ->
!Print_xml.register_event
......
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