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:
b10da63
)
Commented out ref counting code for now. Updated Debian version.
author
rich
<rich>
Tue, 3 Feb 2004 12:38:57 +0000
(12:38 +0000)
committer
rich
<rich>
Tue, 3 Feb 2004 12:38:57 +0000
(12:38 +0000)
Makefile.config
patch
|
blob
|
history
debian/changelog
patch
|
blob
|
history
perl_c.c
patch
|
blob
|
history
diff --git
a/Makefile.config
b/Makefile.config
index
23a7aaf
..
319b32d
100644
(file)
--- a/
Makefile.config
+++ b/
Makefile.config
@@
-1,5
+1,5
@@
# perl4caml configuration -*- Makefile -*-
# perl4caml configuration -*- Makefile -*-
-# $Id: Makefile.config,v 1.1
3 2003-12-11 17:41:52
rich Exp $
+# $Id: Makefile.config,v 1.1
4 2004-02-03 12:38:57
rich Exp $
# PERLINCDIR
# Directory containing the Perl include files, eg. <EXTERN.h>.
# PERLINCDIR
# Directory containing the Perl include files, eg. <EXTERN.h>.
@@
-14,8
+14,20
@@
OCAMLLIBDIR := $(shell ocamlc -where)
# EXTRA_CFLAGS
# You can specify extra flags to be passed to gcc here.
# EXTRA_CFLAGS
# You can specify extra flags to be passed to gcc here.
+#
+# One flag you might want to pass here is
+#
+# -DPERL4CAML_REFCOUNTING_EXPERIMENTAL=1
+#
+# which will turn on experimental support for reference counting.
+# Without this none of the Perl structures that you allocate will get
+# freed. With this we try to map Perl's reference counting onto
+# OCaml's garbage collection by using finalizers. There are some
+# problems with this code at the moment, hence it is disabled by
+# default.
EXTRA_CFLAGS :=
EXTRA_CFLAGS :=
+#EXTRA_CFLAGS := -DPERL4CAML_REFCOUNTING_EXPERIMENTAL=1
# PACKAGE and VERSION
# PACKAGE and VERSION
diff --git
a/debian/changelog
b/debian/changelog
index
02ff439
..
1ce967f
100644
(file)
--- a/
debian/changelog
+++ b/
debian/changelog
@@
-1,4
+1,4
@@
-perl4caml (0.3.9-
2
) unstable; urgency=low
+perl4caml (0.3.9-
3
) unstable; urgency=low
* Initial Release.
* Initial Release.
diff --git
a/perl_c.c
b/perl_c.c
index
772bae2
..
3214e34
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
3 2003-12-11 17:41:52
rich Exp $
+ * $Id: perl_c.c,v 1.1
4 2004-02-03 12:38:57
rich Exp $
*/
#include <stdio.h>
*/
#include <stdio.h>
@@
-31,22
+31,31
@@
/* Perl requires the interpreter to be called literally 'my_perl'! */
static PerlInterpreter *my_perl;
/* Perl requires the interpreter to be called literally 'my_perl'! */
static PerlInterpreter *my_perl;
+/* Get the concrete value from an optional field. */
+static value unoption (value option, value deflt);
+
/* Wrap up an arbitrary void pointer in an opaque OCaml object. */
static value Val_voidptr (void *ptr);
/* Wrap up an arbitrary void pointer in an opaque OCaml object. */
static value Val_voidptr (void *ptr);
+/* Unwrap an arbitrary void pointer from an opaque OCaml object. */
+#define Voidptr_val(type,rv) ((type *) Field ((rv), 0))
+
+#if PERL4CAML_REFCOUNTING_EXPERIMENTAL
+
+/* Unwrap a custom block. */
+#define Xv_val(rv) (*((void **)Data_custom_val(rv)))
+
/* Wrap up an SV, AV or HV in a custom OCaml object which will decrement
* the reference count on finalization.
*/
static value Val_xv (SV *sv);
/* Wrap up an SV, AV or HV in a custom OCaml object which will decrement
* the reference count on finalization.
*/
static value Val_xv (SV *sv);
-/* Get the concrete value from an optional field. */
-static value unoption (value option, value deflt);
+#else
-/* Unwrap an arbitrary void pointer from an opaque OCaml object. */
-#define V
oidptr_val(type,rv) ((type *) Field ((rv), 0
))
+#define Xv_val(rv) Voidptr_val (SV, (rv))
+#define V
al_xv(sv) Val_voidptr ((sv
))
-/* Unwrap a custom block. */
-#define Xv_val(rv) (*((void **)Data_custom_val(rv)))
+#endif
/* Hide Perl types in opaque OCaml objects. */
#define Val_perl(pl) (Val_voidptr ((pl)))
/* Hide Perl types in opaque OCaml objects. */
#define Val_perl(pl) (Val_voidptr ((pl)))
@@
-1044,6
+1053,8
@@
Val_voidptr (void *ptr)
CAMLreturn (rv);
}
CAMLreturn (rv);
}
+#if PERL4CAML_REFCOUNTING_EXPERIMENTAL
+
static void
xv_finalize (value v)
{
static void
xv_finalize (value v)
{
@@
-1069,6
+1080,8
@@
Val_xv (SV *sv)
CAMLreturn (rv);
}
CAMLreturn (rv);
}
+#endif /* PERL4CAML_REFCOUNTING_EXPERIMENTAL */
+
static value
unoption (value option, value deflt)
{
static value
unoption (value option, value deflt)
{