summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-12-21 16:32:47 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-12-21 16:32:47 +0100
commitf06b083ff3498e9a2157fdab687e2600a9b8ca72 (patch)
tree3d710e3e5fac7d7cd4bd209018c25299c762aac2
parent676919872df9d108289ba989e55f64eb78e66860 (diff)
downloadsamba-f06b083ff3498e9a2157fdab687e2600a9b8ca72.tar.gz
samba-f06b083ff3498e9a2157fdab687e2600a9b8ca72.tar.bz2
samba-f06b083ff3498e9a2157fdab687e2600a9b8ca72.zip
Convert param Python module to "manual" C.
-rw-r--r--source4/param/config.mk10
-rw-r--r--source4/param/param.i360
-rw-r--r--source4/param/param.py267
-rw-r--r--source4/param/param_wrap.c4882
-rw-r--r--source4/param/pyparam.c167
5 files changed, 20 insertions, 5666 deletions
diff --git a/source4/param/config.mk b/source4/param/config.mk
index 18354ea2195..1341a92bbdc 100644
--- a/source4/param/config.mk
+++ b/source4/param/config.mk
@@ -58,11 +58,9 @@ PRIVATE_DEPENDENCIES = LIBLDB TDB_WRAP UTIL_TDB NDR_SECURITY
SECRETS_OBJ_FILES = $(paramsrcdir)/secrets.o
[PYTHON::param]
-LIBRARY_REALNAME = samba/_param.$(SHLIBEXT)
-PRIVATE_DEPENDENCIES = LIBSAMBA-HOSTCONFIG
+LIBRARY_REALNAME = samba/param.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = LIBSAMBA-HOSTCONFIG PYTALLOC
-param_OBJ_FILES = $(paramsrcdir)/param_wrap.o
+param_OBJ_FILES = $(paramsrcdir)/pyparam.o
-$(eval $(call python_py_module_template,samba/param.py,$(paramsrcdir)/param.py))
-
-$(param_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
+$(param_OBJ_FILES): CFLAGS+=$(CFLAG_NO_CAST_QUAL)
diff --git a/source4/param/param.i b/source4/param/param.i
deleted file mode 100644
index c04c9279f49..00000000000
--- a/source4/param/param.i
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-%module(docstring="Parsing and writing Samba configuration files.",package="samba.param") param
-
-%{
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "includes.h"
-#include "param/param.h"
-#include "param/loadparm.h"
-
-typedef struct param_context param;
-typedef struct loadparm_context loadparm_context;
-typedef struct loadparm_service loadparm_service;
-typedef struct param_section param_section;
-typedef struct param_opt param_opt;
-%}
-
-%import "stdint.i"
-%import "carrays.i"
-%import "typemaps.i"
-%import "../lib/talloc/talloc.i"
-
-%typemap(default,noblock=1) struct loadparm_context * {
- $1 = loadparm_init(NULL);
-}
-
-%rename(LoadParm) loadparm_context;
-
-%talloctype(loadparm_context);
-
-typedef struct loadparm_context {
- %extend {
- loadparm_context(TALLOC_CTX *mem_ctx) { return loadparm_init(mem_ctx); }
- struct loadparm_service *default_service() { return lp_default_service($self); }
- %feature("docstring") load "S.load(filename) -> None\n" \
- "Load specified file.";
- bool load(const char *filename) { return lp_load($self, filename); }
- %feature("docstring") load_default "S.load_default() -> None\n" \
- "Load default smb.conf file.";
- bool load_default() { return lp_load_default($self); }
-#ifdef SWIGPYTHON
- int __len__() { return lp_numservices($self); }
- struct loadparm_service *__getitem__(const char *name) { return lp_service($self, name); }
-#endif
- %feature("docstring") configfile "S.configfile() -> string\n" \
- "Return name of last config file that was loaded.";
- const char *configfile() { return lp_configfile($self); }
- %feature("docstring") is_mydomain "S.is_mydomain(domain_name) -> bool\n" \
- "Check whether the specified name matches our domain name.";
- bool is_mydomain(const char *domain) { return lp_is_mydomain($self, domain); }
- %feature("docstring") is_myname "S.is_myname(netbios_name) -> bool\n" \
- "Check whether the specified name matches one of our netbios names.";
- bool is_myname(const char *name) { return lp_is_myname($self, name); }
- int use(struct param_context *param_ctx) { return param_use($self, param_ctx); }
- %feature("docstring") set "S.set(name, value) -> bool\n" \
- "Change a parameter.";
- bool set(const char *parm_name, const char *parm_value) {
- if (parm_value == NULL)
- return false;
- return lp_set_cmdline($self, parm_name, parm_value);
- }
-
- char *private_path(const char *name, TALLOC_CTX *mem_ctx) {
- return private_path(mem_ctx, $self, name);
- }
-
- %feature("docstring") set "S.get(name, service_name) -> value\n" \
- "Find specified parameter.";
- PyObject *get(const char *param_name, const char *service_name)
- {
- struct parm_struct *parm = NULL;
- void *parm_ptr = NULL;
- int i;
-
- if (service_name != NULL) {
- struct loadparm_service *service;
- /* its a share parameter */
- service = lp_service($self, service_name);
- if (service == NULL) {
- return Py_None;
- }
- if (strchr(param_name, ':')) {
- /* its a parametric option on a share */
- const char *type = talloc_strndup($self,
- param_name,
- strcspn(param_name, ":"));
- const char *option = strchr(param_name, ':') + 1;
- const char *value;
- if (type == NULL || option == NULL) {
- return Py_None;
- }
- value = lp_get_parametric($self, service, type, option);
- if (value == NULL) {
- return Py_None;
- }
- return PyString_FromString(value);
- }
-
- parm = lp_parm_struct(param_name);
- if (parm == NULL || parm->class == P_GLOBAL) {
- return Py_None;
- }
- parm_ptr = lp_parm_ptr($self, service, parm);
- } else if (strchr(param_name, ':')) {
- /* its a global parametric option */
- const char *type = talloc_strndup($self,
- param_name, strcspn(param_name, ":"));
- const char *option = strchr(param_name, ':') + 1;
- const char *value;
- if (type == NULL || option == NULL) {
- return Py_None;
- }
- value = lp_get_parametric($self, NULL, type, option);
- if (value == NULL)
- return Py_None;
- return PyString_FromString(value);
- } else {
- /* its a global parameter */
- parm = lp_parm_struct(param_name);
- if (parm == NULL) {
- return Py_None;
- }
- parm_ptr = lp_parm_ptr($self, NULL, parm);
- }
-
- if (parm == NULL || parm_ptr == NULL) {
- return Py_None;
- }
-
- /* construct and return the right type of python object */
- switch (parm->type) {
- case P_STRING:
- case P_USTRING:
- return PyString_FromString(*(char **)parm_ptr);
- case P_BOOL:
- return PyBool_FromLong(*(bool *)parm_ptr);
- case P_INTEGER:
- case P_OCTAL:
- case P_BYTES:
- return PyLong_FromLong(*(int *)parm_ptr);
- case P_ENUM:
- for (i=0; parm->enum_list[i].name; i++) {
- if (*(int *)parm_ptr == parm->enum_list[i].value) {
- return PyString_FromString(parm->enum_list[i].name);
- }
- }
- return Py_None;
- case P_LIST:
- {
- int j;
- const char **strlist = *(const char ***)parm_ptr;
- PyObject *pylist = PyList_New(str_list_length(strlist));
- for (j = 0; strlist[j]; j++)
- PyList_SetItem(pylist, j,
- PyString_FromString(strlist[j]));
- return pylist;
- }
-
- break;
- }
- return Py_None;
- }
- }
-} loadparm_context;
-
-%nodefaultctor loadparm_service;
-%nodefaultdtor loadparm_service;
-
-typedef struct loadparm_service {
- %extend {
- const char *volume_label(struct loadparm_service *sDefault) { return volume_label($self, sDefault); }
- const char *printername(struct loadparm_service *sDefault) { return lp_printername($self, sDefault); }
- int maxprintjobs(struct loadparm_service *sDefault) { return lp_maxprintjobs($self, sDefault); }
- }
-} loadparm_service;
-
-%rename(ParamFile) param_context;
-
-%talloctype(param_context);
-typedef struct param_context {
- %extend {
- param(TALLOC_CTX *mem_ctx) { return param_init(mem_ctx); }
- %feature("docstring") add_section "S.get_section(name) -> section\n"
- "Get an existing section.";
- struct param_section *get_section(const char *name);
- %feature("docstring") add_section "S.add_section(name) -> section\n"
- "Add a new section.";
- struct param_section *add_section(const char *name);
- struct param_opt *get(const char *name, const char *section_name="global");
- const char *get_string(const char *name, const char *section_name="global");
- int set_string(const char *param, const char *value, const char *section="global");
-#ifdef SWIGPYTHON
- int set(const char *parameter, PyObject *ob, const char *section_name="global")
- {
- struct param_opt *opt = param_get_add($self, parameter, section_name);
-
- talloc_free(opt->value);
- opt->value = talloc_strdup(opt, PyString_AsString(PyObject_Str(ob)));
-
- return 0;
- }
-
-#endif
-
- %feature("docstring") first_section "S.first_section() -> section\n"
- "Find first section";
- struct param_section *first_section() { return $self->sections; }
- %feature("docstring") next_section "S.next_section(prev) -> section\n"
- "Find next section";
- struct param_section *next_section(struct param_section *s) { return s->next; }
-
- %feature("docstring") read "S.read(filename) -> bool\n"
- "Read a filename.";
- int read(const char *fn);
- %feature("docstring") read "S.write(filename) -> bool\n"
- "Write this object to a file.";
- int write(const char *fn);
- }
- %pythoncode {
- def __getitem__(self, name):
- ret = self.get_section(name)
- if ret is None:
- raise KeyError("No such section %s" % name)
- return ret
-
- class SectionIterator:
- def __init__(self, param):
- self.param = param
- self.key = None
-
- def __iter__(self):
- return self
-
- def next(self):
- if self.key is None:
- self.key = self.param.first_section()
- if self.key is None:
- raise StopIteration
- return self.key
- else:
- self.key = self.param.next_section(self.key)
- if self.key is None:
- raise StopIteration
- return self.key
-
- def __iter__(self):
- return self.SectionIterator(self)
- }
-} param;
-
-%talloctype(param_opt);
-
-typedef struct param_opt {
- %immutable key;
- %immutable value;
- const char *key, *value;
- %extend {
-#ifdef SWIGPYTHON
- const char *__str__() { return $self->value; }
-#endif
- }
-} param_opt;
-
-%talloctype(param);
-typedef struct param_section {
- %immutable name;
- const char *name;
- %extend {
- struct param_opt *get(const char *name);
- struct param_opt *first_parameter() { return $self->parameters; }
- struct param_opt *next_parameter(struct param_opt *s) { return s->next; }
- }
- %pythoncode {
- def __getitem__(self, name):
- ret = self.get(name)
- if ret is None:
- raise KeyError("No such option %s" % name)
- return ret
-
- class ParamIterator:
- def __init__(self, section):
- self.section = section
- self.key = None
-
- def __iter__(self):
- return self
-
- def next(self):
- if self.key is None:
- self.key = self.section.first_parameter()
- if self.key is None:
- raise StopIteration
- return self.key
- else:
- self.key = self.section.next_parameter(self.key)
- if self.key is None:
- raise StopIteration
- return self.key
-
- def __iter__(self):
- return self.ParamIterator(self)
- }
-} param_section;
-
-%{
-
-struct loadparm_context *lp_from_py_object(PyObject *py_obj)
-{
- struct loadparm_context *lp_ctx;
- if (PyString_Check(py_obj)) {
- lp_ctx = loadparm_init(NULL);
- if (!lp_load(lp_ctx, PyString_AsString(py_obj))) {
- talloc_free(lp_ctx);
- return NULL;
- }
- return lp_ctx;
- }
-
- if (py_obj == Py_None) {
- lp_ctx = loadparm_init(NULL);
- if (!lp_load_default(lp_ctx)) {
- talloc_free(lp_ctx);
- return NULL;
- }
- return lp_ctx;
- }
-
- if (SWIG_ConvertPtr(py_obj, (void *)&lp_ctx, SWIGTYPE_p_loadparm_context, 0 | 0 ) < 0)
- return NULL;
- return lp_ctx;
-}
-
-struct loadparm_context *py_default_loadparm_context(TALLOC_CTX *mem_ctx)
-{
- struct loadparm_context *ret;
- ret = loadparm_init(mem_ctx);
- if (!lp_load_default(ret))
- return NULL;
- return ret;
-}
-
-%}
diff --git a/source4/param/param.py b/source4/param/param.py
deleted file mode 100644
index 3662c99a9c4..00000000000
--- a/source4/param/param.py
+++ /dev/null
@@ -1,267 +0,0 @@
-# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.36
-#
-# Don't modify this file, modify the SWIG interface instead.
-
-"""
-Parsing and writing Samba configuration files.
-"""
-
-import _param
-import new
-new_instancemethod = new.instancemethod
-try:
- _swig_property = property
-except NameError:
- pass # Python < 2.2 doesn't have 'property'.
-def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
- if (name == "thisown"): return self.this.own(value)
- if (name == "this"):
- if type(value).__name__ == 'PySwigObject':
- self.__dict__[name] = value
- return
- method = class_type.__swig_setmethods__.get(name,None)
- if method: return method(self,value)
- if (not static) or hasattr(self,name):
- self.__dict__[name] = value
- else:
- raise AttributeError("You cannot add attributes to %s" % self)
-
-def _swig_setattr(self,class_type,name,value):
- return _swig_setattr_nondynamic(self,class_type,name,value,0)
-
-def _swig_getattr(self,class_type,name):
- if (name == "thisown"): return self.this.own()
- method = class_type.__swig_getmethods__.get(name,None)
- if method: return method(self)
- raise AttributeError,name
-
-def _swig_repr(self):
- try: strthis = "proxy of " + self.this.__repr__()
- except: strthis = ""
- return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
-
-import types
-try:
- _object = types.ObjectType
- _newclass = 1
-except AttributeError:
- class _object : pass
- _newclass = 0
-del types
-
-
-def _swig_setattr_nondynamic_method(set):
- def set_attr(self,name,value):
- if (name == "thisown"): return self.this.own(value)
- if hasattr(self,name) or (name == "this"):
- set(self,name,value)
- else:
- raise AttributeError("You cannot add attributes to %s" % self)
- return set_attr
-
-
-class LoadParm(object):
- thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
- __repr__ = _swig_repr
- def __init__(self, *args, **kwargs):
- _param.LoadParm_swiginit(self,_param.new_LoadParm(*args, **kwargs))
- def load(*args, **kwargs):
- """
- S.load(filename) -> None
- Load specified file.
- """
- return _param.LoadParm_load(*args, **kwargs)
-
- def load_default(*args, **kwargs):
- """
- S.load_default() -> None
- Load default smb.conf file.
- """
- return _param.LoadParm_load_default(*args, **kwargs)
-
- def configfile(*args, **kwargs):
- """
- S.configfile() -> string
- Return name of last config file that was loaded.
- """
- return _param.LoadParm_configfile(*args, **kwargs)
-
- def is_mydomain(*args, **kwargs):
- """
- S.is_mydomain(domain_name) -> bool
- Check whether the specified name matches our domain name.
- """
- return _param.LoadParm_is_mydomain(*args, **kwargs)
-
- def is_myname(*args, **kwargs):
- """
- S.is_myname(netbios_name) -> bool
- Check whether the specified name matches one of our netbios names.
- """
- return _param.LoadParm_is_myname(*args, **kwargs)
-
- def set(*args, **kwargs):
- """
- S.set(name, value) -> bool
- Change a parameter.
- """
- return _param.LoadParm_set(*args, **kwargs)
-
- __swig_destroy__ = _param.delete_LoadParm
-LoadParm.default_service = new_instancemethod(_param.LoadParm_default_service,None,LoadParm)
-LoadParm.load = new_instancemethod(_param.LoadParm_load,None,LoadParm)
-LoadParm.load_default = new_instancemethod(_param.LoadParm_load_default,None,LoadParm)
-LoadParm.__len__ = new_instancemethod(_param.LoadParm___len__,None,LoadParm)
-LoadParm.__getitem__ = new_instancemethod(_param.LoadParm___getitem__,None,LoadParm)
-LoadParm.configfile = new_instancemethod(_param.LoadParm_configfile,None,LoadParm)
-LoadParm.is_mydomain = new_instancemethod(_param.LoadParm_is_mydomain,None,LoadParm)
-LoadParm.is_myname = new_instancemethod(_param.LoadParm_is_myname,None,LoadParm)
-LoadParm.use = new_instancemethod(_param.LoadParm_use,None,LoadParm)
-LoadParm.set = new_instancemethod(_param.LoadParm_set,None,LoadParm)
-LoadParm.private_path = new_instancemethod(_param.LoadParm_private_path,None,LoadParm)
-LoadParm.get = new_instancemethod(_param.LoadParm_get,None,LoadParm)
-LoadParm_swigregister = _param.LoadParm_swigregister
-LoadParm_swigregister(LoadParm)
-
-class loadparm_service(object):
- thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
- def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
- __repr__ = _swig_repr
-loadparm_service.volume_label = new_instancemethod(_param.loadparm_service_volume_label,None,loadparm_service)
-loadparm_service.printername = new_instancemethod(_param.loadparm_service_printername,None,loadparm_service)
-loadparm_service.maxprintjobs = new_instancemethod(_param.loadparm_service_maxprintjobs,None,loadparm_service)
-loadparm_service_swigregister = _param.loadparm_service_swigregister
-loadparm_service_swigregister(loadparm_service)
-
-class ParamFile(object):
- thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
- __repr__ = _swig_repr
- def __init__(self, *args, **kwargs):
- _param.ParamFile_swiginit(self,_param.new_ParamFile(*args, **kwargs))
- def add_section(*args, **kwargs):
- """
- S.add_section(name) -> section
- Add a new section.
- """
- return _param.ParamFile_add_section(*args, **kwargs)
-
- def first_section(*args, **kwargs):
- """
- S.first_section() -> section
- Find first section
- """
- return _param.ParamFile_first_section(*args, **kwargs)
-
- def next_section(*args, **kwargs):
- """
- S.next_section(prev) -> section
- Find next section
- """
- return _param.ParamFile_next_section(*args, **kwargs)
-
- def read(*args, **kwargs):
- """
- S.read(filename) -> bool
- Read a filename.
- """
- return _param.ParamFile_read(*args, **kwargs)
-
- def __getitem__(self, name):
- ret = self.get_section(name)
- if ret is None:
- raise KeyError("No such section %s" % name)
- return ret
-
- class SectionIterator:
- def __init__(self, param):
- self.param = param
- self.key = None
-
- def __iter__(self):
- return self
-
- def next(self):
- if self.key is None:
- self.key = self.param.first_section()
- if self.key is None:
- raise StopIteration
- return self.key
- else:
- self.key = self.param.next_section(self.key)
- if self.key is None:
- raise StopIteration
- return self.key
-
- def __iter__(self):
- return self.SectionIterator(self)
-
- __swig_destroy__ = _param.delete_ParamFile
-ParamFile.get_section = new_instancemethod(_param.ParamFile_get_section,None,ParamFile)
-ParamFile.add_section = new_instancemethod(_param.ParamFile_add_section,None,ParamFile)
-ParamFile.get = new_instancemethod(_param.ParamFile_get,None,ParamFile)
-ParamFile.get_string = new_instancemethod(_param.ParamFile_get_string,None,ParamFile)
-ParamFile.set_string = new_instancemethod(_param.ParamFile_set_string,None,ParamFile)
-ParamFile.set = new_instancemethod(_param.ParamFile_set,None,ParamFile)
-ParamFile.first_section = new_instancemethod(_param.ParamFile_first_section,None,ParamFile)
-ParamFile.next_section = new_instancemethod(_param.ParamFile_next_section,None,ParamFile)
-ParamFile.read = new_instancemethod(_param.ParamFile_read,None,ParamFile)
-ParamFile.write = new_instancemethod(_param.ParamFile_write,None,ParamFile)
-ParamFile_swigregister = _param.ParamFile_swigregister
-ParamFile_swigregister(ParamFile)
-
-class param_opt(object):
- thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
- def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
- __repr__ = _swig_repr
- key = _swig_property(_param.param_opt_key_get)
- value = _swig_property(_param.param_opt_value_get)
- __swig_destroy__ = _param.delete_param_opt
-param_opt.__str__ = new_instancemethod(_param.param_opt___str__,None,param_opt)
-param_opt_swigregister = _param.param_opt_swigregister
-param_opt_swigregister(param_opt)
-
-class param_section(object):
- thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
- __repr__ = _swig_repr
- name = _swig_property(_param.param_section_name_get)
- def __getitem__(self, name):
- ret = self.get(name)
- if ret is None:
- raise KeyError("No such option %s" % name)
- return ret
-
- class ParamIterator:
- def __init__(self, section):
- self.section = section
- self.key = None
-
- def __iter__(self):
- return self
-
- def next(self):
- if self.key is None:
- self.key = self.section.first_parameter()
- if self.key is None:
- raise StopIteration
- return self.key
- else:
- self.key = self.section.next_parameter(self.key)
- if self.key is None:
- raise StopIteration
- return self.key
-
- def __iter__(self):
- return self.ParamIterator(self)
-
- def __init__(self, *args, **kwargs):
- _param.param_section_swiginit(self,_param.new_param_section(*args, **kwargs))
- __swig_destroy__ = _param.delete_param_section
-param_section.get = new_instancemethod(_param.param_section_get,None,param_section)
-param_section.first_parameter = new_instancemethod(_param.param_section_first_parameter,None,param_section)
-param_section.next_parameter = new_instancemethod(_param.param_section_next_parameter,None,param_section)
-param_section_swigregister = _param.param_section_swigregister
-param_section_swigregister(param_section)
-
-
-
diff --git a/source4/param/param_wrap.c b/source4/param/param_wrap.c
deleted file mode 100644
index 596c21038ef..00000000000
--- a/source4/param/param_wrap.c
+++ /dev/null
@@ -1,4882 +0,0 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.36
- *
- * This file is not intended to be easily readable and contains a number of
- * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG
- * interface file instead.
- * ----------------------------------------------------------------------------- */
-
-#define SWIGPYTHON
-#define SWIG_PYTHON_NO_BUILD_NONE
-/* -----------------------------------------------------------------------------
- * This section contains generic SWIG labels for method/variable
- * declarations/attributes, and other compiler dependent labels.
- * ----------------------------------------------------------------------------- */
-
-/* template workaround for compilers that cannot correctly implement the C++ standard */
-#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-# define SWIGTEMPLATEDISAMBIGUATOR
-# endif
-#endif
-
-/* inline attribute */
-#ifndef SWIGINLINE
-# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
-# define SWIGINLINE inline
-# else
-# define SWIGINLINE
-# endif
-#endif
-
-/* attribute recognised by some compilers to avoid 'unused' warnings */
-#ifndef SWIGUNUSED
-# if defined(__GNUC__)
-# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-# define SWIGUNUSED __attribute__ ((__unused__))
-# else
-# define SWIGUNUSED
-# endif
-# elif defined(__ICC)
-# define SWIGUNUSED __attribute__ ((__unused__))
-# else
-# define SWIGUNUSED
-# endif
-#endif
-
-#ifndef SWIG_MSC_UNSUPPRESS_4505
-# if defined(_MSC_VER)
-# pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif
-#endif
-
-#ifndef SWIGUNUSEDPARM
-# ifdef __cplusplus
-# define SWIGUNUSEDPARM(p)
-# else
-# define SWIGUNUSEDPARM(p) p SWIGUNUSED
-# endif
-#endif
-
-/* internal SWIG method */
-#ifndef SWIGINTERN
-# define SWIGINTERN static SWIGUNUSED
-#endif
-
-/* internal inline SWIG method */
-#ifndef SWIGINTERNINLINE
-# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
-#endif
-
-/* exporting methods */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-# ifndef GCC_HASCLASSVISIBILITY
-# define GCC_HASCLASSVISIBILITY
-# endif
-#endif
-
-#ifndef SWIGEXPORT
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# if defined(STATIC_LINKED)
-# define SWIGEXPORT
-# else
-# define SWIGEXPORT __declspec(dllexport)
-# endif
-# else
-# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
-# define SWIGEXPORT __attribute__ ((visibility("default")))
-# else
-# define SWIGEXPORT
-# endif
-# endif
-#endif
-
-/* calling conventions for Windows */
-#ifndef SWIGSTDCALL
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# define SWIGSTDCALL __stdcall
-# else
-# define SWIGSTDCALL
-# endif
-#endif
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
-
-/* Python.h has to appear first */
-#include <Python.h>
-
-/* -----------------------------------------------------------------------------
- * swigrun.swg
- *
- * This file contains generic CAPI SWIG runtime support for pointer
- * type checking.
- * ----------------------------------------------------------------------------- */
-
-/* This should only be incremented when either the layout of swig_type_info changes,
- or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "4"
-
-/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
-#ifdef SWIG_TYPE_TABLE
-# define SWIG_QUOTE_STRING(x) #x
-# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
-# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
-#else
-# define SWIG_TYPE_TABLE_NAME
-#endif
-
-/*
- You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
- creating a static or dynamic library from the swig runtime code.
- In 99.9% of the cases, swig just needs to declare them as 'static'.
-
- But only do this if is strictly necessary, ie, if you have problems
- with your compiler or so.
-*/
-
-#ifndef SWIGRUNTIME
-# define SWIGRUNTIME SWIGINTERN
-#endif
-
-#ifndef SWIGRUNTIMEINLINE
-# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
-#endif
-
-/* Generic buffer size */
-#ifndef SWIG_BUFFER_SIZE
-# define SWIG_BUFFER_SIZE 1024
-#endif
-
-/* Flags for pointer conversions */
-#define SWIG_POINTER_DISOWN 0x1
-#define SWIG_CAST_NEW_MEMORY 0x2
-
-/* Flags for new pointer objects */
-#define SWIG_POINTER_OWN 0x1
-
-
-/*
- Flags/methods for returning states.
-
- The swig conversion methods, as ConvertPtr, return and integer
- that tells if the conversion was successful or not. And if not,
- an error code can be returned (see swigerrors.swg for the codes).
-
- Use the following macros/flags to set or process the returning
- states.
-
- In old swig versions, you usually write code as:
-
- if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
- // success code
- } else {
- //fail code
- }
-
- Now you can be more explicit as:
-
- int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
- if (SWIG_IsOK(res)) {
- // success code
- } else {
- // fail code
- }
-
- that seems to be the same, but now you can also do
-
- Type *ptr;
- int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
- if (SWIG_IsOK(res)) {
- // success code
- if (SWIG_IsNewObj(res) {
- ...
- delete *ptr;
- } else {
- ...
- }
- } else {
- // fail code
- }
-
- I.e., now SWIG_ConvertPtr can return new objects and you can
- identify the case and take care of the deallocation. Of course that
- requires also to SWIG_ConvertPtr to return new result values, as
-
- int SWIG_ConvertPtr(obj, ptr,...) {
- if (<obj is ok>) {
- if (<need new object>) {
- *ptr = <ptr to new allocated object>;
- return SWIG_NEWOBJ;
- } else {
- *ptr = <ptr to old object>;
- return SWIG_OLDOBJ;
- }
- } else {
- return SWIG_BADOBJ;
- }
- }
-
- Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
- more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
- swig errors code.
-
- Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
- allows to return the 'cast rank', for example, if you have this
-
- int food(double)
- int fooi(int);
-
- and you call
-
- food(1) // cast rank '1' (1 -> 1.0)
- fooi(1) // cast rank '0'
-
- just use the SWIG_AddCast()/SWIG_CheckState()
-
-
- */
-#define SWIG_OK (0)
-#define SWIG_ERROR (-1)
-#define SWIG_IsOK(r) (r >= 0)
-#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
-
-/* The CastRankLimit says how many bits are used for the cast rank */
-#define SWIG_CASTRANKLIMIT (1 << 8)
-/* The NewMask denotes the object was created (using new/malloc) */
-#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
-/* The TmpMask is for in/out typemaps that use temporal objects */