diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-11 14:31:01 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:49:29 +0100 |
commit | 68dc2dc526e146dd0ac68d5d68eb55b601282caf (patch) | |
tree | 3cb17dbc091b56cd4293a7d9d095d71c93234094 /source4/lib/registry | |
parent | 78a4f5eadad447cd92f27a5fe4311eceea12f1f9 (diff) | |
download | samba-68dc2dc526e146dd0ac68d5d68eb55b601282caf.tar.gz samba-68dc2dc526e146dd0ac68d5d68eb55b601282caf.tar.bz2 samba-68dc2dc526e146dd0ac68d5d68eb55b601282caf.zip |
r26399: Use -O option for SWIG (less evil generated code).
(This used to be commit 3378b6a559272cb702b52966692bf423f67a2b41)
Diffstat (limited to 'source4/lib/registry')
-rw-r--r-- | source4/lib/registry/registry.py | 43 | ||||
-rw-r--r-- | source4/lib/registry/registry_wrap.c | 55 |
2 files changed, 60 insertions, 38 deletions
diff --git a/source4/lib/registry/registry.py b/source4/lib/registry/registry.py index b61d713df8..4e3d48a18c 100644 --- a/source4/lib/registry/registry.py +++ b/source4/lib/registry/registry.py @@ -2,7 +2,6 @@ # Version 1.3.33 # # Don't modify this file, modify the SWIG interface instead. -# This file is compatible with both classic and new-style classes. import _registry import new @@ -48,45 +47,43 @@ except AttributeError: 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 + + import credentials reg_get_predef_name = _registry.reg_get_predef_name str_regtype = _registry.str_regtype Registry = _registry.Registry -class reg(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, reg, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, reg, name) +class reg(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr __swig_destroy__ = _registry.delete_reg - __del__ = lambda self : None; - def get_predefined_key_by_name(*args, **kwargs): return _registry.reg_get_predefined_key_by_name(*args, **kwargs) - def get_predefined_key(*args, **kwargs): return _registry.reg_get_predefined_key(*args, **kwargs) - def apply_patchfile(*args, **kwargs): return _registry.reg_apply_patchfile(*args, **kwargs) - def mount_hive(*args, **kwargs): return _registry.reg_mount_hive(*args, **kwargs) def mount(self, path, hkey_id, elements=[]): self.mount_hive(Hive(path), hkey_id, elements) def __init__(self, *args, **kwargs): - this = _registry.new_reg(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _registry.reg_swiginit(self,_registry.new_reg(*args, **kwargs)) +reg.get_predefined_key_by_name = new_instancemethod(_registry.reg_get_predefined_key_by_name,None,reg) +reg.get_predefined_key = new_instancemethod(_registry.reg_get_predefined_key,None,reg) +reg.apply_patchfile = new_instancemethod(_registry.reg_apply_patchfile,None,reg) +reg.mount_hive = new_instancemethod(_registry.reg_mount_hive,None,reg) reg_swigregister = _registry.reg_swigregister reg_swigregister(reg) Hive = _registry.Hive -class hive(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, hive, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, hive, name) +class hive(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr __swig_destroy__ = _registry.delete_hive - __del__ = lambda self : None; def __init__(self, *args, **kwargs): - this = _registry.new_hive(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _registry.hive_swiginit(self,_registry.new_hive(*args, **kwargs)) hive_swigregister = _registry.hive_swigregister hive_swigregister(hive) diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c index 3ab0af10b5..15c27a8f6c 100644 --- a/source4/lib/registry/registry_wrap.c +++ b/source4/lib/registry/registry_wrap.c @@ -9,7 +9,7 @@ * ----------------------------------------------------------------------------- */ #define SWIGPYTHON -#define SWIG_PYTHON_DIRECTOR_NO_VTABLE +#define SWIG_PYTHON_NO_BUILD_NONE /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. @@ -2487,6 +2487,19 @@ static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0}; # error "This python version requires swig to be run with the '-classic' option" # endif #endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodern' option" +#endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodernargs' option" +#endif +#ifndef METH_O +# error "This python version requires swig to be run with the '-nofastunpack' option" +#endif +#ifdef SWIG_TypeQuery +# undef SWIG_TypeQuery +#endif +#define SWIG_TypeQuery SWIG_Python_TypeQuery /*----------------------------------------------- @(target):= _registry.so @@ -2954,10 +2967,11 @@ SWIGINTERN PyObject *_wrap_delete_reg(PyObject *SWIGUNUSEDPARM(self), PyObject * reg *arg1 = (reg *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_reg",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_registry_context, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_registry_context, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_reg" "', argument " "1"" of type '" "reg *""'"); } @@ -3204,7 +3218,7 @@ SWIGINTERN PyObject *_wrap_new_reg(PyObject *SWIGUNUSEDPARM(self), PyObject *arg PyObject *resultobj = 0; reg *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_reg")) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args,"new_reg",0,0,0)) SWIG_fail; result = (reg *)(reg *) calloc(1, sizeof(reg)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_registry_context, SWIG_POINTER_NEW | 0 ); return resultobj; @@ -3215,11 +3229,15 @@ fail: SWIGINTERN PyObject *reg_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_registry_context, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *reg_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_Hive(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ; @@ -3301,10 +3319,11 @@ SWIGINTERN PyObject *_wrap_delete_hive(PyObject *SWIGUNUSEDPARM(self), PyObject hive *arg1 = (hive *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_hive",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_hive_key, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_hive_key, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_hive" "', argument " "1"" of type '" "hive *""'"); } @@ -3322,7 +3341,7 @@ SWIGINTERN PyObject *_wrap_new_hive(PyObject *SWIGUNUSEDPARM(self), PyObject *ar PyObject *resultobj = 0; hive *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_hive")) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args,"new_hive",0,0,0)) SWIG_fail; result = (hive *)(hive *) calloc(1, sizeof(hive)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_hive_key, SWIG_POINTER_NEW | 0 ); return resultobj; @@ -3333,11 +3352,15 @@ fail: SWIGINTERN PyObject *hive_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_hive_key, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *hive_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ; @@ -3414,17 +3437,19 @@ static PyMethodDef SwigMethods[] = { { (char *)"reg_get_predef_name", (PyCFunction) _wrap_reg_get_predef_name, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"str_regtype", (PyCFunction) _wrap_str_regtype, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Registry", (PyCFunction) _wrap_Registry, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"delete_reg", _wrap_delete_reg, METH_VARARGS, NULL}, + { (char *)"delete_reg", (PyCFunction)_wrap_delete_reg, METH_O, NULL}, { (char *)"reg_get_predefined_key_by_name", (PyCFunction) _wrap_reg_get_predefined_key_by_name, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"reg_get_predefined_key", (PyCFunction) _wrap_reg_get_predefined_key, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"reg_apply_patchfile", (PyCFunction) _wrap_reg_apply_patchfile, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"reg_mount_hive", (PyCFunction) _wrap_reg_mount_hive, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"new_reg", _wrap_new_reg, METH_VARARGS, NULL}, + { (char *)"new_reg", (PyCFunction)_wrap_new_reg, METH_NOARGS, NULL}, { (char *)"reg_swigregister", reg_swigregister, METH_VARARGS, NULL}, + { (char *)"reg_swiginit", reg_swiginit, METH_VARARGS, NULL}, { (char *)"Hive", (PyCFunction) _wrap_Hive, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"delete_hive", _wrap_delete_hive, METH_VARARGS, NULL}, - { (char *)"new_hive", _wrap_new_hive, METH_VARARGS, NULL}, + { (char *)"delete_hive", (PyCFunction)_wrap_delete_hive, METH_O, NULL}, + { (char *)"new_hive", (PyCFunction)_wrap_new_hive, METH_NOARGS, NULL}, { (char *)"hive_swigregister", hive_swigregister, METH_VARARGS, NULL}, + { (char *)"hive_swiginit", hive_swiginit, METH_VARARGS, NULL}, { (char *)"open_samba", (PyCFunction) _wrap_open_samba, METH_VARARGS | METH_KEYWORDS, NULL}, { NULL, NULL, 0, NULL } }; |