Added 'make test' and some test scripts which exercise parts of the
[perl4caml.git] / perl.ml
diff --git a/perl.ml b/perl.ml
index 95ad3e5..23bc833 100644 (file)
--- a/perl.ml
+++ b/perl.ml
@@ -1,19 +1,14 @@
 (* Interface to Perl from OCaml.
  * Copyright (C) 2003 Merjis Ltd.
- * $Id: perl.ml,v 1.8 2003-10-18 12:36:09 rich Exp $
+ * $Id: perl.ml,v 1.13 2005-01-28 23:09:31 rich Exp $
  *)
 
-type t
-
 type sv
 type av
 type hv
 
 exception Perl_failure of string
 
-external create : ?args:string array -> unit -> t
-  = "perl4caml_create"
-
 (* Initialization. This must happen first, otherwise other parts of the
  * program will segfault because of a missing interpreter.
  *)
@@ -21,28 +16,17 @@ external c_init : unit -> unit = "perl4caml_init"
 let () =
   Callback.register_exception "perl4caml_perl_failure" (Perl_failure "");
   c_init ();                           (* Initialise C code. *)
-  (* Create the default interpreter. *)
-  create ~args:[| ""; "-w"; "-e"; "0" |] ();
   ()
 
-external current_interpreter : unit -> t
-  = "perl4caml_current_interpreter"
-
-external destroy : t -> unit
-  = "perl4caml_destroy"
-
-external set_context : t -> unit
-  = "perl4caml_set_context"
-
 external int_of_sv : sv -> int = "perl4caml_int_of_sv"
 external sv_of_int : int -> sv = "perl4caml_sv_of_int"
-external float_of_sv : sv -> int = "perl4caml_float_of_sv"
-external sv_of_float : int -> sv = "perl4caml_sv_of_float"
+external float_of_sv : sv -> float = "perl4caml_float_of_sv"
+external sv_of_float : float -> sv = "perl4caml_sv_of_float"
 external string_of_sv : sv -> string = "perl4caml_string_of_sv"
 external sv_of_string : string -> sv = "perl4caml_sv_of_string"
 external sv_is_true : sv -> bool = "perl4caml_sv_is_true"
-external sv_is_undef : sv -> bool = "perl4caml_sv_is_undef"
 external sv_undef : unit -> sv = "perl4caml_sv_undef"
+external sv_is_undef : sv -> bool = "perl4caml_sv_is_undef"
 external sv_yes : unit -> sv = "perl4caml_sv_yes"
 external sv_no : unit -> sv = "perl4caml_sv_no"
 
@@ -77,6 +61,14 @@ let string_of_sv_t = function
   | SVt_PVGV  -> "SVt_PVGV"
   | SVt_PVMG  -> "SVt_PVMG"
 
+external address_of_sv : sv -> Nativeint.t = "perl4caml_address_of_sv"
+external address_of_av : av -> Nativeint.t = "perl4caml_address_of_av"
+external address_of_hv : hv -> Nativeint.t = "perl4caml_address_of_hv"
+
+external scalarref : sv -> sv = "perl4caml_scalarref"
+external arrayref : av -> sv = "perl4caml_arrayref"
+external hashref : hv -> sv = "perl4caml_hashref"
+
 external deref : sv -> sv = "perl4caml_deref"
 external deref_array : sv -> av = "perl4caml_deref_array"
 external deref_hash : sv -> hv = "perl4caml_deref_hash"