Kaydet (Commit) 4e35b500 authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Merged main branch from "meducetto/iksemel"

# Object files
*.o
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
build/
__pycache__/
# Debug files
*.dSYM/
#Autotool files
aclocal.m4
autom4te.cache/
#Configure files
config.guess
config.status
config.sub
config.log
configure
config.h.in
*.log
*.trs
.deps/
.libs/
#Iks compiled files
doc/iksemel
include/config.h
include/stamp-h1
tools/ikslint
tools/iksperf
tools/iksroster
test/tst-dom
test/tst-filter
test/tst-iks
test/tst-ikstack
test/tst-jid
test/tst-sha
test/tst-md5
test/tst-sax
#Makefile files
Makefile
Makefile.in
#Tex files
*.tex
#Libtool files
libtool
*.pc
missing
depcomp
install-sh
compile
ltmain.sh
test-driver
2019-10-08 Zaryob
* The Developments that I used for my own project and made to the piksemel
version which was distributed in the past by TUBITAK/Pardus, now I am also
making the main branch.
- Python3 support have been added:
- Because of the complexity of iksemel and huge changes between python3
and python2 c-api is caused to create an incompatible port to versions
older than 3.2
2016-12-02 Zaryob
* Initial commit
2011-10-18 Gurer
* python/: Python bindings and test scripts
......@@ -502,15 +515,15 @@
* test/testiks.c: removed buggy unit test for previous entry,
since I couldn't figure out why it segfaulted. Will investigate
and fix later.
2002-01-07 Evan Prodromou <mr.bad@pigdog.org>
* core.c: fixed off-by-one bug with reallocation of attributes.
* test/testiks.c: added test for above bug.
2002-12-20 Evan Prodromou <mr.bad@pigdog.org>
* COPYING: New version of the LGPL.
* INSTALL: New FSF install info. Both of these were updated by autoreconf.
2002-12-12 Evan Prodromou <mr.bad@pigdog.org>
* include/iksemel.h: added id to Jabber packets.
* src/jabber.c: get ID in Jabber packets.
......@@ -531,7 +544,7 @@
* iks.c: fixed iks constructor/destructor so they mark pool owner
and only delete the pool if the iks is the owner.
* sha.c: changed sha objects to use pool memory.
2002-11-07 Evan Prodromou <mr.bad@pigdog.org>
* ikspool.c: added ALIGN_ON, ALIGNED(), *_OFFSET macros.
......@@ -556,7 +569,7 @@
* ikspool.c: For iks_pool_realloc, made it call _alloc if the
passed-in pointer is NULL. This is the way realloc() works.
* testpool.c: added a test for the above condition.
2002-11-04 Evan Prodromou <mr.bad@pigdog.org>
* ikspool.c: Added some comments.
......@@ -573,12 +586,12 @@
previously NULL.
* testid.c: added tests to check for above bug.
* test/.cvsignore: Ignore testpool and testid.
2002-11-03 Evan Prodromou <mr.bad@pigdog.org>
* iksid.c: fixed bug in iks_id_new with partial (no resource) IDs.
* testid.c: added tests to check for above bug.
2002-11-03 Evan Prodromou <mr.bad@pigdog.org>
* iksid.c: moved iksid functions to this file from jabber.c.
......@@ -587,13 +600,13 @@
made iks_id_new use iks_pool_set_owner if it creates a pool.
changed iks_id_new so it doesn't write on src.
* iksemel.h: added prototype for iks_id_delete.
* testid.c: created basic unit tests for iksid.
* testid.c: created basic unit tests for iksid.
2002-11-02 Evan Prodromou <mr.bad@pigdog.org>
* Added the beginnings of unit tests for memory allocation.
More needed.
2002-11-02 Evan Prodromou <mr.bad@pigdog.org>
* ikspool.c: added new best-fit memory allocation functions.
......
......@@ -105,12 +105,17 @@ AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
[AC_REQUIRE([AM_PATH_PYTHON])
AC_MSG_CHECKING(for headers required to compile python extensions)
dnl deduce PYTHON_INCLUDES
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`
py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`
PYTHON_CONFIG=`which $PYTHON`-config
if test -x "$PYTHON_CONFIG"; then
PYTHON_INCLUDES=`$PYTHON_CONFIG --includes 2>/dev/null`
else
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
if test "$py_prefix" != "$py_exec_prefix"; then
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
fi
fi
AC_SUBST(PYTHON_INCLUDES)
dnl check if the headers exist:
save_CPPFLAGS="$CPPFLAGS"
......@@ -126,8 +131,9 @@ CPPFLAGS="$save_CPPFLAGS"
dnl Check Python for binding
if test "x$with_python" = "xyes"; then
with_python=no
AM_PATH_PYTHON([2.2], , [:])
AM_CHECK_PYTHON_HEADERS(with_python=yes,[AC_MSG_ERROR(could not find Python headers)])
AM_PATH_PYTHON([3],, [:])
AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
AM_CHECK_PYTHON_HEADERS(with_python=yes, [AC_MSG_ERROR(could not find Python headers)])
fi
AM_CONDITIONAL([DO_PYTHON], [test "x$with_python" = "xyes"])
......
......@@ -9,4 +9,4 @@ pyexec_LTLIBRARIES = iksemel.la
iksemel_la_LIBADD = $(top_builddir)/src/libiksemel.la
iksemel_la_SOURCES = pyiksemel.c stream.c jid.c document.c reference.c exceptions.c
iksemel_la_CFLAGS = $(CFLAGS) -fno-strict-aliasing
iksemel_la_LDFLAGS = -avoid-version -module -export-symbols-regex initiksemel
iksemel_la_LDFLAGS = -avoid-version -module -export-symbols-regex PyInit_iksemel
......@@ -20,8 +20,7 @@ static PyObject *Iter_iter(Iter *self);
static PyObject *Iter_next(Iter *self);
static PyTypeObject Iter_type = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
PyVarObject_HEAD_INIT(NULL, 0)
"iksemel.Iter", /* tp_name */
sizeof(Iter), /* tp_basicsize */
0, /* tp_itemsize */
......@@ -160,8 +159,7 @@ static PyMethodDef Document_methods[] = {
};
static PyTypeObject Document_type = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
PyVarObject_HEAD_INIT(NULL, 0)
"iksemel.Document", /* tp_name */
sizeof(Document), /* tp_basicsize */
0, /* tp_itemsize */
......@@ -636,7 +634,7 @@ Document_dealloc(Document *self)
Py_DECREF(self->ref);
self->doc = NULL;
self->ref = NULL;
self->ob_type->tp_free((PyObject *) self);
PyTypeObject* ob_type(PyObject *self);
}
void
......
......@@ -9,7 +9,7 @@
// NOTE: This class uses custom implementation of JID parsing
// instead of the iks_id_new from jabber.c
//
//
typedef struct {
PyObject_HEAD
......@@ -30,8 +30,7 @@ static PyMemberDef JID_members[] = {
};
static PyTypeObject JID_type = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
PyVarObject_HEAD_INIT(NULL, 0)
"iksemel.JID", /* tp_name */
sizeof(JID), /* tp_basicsize */
0, /* tp_itemsize */
......@@ -120,18 +119,18 @@ JID_str(JID *self)
char *resource = "";
if (self->local && self->local != Py_None) {
local = PyString_AsString(self->local);
local = PyBytes_AsString(self->local);
if (!local) return NULL;
localsep = "@";
}
domain = PyString_AsString(self->domain);
domain = PyBytes_AsString(self->domain);
if (!domain) return NULL;
if (self->resource && self->resource != Py_None) {
resource = PyString_AsString(self->resource);
resource = PyBytes_AsString(self->resource);
if (!resource) return NULL;
resourcesep = "/";
}
return PyString_FromFormat("%s%s%s%s%s", local, localsep, domain, resourcesep, resource);
return PyBytes_FromFormat("%s%s%s%s%s", local, localsep, domain, resourcesep, resource);
}
static void
......@@ -140,7 +139,7 @@ JID_dealloc(JID *self)
if (self->local) { Py_DECREF(self->local); }
if (self->domain) { Py_DECREF(self->domain); }
if (self->resource) { Py_DECREF(self->resource); }
self->ob_type->tp_free((PyObject *) self);
PyTypeObject* ob_type(PyObject *self);
}
void
......
This diff is collapsed.
#ifndef NODE_H
#define NODE_H 1
#include <Python.h>
#include "iksemel.h"
/*** Setup ***/
void Setup_Node(PyObject *module);
/*** Types ***/
typedef struct {
PyObject_HEAD
Document *doc;
iks *node;
} Node;
static PyTypeObject Node_type;
#endif /* NODE_H */
......@@ -13,12 +13,35 @@
PyObject *iksemel_module;
/*static PyMethodDef methods[] = {
{ "parse", ciks_parse, METH_VARARGS,
"Parse given XML file and generate document tree."},
{ "parseString", ciks_parseString, METH_VARARGS,
"Parse given XML string and generate document tree."},
{ "newDocument", ciks_newDocument, METH_VARARGS,
"Create a new document with given root tag name."},
{ NULL, NULL, 0, NULL }
};*/
static struct PyModuleDef iksemeldef = {
PyModuleDef_HEAD_INIT,
"iksemel", /* m_name */
"This is a module", /* m_doc */
-1, /* m_size */
NULL, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
initiksemel(void)
PyInit_iksemel(void)
{
PyObject *m;
m = Py_InitModule("iksemel", NULL);
m = PyModule_Create(&iksemeldef);
exceptions_setup(m);
Reference_setup();
......@@ -27,4 +50,5 @@ initiksemel(void)
Stream_setup(m);
iksemel_module = m;
return m;
}
......@@ -13,8 +13,7 @@ typedef struct {
static void Reference_dealloc(Reference *self);
static PyTypeObject Reference_type = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
PyVarObject_HEAD_INIT(NULL, 0)
"iksemel.Reference", /* tp_name */
sizeof(Reference), /* tp_basicsize */
0, /* tp_itemsize */
......@@ -57,7 +56,7 @@ static PyTypeObject Reference_type = {
static void
Reference_dealloc(Reference *self)
{
self->ob_type->tp_free((PyObject *) self);
PyTypeObject* ob_type(PyObject *self);
}
void
......
......@@ -34,8 +34,7 @@ static PyMethodDef Stream_methods[] = {
};
static PyTypeObject Stream_type = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
PyVarObject_HEAD_INIT(NULL, 0)
"iksemel.Stream", /* tp_name */
sizeof(Stream), /* tp_basicsize */
0, /* tp_itemsize */
......@@ -86,7 +85,7 @@ start_sasl(Stream *self, enum ikssasltype type)
o = PyObject_GetAttrString(self->jid, "local");
if (!o) return;
local = PyString_AsString(o);
local = PyBytes_AsString(o);
if (!local) {
Py_DECREF(o);
return;
......@@ -103,7 +102,7 @@ start_sasl(Stream *self, enum ikssasltype type)
Py_DECREF(o);
return;
}
pw = PyString_AsString(ret);
pw = PyBytes_AsString(ret);
if (!pw) {
Py_DECREF(ret);
Py_DECREF(o);
......@@ -125,7 +124,7 @@ make_bind(Stream *self)
o = PyObject_GetAttrString(self->jid, "resource");
if (!o) return;
resource = PyString_AsString(o);
resource = PyBytes_AsString(o);
if (!resource) {
PyErr_Clear();
resource = "iksemel";
......@@ -179,7 +178,7 @@ on_success(Stream *self, iks *node)
o = PyObject_GetAttrString(self->jid, "domain");
if (!o) return;
domain = PyString_AsString(o);
domain = PyBytes_AsString(o);
if (!domain) {
Py_DECREF(o);
return;
......@@ -324,7 +323,7 @@ Stream_connect(Stream *self, PyObject *args, PyObject *kwargs)
o = PyObject_GetAttrString(self->jid, "domain");
if (!o) return NULL;
host = PyString_AsString(o);
host = PyBytes_AsString(o);
if (!host) {
Py_DECREF(o);
return NULL;
......@@ -359,7 +358,7 @@ Stream_send(Stream *self, PyObject *args)
s = PyObject_Str(s);
if (s) {
str = PyString_AsString(s);
str = PyBytes_AsString(s);
if (str) {
e = iks_send_raw(self->parser, str);
if (e) {
......@@ -393,7 +392,7 @@ Stream_dealloc(Stream *self)
{
if (self->jid) { Py_DECREF(self->jid); }
iks_parser_delete(self->parser);
self->ob_type->tp_free((PyObject *) self);
PyTypeObject* ob_type(PyObject *self);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment