summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2011-08-10 15:15:18 +0200
committerJelmer Vernooij <jelmer@samba.org>2011-08-10 15:36:21 +0200
commitf8ec7f6cb19c4cc27398bdc0482b531e601d4291 (patch)
tree52c06e88c413547579c9e804a5c78d96e46bd4ba /pidl/lib/Parse/Pidl
parent8338fe4bfbc935e3cff059383dd07d419f58c696 (diff)
downloadsamba-f8ec7f6cb19c4cc27398bdc0482b531e601d4291.tar.gz
samba-f8ec7f6cb19c4cc27398bdc0482b531e601d4291.tar.bz2
samba-f8ec7f6cb19c4cc27398bdc0482b531e601d4291.zip
pytalloc: Use consistent prefix for functions, add ABI file.
Diffstat (limited to 'pidl/lib/Parse/Pidl')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm36
1 files changed, 18 insertions, 18 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 1622e71efb..63f4b2baef 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -200,9 +200,9 @@ sub PythonStruct($$$$$$)
$self->pidl("static PyObject *py_$name\_get_$e->{NAME}(PyObject *obj, void *closure)");
$self->pidl("{");
$self->indent;
- $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(obj);");
+ $self->pidl("$cname *object = ($cname *)pytalloc_get_ptr(obj);");
$self->pidl("PyObject *py_$e->{NAME};");
- $self->ConvertObjectToPython("py_talloc_get_mem_ctx(obj)", $env, $e, $varname, "py_$e->{NAME}", "return NULL;");
+ $self->ConvertObjectToPython("pytalloc_get_mem_ctx(obj)", $env, $e, $varname, "py_$e->{NAME}", "return NULL;");
$self->pidl("return py_$e->{NAME};");
$self->deindent;
$self->pidl("}");
@@ -211,14 +211,14 @@ sub PythonStruct($$$$$$)
$self->pidl("static int py_$name\_set_$e->{NAME}(PyObject *py_obj, PyObject *value, void *closure)");
$self->pidl("{");
$self->indent;
- $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(py_obj);");
- my $mem_ctx = "py_talloc_get_mem_ctx(py_obj)";
+ $self->pidl("$cname *object = ($cname *)pytalloc_get_ptr(py_obj);");
+ my $mem_ctx = "pytalloc_get_mem_ctx(py_obj)";
my $l = $e->{LEVELS}[0];
my $nl = GetNextLevel($e, $l);
if ($l->{TYPE} eq "POINTER" and
not ($nl->{TYPE} eq "ARRAY" and ($nl->{IS_FIXED} or is_charset_array($e, $nl))) and
not ($nl->{TYPE} eq "DATA" and Parse::Pidl::Typelist::scalar_is_reference($nl->{DATA_TYPE}))) {
- $self->pidl("talloc_unlink(py_talloc_get_mem_ctx(py_obj), $varname);");
+ $self->pidl("talloc_unlink(pytalloc_get_mem_ctx(py_obj), $varname);");
}
$self->ConvertObjectFromPython($env, $mem_ctx, $e, "value", $varname, "return -1;");
$self->pidl("return 0;");
@@ -242,7 +242,7 @@ sub PythonStruct($$$$$$)
$self->pidl("static PyObject *py_$name\_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)");
$self->pidl("{");
$self->indent;
- $self->pidl("return py_talloc_new($cname, type);");
+ $self->pidl("return pytalloc_new($cname, type);");
$self->deindent;
$self->pidl("}");
$self->pidl("");
@@ -255,10 +255,10 @@ sub PythonStruct($$$$$$)
$self->pidl("static PyObject *py_$name\_ndr_pack(PyObject *py_obj)");
$self->pidl("{");
$self->indent;
- $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(py_obj);");
+ $self->pidl("$cname *object = ($cname *)pytalloc_get_ptr(py_obj);");
$self->pidl("DATA_BLOB blob;");
$self->pidl("enum ndr_err_code err;");
- $self->pidl("err = ndr_push_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_$name);");
+ $self->pidl("err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_$name);");
$self->pidl("if (err != NDR_ERR_SUCCESS) {");
$self->indent;
$self->pidl("PyErr_SetNdrError(err);");
@@ -274,7 +274,7 @@ sub PythonStruct($$$$$$)
$self->pidl("static PyObject *py_$name\_ndr_unpack(PyObject *py_obj, PyObject *args)");
$self->pidl("{");
$self->indent;
- $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(py_obj);");
+ $self->pidl("$cname *object = ($cname *)pytalloc_get_ptr(py_obj);");
$self->pidl("DATA_BLOB blob;");
$self->pidl("int blob_length = 0;");
$self->pidl("enum ndr_err_code err;");
@@ -285,7 +285,7 @@ sub PythonStruct($$$$$$)
$self->pidl("}");
$self->pidl("blob.length = blob_length;");
$self->pidl("");
- $self->pidl("err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_$name);");
+ $self->pidl("err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_$name);");
$self->pidl("if (err != NDR_ERR_SUCCESS) {");
$self->indent;
$self->pidl("PyErr_SetNdrError(err);");
@@ -301,11 +301,11 @@ sub PythonStruct($$$$$$)
$self->pidl("static PyObject *py_$name\_ndr_print(PyObject *py_obj)");
$self->pidl("{");
$self->indent;
- $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(py_obj);");
+ $self->pidl("$cname *object = ($cname *)pytalloc_get_ptr(py_obj);");
$self->pidl("PyObject *ret;");
$self->pidl("char *retstr;");
$self->pidl("");
- $self->pidl("retstr = ndr_print_struct_string(py_talloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_$name, \"$name\", object);");
+ $self->pidl("retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_$name, \"$name\", object);");
$self->pidl("ret = PyString_FromString(retstr);");
$self->pidl("talloc_free(retstr);");
$self->pidl("");
@@ -340,7 +340,7 @@ sub PythonStruct($$$$$$)
}
$self->pidl(".tp_methods = $py_methods,");
$self->pidl(".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,");
- $self->pidl(".tp_basicsize = sizeof(py_talloc_Object),");
+ $self->pidl(".tp_basicsize = sizeof(pytalloc_Object),");
$self->pidl(".tp_new = py_$name\_new,");
$self->deindent;
$self->pidl("};");
@@ -924,13 +924,13 @@ sub ConvertObjectFromPythonData($$$$$$;$)
return;
}
$self->pidl("PY_CHECK_TYPE($ctype_name, $cvar, $fail);");
- $self->pidl("if (talloc_reference($mem_ctx, py_talloc_get_mem_ctx($cvar)) == NULL) {");
+ $self->pidl("if (talloc_reference($mem_ctx, pytalloc_get_mem_ctx($cvar)) == NULL) {");
$self->indent;
$self->pidl("PyErr_NoMemory();");
$self->pidl("$fail");
$self->deindent;
$self->pidl("}");
- $self->assign($target, "(".mapTypeName($ctype)." *)py_talloc_get_ptr($cvar)");
+ $self->assign($target, "(".mapTypeName($ctype)." *)pytalloc_get_ptr($cvar)");
return;
}
@@ -1142,13 +1142,13 @@ sub ConvertScalarToPython($$$)
}
# Not yet supported
- if ($ctypename eq "string_array") { return "PyCObject_FromTallocPtr($cvar)"; }
+ if ($ctypename eq "string_array") { return "pytalloc_CObject_FromTallocPtr($cvar)"; }
if ($ctypename eq "ipv4address") { return "PyString_FromStringOrNULL($cvar)"; }
if ($ctypename eq "ipv6address") { return "PyString_FromStringOrNULL($cvar)"; }
if ($ctypename eq "dnsp_name") { return "PyString_FromStringOrNULL($cvar)"; }
if ($ctypename eq "dnsp_string") { return "PyString_FromStringOrNULL($cvar)"; }
if ($ctypename eq "pointer") {
- return "PyCObject_FromTallocPtr($cvar)";
+ return "pytalloc_CObject_FromTallocPtr($cvar)";
}
die("Unknown scalar type $ctypename");
@@ -1181,7 +1181,7 @@ sub ConvertObjectToPythonData($$$$$;$)
error($location, "Unable to determine origin of type `" . mapTypeName($ctype) . "'");
return "NULL"; # FIXME!
}
- return "py_talloc_reference_ex($ctype_name, $mem_ctx, $cvar)";
+ return "pytalloc_reference_ex($ctype_name, $mem_ctx, $cvar)";
}
fatal($location, "unknown type $actual_ctype->{TYPE} for ".mapTypeName($ctype) . ": $cvar");