git.annexia.org
/
perl4caml.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e9cc683
)
Attempts to fix the deref_* functions.
author
rich
<rich>
Wed, 3 Mar 2004 12:39:20 +0000
(12:39 +0000)
committer
rich
<rich>
Wed, 3 Mar 2004 12:39:20 +0000
(12:39 +0000)
perl.mli
patch
|
blob
|
history
perl_c.c
patch
|
blob
|
history
diff --git
a/perl.mli
b/perl.mli
index
a9f0555
..
778de58
100644
(file)
--- a/
perl.mli
+++ b/
perl.mli
@@
-2,7
+2,7
@@
*
* Copyright (C) 2003 Merjis Ltd.
*
*
* Copyright (C) 2003 Merjis Ltd.
*
- * $Id: perl.mli,v 1.1
1 2003-12-11 17:41:52
rich Exp $
+ * $Id: perl.mli,v 1.1
2 2004-03-03 12:39:20
rich Exp $
*)
type sv
*)
type sv
@@
-88,17
+88,17
@@
val hashref : hv -> sv
val deref : sv -> sv
(** The input is a reference to a scalar. This returns the underlying
* scalar [SV]. If the input is not a reference to a scalar, throws
val deref : sv -> sv
(** The input is a reference to a scalar. This returns the underlying
* scalar [SV]. If the input is not a reference to a scalar, throws
- * [Invalid_arg].
+ * [Invalid_arg
ument
].
*)
val deref_array : sv -> av
(** The input is a reference to an array. This returns the underlying
* array [AV]. If the input is not a reference to an array, throws
*)
val deref_array : sv -> av
(** The input is a reference to an array. This returns the underlying
* array [AV]. If the input is not a reference to an array, throws
- * [Invalid_arg].
+ * [Invalid_arg
ument
].
*)
val deref_hash : sv -> hv
(** The input is a reference to a hash. This returns the underlying
* hash [HV]. If the input is not a reference to a hash, throws
*)
val deref_hash : sv -> hv
(** The input is a reference to a hash. This returns the underlying
* hash [HV]. If the input is not a reference to a hash, throws
- * [Invalid_arg].
+ * [Invalid_arg
ument
].
*)
val av_empty : unit -> av
*)
val av_empty : unit -> av
diff --git
a/perl_c.c
b/perl_c.c
index
3214e34
..
20d4299
100644
(file)
--- a/
perl_c.c
+++ b/
perl_c.c
@@
-1,6
+1,6
@@
/* Interface to Perl from OCaml.
* Copyright (C) 2003 Merjis Ltd.
/* Interface to Perl from OCaml.
* Copyright (C) 2003 Merjis Ltd.
- * $Id: perl_c.c,v 1.1
4 2004-02-03 12:38:57
rich Exp $
+ * $Id: perl_c.c,v 1.1
5 2004-03-03 12:39:20
rich Exp $
*/
#include <stdio.h>
*/
#include <stdio.h>
@@
-233,7
+233,7
@@
perl4caml_deref (value svv)
CAMLlocal1 (rsvv);
SV *sv = Sv_val (svv);
CAMLlocal1 (rsvv);
SV *sv = Sv_val (svv);
- if (Sv
TYPE (sv) != SVt_RV
)
+ if (Sv
ROK (sv)
)
invalid_argument ("deref: SV is not a reference");
switch (SvTYPE (SvRV (sv))) {
case SVt_IV:
invalid_argument ("deref: SV is not a reference");
switch (SvTYPE (SvRV (sv))) {
case SVt_IV:
@@
-256,7
+256,7
@@
perl4caml_deref_array (value svv)
CAMLlocal1 (ravv);
SV *sv = Sv_val (svv);
CAMLlocal1 (ravv);
SV *sv = Sv_val (svv);
- if (Sv
TYPE (sv) != SVt_RV
)
+ if (Sv
ROK (sv)
)
invalid_argument ("deref_array: SV is not a reference");
switch (SvTYPE (SvRV (sv))) {
case SVt_PVAV:
invalid_argument ("deref_array: SV is not a reference");
switch (SvTYPE (SvRV (sv))) {
case SVt_PVAV:
@@
-275,13
+275,13
@@
perl4caml_deref_hash (value svv)
CAMLlocal1 (rhvv);
SV *sv = Sv_val (svv);
CAMLlocal1 (rhvv);
SV *sv = Sv_val (svv);
- if (Sv
TYPE (sv) != SVt_RV
)
- invalid_argument ("deref_
array
: SV is not a reference");
+ if (Sv
ROK (sv)
)
+ invalid_argument ("deref_
hash
: SV is not a reference");
switch (SvTYPE (SvRV (sv))) {
case SVt_PVHV:
break;
default:
switch (SvTYPE (SvRV (sv))) {
case SVt_PVHV:
break;
default:
- invalid_argument ("deref_
array
: SV is not a reference to a hash");
+ invalid_argument ("deref_
hash
: SV is not a reference to a hash");
}
rhvv = Val_hv ((HV *) SvRV (sv));
CAMLreturn (rhvv);
}
rhvv = Val_hv ((HV *) SvRV (sv));
CAMLreturn (rhvv);