summaryrefslogtreecommitdiff
path: root/Examples/ocaml/simple
diff options
context:
space:
mode:
authorArt Yerkes <ayerkes@speakeasy.net>2003-11-01 07:53:48 +0000
committerArt Yerkes <ayerkes@speakeasy.net>2003-11-01 07:53:48 +0000
commit25d0e88ee749cb749385d658c24ac8c9d3b61ba6 (patch)
treebc2d3a51983e14f0adabae977181d3156c9222c0 /Examples/ocaml/simple
parent78fd2cb821ba2fa2cdc0319d3195cfb53d9a6411 (diff)
downloadswig-25d0e88ee749cb749385d658c24ac8c9d3b61ba6.tar.gz
swigp4-ified examples.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5232 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples/ocaml/simple')
-rw-r--r--Examples/ocaml/simple/Makefile6
-rw-r--r--Examples/ocaml/simple/example_prog.ml19
2 files changed, 13 insertions, 12 deletions
diff --git a/Examples/ocaml/simple/Makefile b/Examples/ocaml/simple/Makefile
index e16df0113..54ed8abf8 100644
--- a/Examples/ocaml/simple/Makefile
+++ b/Examples/ocaml/simple/Makefile
@@ -21,6 +21,12 @@ static::
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static
+toplevel::
+ $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
+ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
+ ocaml_static_toplevel
+
clean::
$(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean
diff --git a/Examples/ocaml/simple/example_prog.ml b/Examples/ocaml/simple/example_prog.ml
index b8bc619e7..cc3b973d8 100644
--- a/Examples/ocaml/simple/example_prog.ml
+++ b/Examples/ocaml/simple/example_prog.ml
@@ -7,26 +7,21 @@ open Example
exception NoReturn
-let single_int x =
- match x with C_int a -> a | _ -> raise NoReturn
-let get_float x =
- match x with C_float f -> f | C_double f -> f | _ -> raise NoReturn
-
-let x = 42
-let y = 105
-let g = single_int (_gcd (C_list [ C_int x ; C_int y ]))
-let _ = Printf.printf "The gcd of %d and %d is %d\n" x y g
+let x = 42 to int
+let y = 105 to int
+let g = _gcd '(x,y) as int
+let _ = Printf.printf "The gcd of %d and %d is %d\n" (x as int) (y as int) g
(* Manipulate the Foo global variable *)
(* Output its current value *)
-let _ = Printf.printf "Foo = %f\n" (get_float (_Foo C_void))
+let _ = Printf.printf "Foo = %f\n" (_Foo '() as float)
(* Change its value *)
-let _ = _Foo (C_float 3.1415926)
+let _ = _Foo '(3.1415926)
(* See if the change took effect *)
-let _ = Printf.printf "Foo = %f\n" (get_float (_Foo C_void))
+let _ = Printf.printf "Foo = %f\n" (_Foo '() as float)