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/07/10 06:14:43 UTC
[lucy-commits] svn commit: r1144769 - in /incubator/lucy/trunk/clownfish: include/CFC.h
lib/Clownfish.xs lib/Clownfish/Binding/Core.pm src/CFCBindCore.c
src/CFCBindCore.h typemap
Author: marvin
Date: Sun Jul 10 04:14:43 2011
New Revision: 1144769
URL: http://svn.apache.org/viewvc?rev=1144769&view=rev
Log:
Start porting CFCBindCore to C.
Added:
incubator/lucy/trunk/clownfish/src/CFCBindCore.c
- copied, changed from r1144675, incubator/lucy/trunk/clownfish/include/CFC.h
incubator/lucy/trunk/clownfish/src/CFCBindCore.h
- copied, changed from r1144675, incubator/lucy/trunk/clownfish/include/CFC.h
Modified:
incubator/lucy/trunk/clownfish/include/CFC.h
incubator/lucy/trunk/clownfish/lib/Clownfish.xs
incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core.pm
incubator/lucy/trunk/clownfish/typemap
Modified: incubator/lucy/trunk/clownfish/include/CFC.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/include/CFC.h?rev=1144769&r1=1144768&r2=1144769&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/include/CFC.h (original)
+++ incubator/lucy/trunk/clownfish/include/CFC.h Sun Jul 10 04:14:43 2011
@@ -30,6 +30,7 @@
#include "CFCUtil.h"
#include "CFCVariable.h"
+#include "CFCBindCore.h"
#include "CFCBindAliases.h"
#include "CFCBindClass.h"
#include "CFCBindFile.h"
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish.xs
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish.xs?rev=1144769&r1=1144768&r2=1144769&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish.xs (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish.xs Sun Jul 10 04:14:43 2011
@@ -1704,6 +1704,23 @@ PPCODE:
END_SET_OR_GET_SWITCH
}
+MODULE = Clownfish PACKAGE = Clownfish::Binding::Core
+
+SV*
+_new()
+CODE:
+ CFCBindCore *self = CFCBindCore_new();
+ RETVAL = S_cfcbase_to_perlref(self);
+ CFCBase_decref((CFCBase*)self);
+OUTPUT: RETVAL
+
+void
+_destroy(self);
+ CFCBindCore *self;
+PPCODE:
+ CFCBindCore_destroy(self);
+
+
MODULE = Clownfish PACKAGE = Clownfish::Binding::Core::Function
SV*
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core.pm?rev=1144769&r1=1144768&r2=1144769&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core.pm Sun Jul 10 04:14:43 2011
@@ -48,8 +48,7 @@ sub new {
confess("Not a Hierarchy")
unless a_isa_b( $args{hierarchy}, "Clownfish::Hierarchy" );
- my $empty = "";
- my $self = bless \$empty, ref($either) || $either;
+ my $self = _new();
$hierarchy{$self} = $args{hierarchy};
$dest{$self} = $args{dest};
$header{$self} = $args{header};
@@ -64,6 +63,7 @@ sub DESTROY {
delete $dest{$self};
delete $header{$self};
delete $footer{$self};
+ _destroy($self);
}
sub write_all_modified {
Copied: incubator/lucy/trunk/clownfish/src/CFCBindCore.c (from r1144675, incubator/lucy/trunk/clownfish/include/CFC.h)
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCBindCore.c?p2=incubator/lucy/trunk/clownfish/src/CFCBindCore.c&p1=incubator/lucy/trunk/clownfish/include/CFC.h&r1=1144675&r2=1144769&rev=1144769&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/include/CFC.h (original)
+++ incubator/lucy/trunk/clownfish/src/CFCBindCore.c Sun Jul 10 04:14:43 2011
@@ -14,25 +14,30 @@
* limitations under the License.
*/
+#define CFC_NEED_BASE_STRUCT_DEF
#include "CFCBase.h"
-#include "CFCCBlock.h"
-#include "CFCClass.h"
-#include "CFCDocuComment.h"
-#include "CFCDumpable.h"
-#include "CFCFile.h"
-#include "CFCFunction.h"
-#include "CFCHierarchy.h"
-#include "CFCMethod.h"
-#include "CFCParamList.h"
-#include "CFCParcel.h"
-#include "CFCSymbol.h"
-#include "CFCType.h"
+#include "CFCBindCore.h"
#include "CFCUtil.h"
-#include "CFCVariable.h"
-#include "CFCBindAliases.h"
-#include "CFCBindClass.h"
-#include "CFCBindFile.h"
-#include "CFCBindFunction.h"
-#include "CFCBindMethod.h"
+struct CFCBindCore {
+ CFCBase base;
+};
+
+CFCBindCore*
+CFCBindCore_new(void) {
+ CFCBindCore *self
+ = (CFCBindCore*)CFCBase_allocate(sizeof(CFCBindCore),
+ "Clownfish::Binding::Core");
+ return CFCBindCore_init(self);
+}
+
+CFCBindCore*
+CFCBindCore_init(CFCBindCore *self) {
+ return self;
+}
+
+void
+CFCBindCore_destroy(CFCBindCore *self) {
+ CFCBase_destroy((CFCBase*)self);
+}
Copied: incubator/lucy/trunk/clownfish/src/CFCBindCore.h (from r1144675, incubator/lucy/trunk/clownfish/include/CFC.h)
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCBindCore.h?p2=incubator/lucy/trunk/clownfish/src/CFCBindCore.h&p1=incubator/lucy/trunk/clownfish/include/CFC.h&r1=1144675&r2=1144769&rev=1144769&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/include/CFC.h (original)
+++ incubator/lucy/trunk/clownfish/src/CFCBindCore.h Sun Jul 10 04:14:43 2011
@@ -14,25 +14,28 @@
* limitations under the License.
*/
-#include "CFCBase.h"
-#include "CFCCBlock.h"
-#include "CFCClass.h"
-#include "CFCDocuComment.h"
-#include "CFCDumpable.h"
-#include "CFCFile.h"
-#include "CFCFunction.h"
-#include "CFCHierarchy.h"
-#include "CFCMethod.h"
-#include "CFCParamList.h"
-#include "CFCParcel.h"
-#include "CFCSymbol.h"
-#include "CFCType.h"
-#include "CFCUtil.h"
-#include "CFCVariable.h"
-
-#include "CFCBindAliases.h"
-#include "CFCBindClass.h"
-#include "CFCBindFile.h"
-#include "CFCBindFunction.h"
-#include "CFCBindMethod.h"
+#ifndef H_CFCBINDCORE
+#define H_CFCBINDCORE
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct CFCBindCore CFCBindCore;
+
+CFCBindCore*
+CFCBindCore_new(void);
+
+CFCBindCore*
+CFCBindCore_init(CFCBindCore *self);
+
+void
+CFCBindCore_destroy(CFCBindCore *self);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H_CFCBINDCORE */
+
Modified: incubator/lucy/trunk/clownfish/typemap
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/typemap?rev=1144769&r1=1144768&r2=1144769&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/typemap (original)
+++ incubator/lucy/trunk/clownfish/typemap Sun Jul 10 04:14:43 2011
@@ -28,6 +28,7 @@ CFCParcel* CLOWNFISH_TYPE
CFCSymbol* CLOWNFISH_TYPE
CFCType* CLOWNFISH_TYPE
CFCVariable* CLOWNFISH_TYPE
+CFCBindCore* CLOWNFISH_BINDING_CORE
CFCBindClass* CLOWNFISH_BINDING_CORE_TYPE
INPUT
@@ -44,6 +45,18 @@ CLOWNFISH_TYPE
croak(\"Not a ${(my $t = $type) =~ s/CFC(\w+).*/Clownfish::$1/;\$t}\");
}
+CLOWNFISH_BINDING_CORE
+ if (!SvOK($arg)) {
+ $var = NULL;
+ }
+ else if (sv_derived_from($arg, \"Clownfish::Binding::Core\")) {
+ IV objint = SvIV((SV*)SvRV($arg));
+ $var = INT2PTR($type, objint);
+ }
+ else {
+ croak(\"Not a Clownfish::Binding::Core\");
+ }
+
CLOWNFISH_BINDING_CORE_TYPE
if (!SvOK($arg)) {
$var = NULL;
@@ -62,6 +75,9 @@ OUTPUT
CLOWNFISH_TYPE
sv_setref_pv($arg, \"${(my $t = $type) =~ s/CFC(\w+).*/Clownfish::$1/;\$t}\", (void*)$var);
+CLOWNFISH_BINDING_CORE
+ sv_setref_pv($arg, \"Clownfish::Binding::Core\", (void*)$var);
+
CLOWNFISH_BINDING_CORE_TYPE
sv_setref_pv($arg, \"${(my $t = $type) =~ s/CFCBind(\w+).*/Clownfish::Binding::Core::$1/;\$t}\", (void*)$var);