Author: ArcRiley
Date: 2009-01-02 02:44:26 -0500 (Fri, 02 Jan 2009)
New Revision: 1405

Added:
   trunk/concordance/src/Core.c
   trunk/concordance/src/Core.h
Removed:
   trunk/concordance/scripts/
Modified:
   trunk/concordance/
   trunk/concordance/setup.py
   trunk/concordance/src/__init__.c
Log:
concordance.Core is now available, though segfaults on dir()



Property changes on: trunk/concordance
___________________________________________________________________
Added: svn:ignore
   + build


Modified: trunk/concordance/setup.py
===================================================================
--- trunk/concordance/setup.py  2009-01-02 04:41:03 UTC (rev 1404)
+++ trunk/concordance/setup.py  2009-01-02 07:44:26 UTC (rev 1405)
@@ -45,7 +45,9 @@
   ext_package      = '',
   ext_modules      = [Extension(
     name           = 'concordance',
-    sources        = ['src/__init__.c'],
+    sources        = ['src/__init__.c',
+                      'src/Core.c',
+    ],
   )],
   classifiers      = [
     'Development Status :: 1 - Planning',

Added: trunk/concordance/src/Core.c
===================================================================
--- trunk/concordance/src/Core.c                                (rev 0)
+++ trunk/concordance/src/Core.c        2009-01-02 07:44:26 UTC (rev 1405)
@@ -0,0 +1,122 @@
+/*
+# Concordance XMPP/Jingle Server Framework
+#
+# Copyright (C) 2009 Copyleft Games Group
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published
+#  by the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program 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 Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program; if not, see http://www.gnu.org/licenses
+#
+# $Id$
+*/
+
+#include "Python.h"
+#include "Core.h"
+
+/* 
+
+cdef class Core :                                                         */
+  char conCore_Doc[] = "";
+
+  PyObject*
+  conCore_New(PyObject* self, PyObject* args) {
+    conCoreObject* new;
+    new = PyObject_New(conCoreObject, &conCore_Type);
+    if (new != NULL) {
+      new->attrs = NULL;
+    }
+    return (PyObject*) new;
+  }
+
+  static void
+  conCore_dealloc(conCoreObject* self) {
+    Py_XDECREF(self->attrs);
+    PyObject_Del(self);
+  }
+
+  static PyObject* 
+  conCore_getattro(conCoreObject* self, PyObject* name) {
+    if (self->attrs != NULL) {
+      PyObject* v = PyDict_GetItem(self->attrs, name);
+      if (v != NULL) {
+        Py_INCREF(v);
+        return v;
+      }
+    }
+    return PyObject_GenericGetAttr((PyObject* )self, name);
+  }
+
+  static int
+  conCore_setattr(conCoreObject* self, char *name, PyObject* v) {
+    if (self->attrs == NULL) {
+      self->attrs = PyDict_New();
+      if (self->attrs == NULL)
+        return -1;
+    }
+    if (v == NULL) {
+      int rv = PyDict_DelItemString(self->attrs, name);
+      if (rv < 0)
+        PyErr_SetString(PyExc_AttributeError,
+                        "delete non-existing attribute");
+      return rv;
+    }
+    else
+      return PyDict_SetItemString(self->attrs, name, v);
+  }
+
+  static PyMethodDef conCore_methods[] = {
+    { NULL, NULL }
+  };
+
+  static PyTypeObject conCore_Type = {
+    PyVarObject_HEAD_INIT(NULL, 0)
+    "concordance.Core",                /*tp_name*/
+    sizeof(conCoreObject),             /*tp_basicsize*/
+    0,                                 /*tp_itemsize*/
+    /* methods */
+    (destructor)conCore_dealloc,       /*tp_dealloc*/
+    0,                                 /*tp_print*/
+    (getattrfunc)0,                    /*tp_getattr*/
+    (setattrfunc)conCore_setattr,      /*tp_setattr*/
+    0,                                 /*tp_compare*/
+    0,                                 /*tp_repr*/
+    0,                                 /*tp_as_number*/
+    0,                                 /*tp_as_sequence*/
+    0,                                 /*tp_as_mapping*/
+    0,                                 /*tp_hash*/
+    0,                                 /*tp_call*/
+    0,                                 /*tp_str*/
+    (getattrofunc)conCore_getattro,    /*tp_getattro*/
+    0,                                 /*tp_setattro*/
+    0,                                 /*tp_as_buffer*/
+    Py_TPFLAGS_DEFAULT,                /*tp_flags*/
+    0,                                 /*tp_doc*/
+    0,                                 /*tp_traverse*/
+    0,                                 /*tp_clear*/
+    0,                                 /*tp_richcompare*/
+    0,                                 /*tp_weaklistoffset*/
+    0,                                 /*tp_iter*/
+    0,                                 /*tp_iternext*/
+    conCore_methods,                   /*tp_methods*/
+    0,                                 /*tp_members*/
+    0,                                 /*tp_getset*/
+    0,                                 /*tp_base*/
+    0,                                 /*tp_dict*/
+    0,                                 /*tp_descr_get*/
+    0,                                 /*tp_descr_set*/
+    0,                                 /*tp_dictoffset*/
+    0,                                 /*tp_init*/
+    0,                                 /*tp_alloc*/
+    0,                                 /*tp_new*/
+    0,                                 /*tp_free*/
+    0,                                 /*tp_is_gc*/
+  };


Property changes on: trunk/concordance/src/Core.c
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:mergeinfo
   + 

Added: trunk/concordance/src/Core.h
===================================================================
--- trunk/concordance/src/Core.h                                (rev 0)
+++ trunk/concordance/src/Core.h        2009-01-02 07:44:26 UTC (rev 1405)
@@ -0,0 +1,35 @@
+/*
+# Concordance XMPP/Jingle Server Framework
+#
+# Copyright (C) 2009 Copyleft Games Group
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Affero General Public License as published
+#  by the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program 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 Affero General Public License for more details.
+#
+#  You should have received a copy of the GNU Affero General Public License
+#  along with this program; if not, see http://www.gnu.org/licenses
+#
+# $Id$
+*/
+
+#ifndef CONCORE_H
+#define CONCORE_H
+
+typedef struct {
+  PyObject_HEAD
+  PyObject *attrs;
+} conCoreObject;
+
+static PyTypeObject conCore_Type;
+       PyObject*    conCore_New        (PyObject*, PyObject*);
+extern char         conCore_Doc[];
+        
+#define conCoreObject_Check(v)  (Py_TYPE(v) == &conCore_Type)
+#endif


Property changes on: trunk/concordance/src/Core.h
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: trunk/concordance/src/__init__.c
===================================================================
--- trunk/concordance/src/__init__.c    2009-01-02 04:41:03 UTC (rev 1404)
+++ trunk/concordance/src/__init__.c    2009-01-02 07:44:26 UTC (rev 1405)
@@ -16,19 +16,24 @@
 #  You should have received a copy of the GNU Affero General Public License
 #  along with this program; if not, see http://www.gnu.org/licenses
 #
-# $Id: Texture.pym 1393 2008-12-31 23:51:25Z ArcRiley $
+# $Id$
 */
 
 #include "Python.h"
+#include "Core.h"
 
 static PyMethodDef concordanceMethods[] = {
-  {NULL, NULL}
+  { "Core",
+    conCore_New,
+    METH_VARARGS,
+    PyDoc_STR(conCore_Doc)},
+  { NULL, NULL }
 };
 
 static struct PyModuleDef concordanceModule = {
   PyModuleDef_HEAD_INIT,
   "concordance",
-  NULL,
+  "Test Help",
   -1,
   concordanceMethods,
   NULL, NULL, NULL, NULL
@@ -36,5 +41,6 @@
 
 PyMODINIT_FUNC
 PyInit_concordance(void) {
+  if (PyType_Ready(&conCore_Type) < 0) return NULL;
   return PyModule_Create(&concordanceModule);
 }


Property changes on: trunk/concordance/src/__init__.c
___________________________________________________________________
Added: svn:keywords
   + Id

_______________________________________________
PySoy-SVN mailing list
PySoy-SVN@pysoy.org
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to