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/09/18 00:03:43 UTC
[lucy-commits] svn commit: r1172076 - in
/incubator/lucy/branches/clownfish_lemon/clownfish: include/CFC.h
lib/Clownfish.xs lib/Clownfish/Parser.pm src/CFCParser.c src/CFCParser.h
typemap
Author: marvin
Date: Sat Sep 17 22:03:42 2011
New Revision: 1172076
URL: http://svn.apache.org/viewvc?rev=1172076&view=rev
Log:
Wrap Clownfish::Parser around C core.
Added:
incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.c (with props)
incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.h (with props)
Modified:
incubator/lucy/branches/clownfish_lemon/clownfish/include/CFC.h
incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs
incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish/Parser.pm
incubator/lucy/branches/clownfish_lemon/clownfish/typemap
Modified: incubator/lucy/branches/clownfish_lemon/clownfish/include/CFC.h
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/include/CFC.h?rev=1172076&r1=1172075&r2=1172076&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/include/CFC.h (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/include/CFC.h Sat Sep 17 22:03:42 2011
@@ -25,6 +25,7 @@
#include "CFCMethod.h"
#include "CFCParamList.h"
#include "CFCParcel.h"
+#include "CFCParser.h"
#include "CFCSymbol.h"
#include "CFCType.h"
#include "CFCUtil.h"
Modified: incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs?rev=1172076&r1=1172075&r2=1172076&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish.xs Sat Sep 17 22:03:42 2011
@@ -2041,3 +2041,22 @@ _write_xs_typemap(hierarchy)
PPCODE:
CFCPerlTypeMap_write_xs_typemap(hierarchy);
+
+MODULE = Clownfish PACKAGE = Clownfish::Parser
+
+SV*
+_new(klass)
+ const char *klass;
+CODE:
+ CFCParser *self = CFCParser_new();
+ RETVAL = S_cfcbase_to_perlref(self);
+ CFCBase_decref((CFCBase*)self);
+OUTPUT: RETVAL
+
+void
+_destroy(self)
+ CFCParser *self;
+PPCODE:
+ CFCParser_destroy(self);
+
+
Modified: incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish/Parser.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish/Parser.pm?rev=1172076&r1=1172075&r2=1172076&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish/Parser.pm (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish/Parser.pm Sat Sep 17 22:03:42 2011
@@ -317,7 +317,7 @@ END_GRAMMAR
our %inner_parser;
sub new {
- my $self = bless {}, __PACKAGE__;
+ my $self = shift->_new();
$inner_parser{$self} = Parse::RecDescent->new($grammar);
return $self;
}
@@ -325,6 +325,7 @@ sub new {
sub DESTROY {
my $self = shift;
delete $inner_parser{$self};
+ $self->_destroy;
}
our $AUTOLOAD;
@@ -333,7 +334,6 @@ sub AUTOLOAD {
my $self = shift;
my $inner_parser = $inner_parser{$self};
my ($meth) = $AUTOLOAD =~ /Clownfish::Parser::(\w+)/;
- #die "No method '$AUTOLOAD'" unless $inner_parser->can($AUTOLOAD);
return $inner_parser->$meth(@_);
}
Added: incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.c
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.c?rev=1172076&view=auto
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.c (added)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.c Sat Sep 17 22:03:42 2011
@@ -0,0 +1,43 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define CFC_NEED_BASE_STRUCT_DEF
+#include "CFCBase.h"
+#include "CFCParser.h"
+#include "CFCUtil.h"
+
+struct CFCParser {
+ CFCBase base;
+};
+
+CFCParser*
+CFCParser_new(void) {
+ CFCParser *self = (CFCParser*)CFCBase_allocate(sizeof(CFCParser),
+ "Clownfish::Parser");
+ return CFCParser_init(self);
+}
+
+CFCParser*
+CFCParser_init(CFCParser *self) {
+ return self;
+}
+
+void
+CFCParser_destroy(CFCParser *self) {
+ CFCBase_destroy((CFCBase*)self);
+}
+
+
Propchange: incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.h
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.h?rev=1172076&view=auto
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.h (added)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.h Sat Sep 17 22:03:42 2011
@@ -0,0 +1,40 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef H_CFCPARSER
+#define H_CFCPARSER
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct CFCParser CFCParser;
+
+CFCParser*
+CFCParser_new(void);
+
+CFCParser*
+CFCParser_init(CFCParser *self);
+
+void
+CFCParser_destroy(CFCParser *self);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H_CFCPARSER */
+
Propchange: incubator/lucy/branches/clownfish_lemon/clownfish/src/CFCParser.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/lucy/branches/clownfish_lemon/clownfish/typemap
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/typemap?rev=1172076&r1=1172075&r2=1172076&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/typemap (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/typemap Sat Sep 17 22:03:42 2011
@@ -25,6 +25,7 @@ CFCHierarchy* CLOWNFISH_TYPE
CFCMethod* CLOWNFISH_TYPE
CFCParamList* CLOWNFISH_TYPE
CFCParcel* CLOWNFISH_TYPE
+CFCParser* CLOWNFISH_TYPE
CFCSymbol* CLOWNFISH_TYPE
CFCType* CLOWNFISH_TYPE
CFCVariable* CLOWNFISH_TYPE