Stub out CFCPyClass. Stub module for generating Python binding for a Clownfish Class.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/72102abf Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/72102abf Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/72102abf Branch: refs/heads/py_exp13 Commit: 72102abf76bbf6b86af8fd6b261bf4d040524a64 Parents: 4b8d87b Author: Marvin Humphrey <[email protected]> Authored: Thu Jan 28 14:55:45 2016 -0800 Committer: Marvin Humphrey <[email protected]> Committed: Wed Feb 24 15:20:36 2016 -0800 ---------------------------------------------------------------------- compiler/src/CFCPyClass.c | 68 ++++++++++++++++++++++++++++++++++++++++++ compiler/src/CFCPyClass.h | 40 +++++++++++++++++++++++++ 2 files changed, 108 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/72102abf/compiler/src/CFCPyClass.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCPyClass.c b/compiler/src/CFCPyClass.c new file mode 100644 index 0000000..8eaa702 --- /dev/null +++ b/compiler/src/CFCPyClass.c @@ -0,0 +1,68 @@ +/* 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 1 + +#include "CFCBase.h" +#include "CFCPyClass.h" +#include "CFCPyMethod.h" +#include "CFCParcel.h" +#include "CFCUtil.h" +#include "CFCClass.h" +#include "CFCFunction.h" +#include "CFCMethod.h" + +struct CFCPyClass { + CFCBase base; + CFCParcel *parcel; + char *class_name; + CFCClass *client; + char *pre_code; + char *meth_defs; +}; + +static void +S_CFCPyClass_destroy(CFCPyClass *self); + +static const CFCMeta CFCPERLCLASS_META = { + "Clownfish::CFC::Binding::Python::Class", + sizeof(CFCPyClass), + (CFCBase_destroy_t)S_CFCPyClass_destroy +}; + +CFCPyClass* +CFCPyClass_new(CFCClass *client) { + CFCUTIL_NULL_CHECK(client); + CFCPyClass *self = (CFCPyClass*)CFCBase_allocate(&CFCPERLCLASS_META); + CFCParcel *parcel = CFCClass_get_parcel(client); + self->parcel = (CFCParcel*)CFCBase_incref((CFCBase*)parcel); + self->class_name = CFCUtil_strdup(CFCClass_get_name(client)); + self->client = (CFCClass*)CFCBase_incref((CFCBase*)client); + self->pre_code = NULL; + self->meth_defs = CFCUtil_strdup(""); + return self; +} + +static void +S_CFCPyClass_destroy(CFCPyClass *self) { + CFCBase_decref((CFCBase*)self->parcel); + CFCBase_decref((CFCBase*)self->client); + FREEMEM(self->class_name); + FREEMEM(self->pre_code); + FREEMEM(self->meth_defs); + CFCBase_destroy((CFCBase*)self); +} + http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/72102abf/compiler/src/CFCPyClass.h ---------------------------------------------------------------------- diff --git a/compiler/src/CFCPyClass.h b/compiler/src/CFCPyClass.h new file mode 100644 index 0000000..4803833 --- /dev/null +++ b/compiler/src/CFCPyClass.h @@ -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_CFCPYCLASS +#define H_CFCPYCLASS + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CFCPyClass CFCPyClass; +struct CFCParcel; +struct CFCClass; + +/** Clownfish::CFC::Binding::Python::Class - Generate Python binding code for a + * Clownfish::CFC::Model::Class. + */ + +CFCPyClass* +CFCPyClass_new(struct CFCClass *client); + +#ifdef __cplusplus +} +#endif + +#endif /* H_CFCPYCLASS */ +
