From e1deb404eb4fb29f1ca1f3a91b2230173519a797 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 9 May 2008 13:44:12 +0200 Subject: Fix use of interface instances in pidl. --- source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm | 6 +++--- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source4/pidl/lib/Parse') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm index 85dab37246..f8ba4fc18a 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm @@ -3,7 +3,7 @@ package Parse::Pidl::Samba4::COM::Header; -use Parse::Pidl::Typelist qw(mapType); +use Parse::Pidl::Typelist qw(mapTypeName); use Parse::Pidl::Util qw(has_property is_constant); use vars qw($VERSION); @@ -18,7 +18,7 @@ sub GetArgumentProtoList($) foreach my $a (@{$f->{ELEMENTS}}) { - $res .= ", " . mapType($a->{TYPE}) . " "; + $res .= ", " . mapTypeName($a->{TYPE}) . " "; my $l = $a->{POINTERS}; $l-- if (Parse::Pidl::Typelist::scalar_is_reference($a->{TYPE})); @@ -62,7 +62,7 @@ sub HeaderVTable($) my $data = $interface->{DATA}; foreach my $d (@{$data}) { - $res .= "\t" . mapType($d->{RETURN_TYPE}) . " (*$d->{NAME}) (struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . GetArgumentProtoList($d) . ");\\\n" if ($d->{TYPE} eq "FUNCTION"); + $res .= "\t" . mapTypeName($d->{RETURN_TYPE}) . " (*$d->{NAME}) (struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . GetArgumentProtoList($d) . ");\\\n" if ($d->{TYPE} eq "FUNCTION"); } $res .= "\n"; $res .= "struct $interface->{NAME}_vtable {\n"; diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index b7d092015c..3b7e875260 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -9,6 +9,7 @@ use Exporter; @ISA = qw(Exporter); use strict; +use Parse::Pidl qw(warning fatal); use Parse::Pidl::Typelist qw(hasType resolveType getType mapTypeName expandAlias); use Parse::Pidl::Util qw(has_property ParseExpr); use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred is_charset_array); @@ -846,7 +847,7 @@ sub ConvertObjectFromPythonData($$$$$$) return; } - if ($actual_ctype->{TYPE} eq "STRUCT") { + if ($actual_ctype->{TYPE} eq "STRUCT" or $actual_ctype->{TYPE} eq "INTERFACE") { $self->pidl("PY_CHECK_TYPE($ctype->{NAME}, $cvar, $fail);"); $self->assign($target, "py_talloc_get_ptr($cvar)"); return; @@ -889,7 +890,7 @@ sub ConvertObjectFromPythonData($$$$$$) return; } - die("unknown type ".mapTypeName($ctype) . ": $cvar"); + fatal($ctype, "unknown type $actual_ctype->{TYPE} for ".mapTypeName($ctype) . ": $cvar"); } @@ -1026,13 +1027,12 @@ sub ConvertObjectToPythonData($$$$$) } elsif ($actual_ctype->{TYPE} eq "SCALAR") { return $self->ConvertScalarToPython($actual_ctype->{NAME}, $cvar); } elsif ($actual_ctype->{TYPE} eq "UNION") { - # FIXME: Should be fatal() rather than die() - die("union without discriminant: " . mapTypeName($ctype) . ": $cvar"); + fatal($ctype, "union without discriminant: " . mapTypeName($ctype) . ": $cvar"); } elsif ($actual_ctype->{TYPE} eq "STRUCT" or $actual_ctype->{TYPE} eq "INTERFACE") { return "py_talloc_import_ex(&$ctype->{NAME}_Type, $mem_ctx, $cvar)"; } - die("unknown type ".mapTypeName($ctype) . ": $cvar"); + fatal($ctype, "unknown type $actual_ctype->{TYPE} for ".mapTypeName($ctype) . ": $cvar"); } sub fail_on_null($$$) -- cgit