summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-05-19 18:07:57 -0600
committerTavian Barnes <tavianator@gmail.com>2011-05-19 18:07:57 -0600
commit05ffbe15e92140617e90fe0ccbc22cc1fe0ac3e3 (patch)
tree3f1dc798357f5f4535967c98185b1aea5119a6a4
parent6d86cbdcdeb60cdaa5146d186a33e844a09aaf86 (diff)
downloaddimension-05ffbe15e92140617e90fe0ccbc22cc1fe0ac3e3.tar.xz
Don't #include .c files.
-rw-r--r--libdimension-python/Makefile.am7
-rw-r--r--libdimension-python/Scene.c9
-rw-r--r--libdimension-python/Scene.h30
-rw-r--r--libdimension-python/Vector.c18
-rw-r--r--libdimension-python/Vector.h35
-rw-r--r--libdimension-python/dimension.c8
-rw-r--r--libdimension-python/dimension.h23
7 files changed, 103 insertions, 27 deletions
diff --git a/libdimension-python/Makefile.am b/libdimension-python/Makefile.am
index 239f051..89bfd1d 100644
--- a/libdimension-python/Makefile.am
+++ b/libdimension-python/Makefile.am
@@ -26,9 +26,8 @@ AM_CFLAGS = $(Python_CFLAGS)
AM_LDFLAGS = $(Python_LDFLAGS)
pyexec_LTLIBRARIES = dimension.la
-dimension_la_SOURCES = dimension.c
+dimension_la_SOURCES = Vector.c \
+ Scene.c \
+ dimension.c
dimension_la_LDFLAGS = -avoid-version -module
dimension_la_LIBADD = $(top_builddir)/libdimension/libdimension.la
-
-EXTRA_DIST = Scene.c \
- Vector.c
diff --git a/libdimension-python/Scene.c b/libdimension-python/Scene.c
index 48a41cb..bfbab63 100644
--- a/libdimension-python/Scene.c
+++ b/libdimension-python/Scene.c
@@ -18,10 +18,7 @@
* <http://www.gnu.org/licenses/>. *
*************************************************************************/
-typedef struct dmnsn_py_Scene {
- PyObject_HEAD
- dmnsn_scene *scene;
-} dmnsn_py_Scene;
+#include "Scene.h"
static PyObject *
dmnsn_py_Scene_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
@@ -53,7 +50,7 @@ static PyGetSetDef dmnsn_py_Scene_getsetters[] = {
{ NULL }
};
-static PyTypeObject dmnsn_py_SceneType = {
+PyTypeObject dmnsn_py_SceneType = {
PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "dimension.Scene",
.tp_basicsize = sizeof(dmnsn_py_Scene),
@@ -66,7 +63,7 @@ static PyTypeObject dmnsn_py_SceneType = {
.tp_new = dmnsn_py_Scene_new,
};
-static bool
+bool
dmnsn_py_init_SceneType(void)
{
Py_INCREF(&dmnsn_py_SceneType);
diff --git a/libdimension-python/Scene.h b/libdimension-python/Scene.h
new file mode 100644
index 0000000..11ea622
--- /dev/null
+++ b/libdimension-python/Scene.h
@@ -0,0 +1,30 @@
+/*************************************************************************
+ * Copyright (C) 2009-2011 Tavian Barnes <tavianator@tavianator.com> *
+ * *
+ * This file is part of The Dimension Python Module. *
+ * *
+ * The Dimension Python Module is free software; you can redistribute it *
+ * and/ or modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either version *
+ * 3 of the License, or (at your option) any later version. *
+ * *
+ * The Dimension Python Module is distributed in the hope that it will *
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See *
+ * the GNU Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this program. If not, see *
+ * <http://www.gnu.org/licenses/>. *
+ *************************************************************************/
+
+#include "dimension.h"
+
+typedef struct dmnsn_py_Scene {
+ PyObject_HEAD
+ dmnsn_scene *scene;
+} dmnsn_py_Scene;
+
+extern PyTypeObject dmnsn_py_SceneType;
+
+bool dmnsn_py_init_SceneType(void);
diff --git a/libdimension-python/Vector.c b/libdimension-python/Vector.c
index ca7d4e1..d4ed533 100644
--- a/libdimension-python/Vector.c
+++ b/libdimension-python/Vector.c
@@ -18,12 +18,8 @@
* <http://www.gnu.org/licenses/>. *
*************************************************************************/
-typedef struct dmnsn_py_Vector {
- PyObject_HEAD
- dmnsn_vector v;
-} dmnsn_py_Vector;
-
-static PyTypeObject dmnsn_py_VectorType;
+#include "Vector.h"
+#include "dimension.h"
static int
dmnsn_py_Vector_init(dmnsn_py_Vector *self, PyObject *args, PyObject *kwds)
@@ -228,7 +224,7 @@ dmnsn_py_Vector_negative(PyObject *rhs)
return (PyObject *)ret;
}
-static PyObject *
+PyObject *
dmnsn_py_Vector_cross(PyObject *self, PyObject *args)
{
dmnsn_py_Vector *lhs, *rhs;
@@ -244,7 +240,7 @@ dmnsn_py_Vector_cross(PyObject *self, PyObject *args)
return (PyObject *)ret;
}
-static PyObject *
+PyObject *
dmnsn_py_Vector_dot(PyObject *self, PyObject *args)
{
dmnsn_py_Vector *lhs, *rhs;
@@ -256,7 +252,7 @@ dmnsn_py_Vector_dot(PyObject *self, PyObject *args)
return PyFloat_FromDouble(dmnsn_vector_dot(lhs->v, rhs->v));
}
-static PyObject *
+PyObject *
dmnsn_py_Vector_proj(PyObject *self, PyObject *args)
{
dmnsn_py_Vector *u, *d;
@@ -331,7 +327,7 @@ static PyGetSetDef dmnsn_py_Vector_getsetters[] = {
{ NULL }
};
-static PyTypeObject dmnsn_py_VectorType = {
+PyTypeObject dmnsn_py_VectorType = {
PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "dimension.Vector",
.tp_basicsize = sizeof(dmnsn_py_Vector),
@@ -346,7 +342,7 @@ static PyTypeObject dmnsn_py_VectorType = {
.tp_init = (initproc)dmnsn_py_Vector_init,
};
-static bool
+bool
dmnsn_py_init_VectorType(void)
{
dmnsn_py_VectorType.tp_new = PyType_GenericNew;
diff --git a/libdimension-python/Vector.h b/libdimension-python/Vector.h
new file mode 100644
index 0000000..0ec288d
--- /dev/null
+++ b/libdimension-python/Vector.h
@@ -0,0 +1,35 @@
+/*************************************************************************
+ * Copyright (C) 2009-2011 Tavian Barnes <tavianator@tavianator.com> *
+ * *
+ * This file is part of The Dimension Python Module. *
+ * *
+ * The Dimension Python Module is free software; you can redistribute it *
+ * and/ or modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either version *
+ * 3 of the License, or (at your option) any later version. *
+ * *
+ * The Dimension Python Module is distributed in the hope that it will *
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See *
+ * the GNU Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this program. If not, see *
+ * <http://www.gnu.org/licenses/>. *
+ *************************************************************************/
+
+#include "dimension.h"
+
+typedef struct dmnsn_py_Vector {
+ PyObject_HEAD
+ dmnsn_vector v;
+} dmnsn_py_Vector;
+
+extern PyTypeObject dmnsn_py_VectorType;
+
+bool dmnsn_py_init_VectorType(void);
+
+/* Global methods */
+PyObject *dmnsn_py_Vector_cross(PyObject *self, PyObject *args);
+PyObject *dmnsn_py_Vector_dot(PyObject *self, PyObject *args);
+PyObject *dmnsn_py_Vector_proj(PyObject *self, PyObject *args);
diff --git a/libdimension-python/dimension.c b/libdimension-python/dimension.c
index 511f197..91d32dc 100644
--- a/libdimension-python/dimension.c
+++ b/libdimension-python/dimension.c
@@ -18,13 +18,9 @@
* <http://www.gnu.org/licenses/>. *
*************************************************************************/
-#define PY_SSIZE_T_CLEAN
-#include <Python.h>
-#include <structmember.h>
#include "dimension.h"
-
-#include "Vector.c"
-#include "Scene.c"
+#include "Vector.h"
+#include "Scene.h"
static PyObject *
dmnsn_py_dieOnWarnings(PyObject *self, PyObject *args)
diff --git a/libdimension-python/dimension.h b/libdimension-python/dimension.h
new file mode 100644
index 0000000..aa32b51
--- /dev/null
+++ b/libdimension-python/dimension.h
@@ -0,0 +1,23 @@
+/*************************************************************************
+ * Copyright (C) 2009-2011 Tavian Barnes <tavianator@tavianator.com> *
+ * *
+ * This file is part of The Dimension Python Module. *
+ * *
+ * The Dimension Python Module is free software; you can redistribute it *
+ * and/ or modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either version *
+ * 3 of the License, or (at your option) any later version. *
+ * *
+ * The Dimension Python Module is distributed in the hope that it will *
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See *
+ * the GNU Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this program. If not, see *
+ * <http://www.gnu.org/licenses/>. *
+ *************************************************************************/
+
+#define PY_SSIZE_T_CLEAN
+#include <Python.h>
+#include "../libdimension/dimension.h"