You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/02/09 03:16:22 UTC
[lucy-commits] svn commit: r1068742 - in /incubator/lucy/trunk/clownfish: lib/Clownfish.xs
src/CFCType.c src/CFCType.h
Author: marvin
Date: Wed Feb 9 02:16:21 2011
New Revision: 1068742
URL: http://svn.apache.org/viewvc?rev=1068742&view=rev
Log:
Change "parcel" member of CFCType struct to be a CFCParcel rather than its
wrapper SV.
Modified:
incubator/lucy/trunk/clownfish/lib/Clownfish.xs
incubator/lucy/trunk/clownfish/src/CFCType.c
incubator/lucy/trunk/clownfish/src/CFCType.h
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish.xs
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish.xs?rev=1068742&r1=1068741&r2=1068742&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish.xs (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish.xs Wed Feb 9 02:16:21 2011
@@ -428,14 +428,19 @@ PPCODE:
MODULE = Clownfish PACKAGE = Clownfish::Type
SV*
-_new(klass, flags, parcel, specifier, indirection, c_string)
+_new(klass, flags, parcel_sv, specifier, indirection, c_string)
const char *klass;
int flags;
- SV *parcel;
+ SV *parcel_sv;
const char *specifier;
int indirection;
const char *c_string;
CODE:
+ CFCParcel *parcel = NULL;
+ if (SvOK(parcel_sv) && sv_derived_from(parcel_sv, "Clownfish::Parcel")) {
+ IV objint = SvIV((SV*)SvRV(parcel_sv));
+ parcel = INT2PTR(CFCParcel*, objint);
+ }
CFCType *self = CFCType_new(flags, parcel, specifier, indirection,
c_string);
RETVAL = newSV(0);
@@ -574,8 +579,12 @@ PPCODE:
retval = newSVpvn(specifier, strlen(specifier));
}
break;
- case 4:
- retval = newSVsv((SV*)CFCType_get_parcel(self));
+ case 4: {
+ CFCParcel *parcel = CFCType_get_parcel(self);
+ retval = parcel
+ ? newSVsv((SV*)CFCParcel_get_perl_object(parcel))
+ : newSV(0);
+ }
break;
case 6:
retval = newSViv(CFCType_get_indirection(self));
Modified: incubator/lucy/trunk/clownfish/src/CFCType.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCType.c?rev=1068742&r1=1068741&r2=1068742&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCType.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCType.c Wed Feb 9 02:16:21 2011
@@ -30,13 +30,13 @@ struct CFCType {
int flags;
char *specifier;
int indirection;
- void *parcel;
+ struct CFCParcel *parcel;
char *c_string;
};
CFCType*
-CFCType_new(int flags, void *parcel, const char *specifier, int indirection,
- const char *c_string)
+CFCType_new(int flags, struct CFCParcel *parcel, const char *specifier,
+ int indirection, const char *c_string)
{
CFCType *self = (CFCType*)malloc(sizeof(CFCType));
if (!self) { croak("malloc failed"); }
@@ -45,11 +45,11 @@ CFCType_new(int flags, void *parcel, con
}
CFCType*
-CFCType_init(CFCType *self, int flags, void *parcel, const char *specifier,
- int indirection, const char *c_string)
+CFCType_init(CFCType *self, int flags, struct CFCParcel *parcel,
+ const char *specifier, int indirection, const char *c_string)
{
self->flags = flags;
- self->parcel = newSVsv((SV*)parcel);
+ self->parcel = parcel;
self->specifier = savepv(specifier);
self->indirection = indirection;
self->c_string = c_string ? savepv(c_string) : savepv("");
@@ -76,7 +76,6 @@ CFCType_destroy(CFCType *self)
{
Safefree(self->specifier);
Safefree(self->c_string);
- SvREFCNT_dec(self->parcel);
free(self);
}
@@ -120,7 +119,7 @@ CFCType_get_indirection(CFCType *self)
return self->indirection;
}
-void*
+struct CFCParcel*
CFCType_get_parcel(CFCType *self)
{
return self->parcel;
Modified: incubator/lucy/trunk/clownfish/src/CFCType.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCType.h?rev=1068742&r1=1068741&r2=1068742&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCType.h (original)
+++ incubator/lucy/trunk/clownfish/src/CFCType.h Wed Feb 9 02:16:21 2011
@@ -15,6 +15,7 @@
*/
typedef struct CFCType CFCType;
+struct CFCParcel;
#define CFCTYPE_CONST 0x00000001
#define CFCTYPE_NULLABLE 0x00000002
@@ -29,12 +30,12 @@ typedef struct CFCType CFCType;
#define CFCTYPE_COMPOSITE 0x00000400
CFCType*
-CFCType_new(int flags, void *parcel, const char *specifier, int indirection,
- const char *c_string);
+CFCType_new(int flags, struct CFCParcel *parcel, const char *specifier,
+ int indirection, const char *c_string);
CFCType*
-CFCType_init(CFCType *self, int flags, void *parcel, const char *specifier,
- int indirection, const char *c_string);
+CFCType_init(CFCType *self, int flags, struct CFCParcel *parcel,
+ const char *specifier, int indirection, const char *c_string);
CFCType*
CFCType_new_void(int is_const);
@@ -57,7 +58,7 @@ CFCType_get_specifier(CFCType *self);
int
CFCType_get_indirection(CFCType *self);
-void*
+struct CFCParcel*
CFCType_get_parcel(CFCType *self);
void