diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-10-05 00:29:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:39:24 -0500 |
commit | d220237b19f361a2c3c09b292e11f54c8d522fdf (patch) | |
tree | 786d6a19e83e305d9c44bcc73ede81afea4d84da /source4/pidl/lib/Parse/Pidl/Samba3/Types.pm | |
parent | 1e0823d0a580ec61ae5a4e4826586e24f64eee0b (diff) | |
download | samba-d220237b19f361a2c3c09b292e11f54c8d522fdf.tar.gz samba-d220237b19f361a2c3c09b292e11f54c8d522fdf.tar.bz2 samba-d220237b19f361a2c3c09b292e11f54c8d522fdf.zip |
r10721: Handle allocations and primitive / deferred data correctly. In theory,
the generated output for DFS should work now (it compiles cleanly, but
I haven't tested it yet).
Not supported:
- subcontexts()
- relative pointers
- unions of pointers
- DATA_BLOB
- several other things
Also still need to do:
- Remove some spurious spaces in the output
- Do range() checking
Example output is still available at http://samba.org/~jelmer/pidl_samba3/
(This used to be commit e2d7e382bb645f1bddd2047669bed10f121b59d2)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba3/Types.pm')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba3/Types.pm | 69 |
1 files changed, 47 insertions, 22 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm index a3bf91d54f..9a7a31a6bb 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm @@ -109,50 +109,50 @@ my $known_types = { DECL => "uint8", INIT => \&init_scalar, - DISSECT => \&dissect_scalar, + DISSECT_P => \&dissect_scalar, }, uint16 => { DECL => "uint16", INIT => \&init_scalar, - DISSECT => \&dissect_scalar, + DISSECT_P => \&dissect_scalar, }, uint32 => { DECL => "uint32", INIT => \&init_scalar, - DISSECT => \&dissect_scalar, + DISSECT_P => \&dissect_scalar, }, uint64 => { DECL => "uint64", INIT => \&init_scalar, - DISSECT => \&dissect_scalar, + DISSECT_P => \&dissect_scalar, }, string => { DECL => \&decl_string, EXT_DECL => \&ext_decl_string, INIT => \&init_string, - DISSECT => \&dissect_string, + DISSECT_P => \&dissect_string, }, NTSTATUS => { DECL => "NTSTATUS", INIT => \&init_scalar, - DISSECT => \&dissect_scalar, + DISSECT_P => \&dissect_scalar, }, WERROR => { DECL => "WERROR", INIT => \&init_scalar, - DISSECT => \&dissect_scalar, + DISSECT_P => \&dissect_scalar, }, GUID => { DECL => "struct uuid", INIT => "", - DISSECT => sub { + DISSECT_P => sub { my ($e,$l,$n) = @_; return "smb_io_uuid(\"$e->{NAME}\", &$n, ps, depth)"; } @@ -161,7 +161,7 @@ my $known_types = { DECL => "NTTIME", INIT => "", - DISSECT => sub { + DISSECT_P => sub { my ($e,$l,$n) = @_; return "smb_io_nttime(\"$e->{NAME}\", &n, ps, depth)"; } @@ -170,7 +170,7 @@ my $known_types = { DECL => "DOM_SID", INIT => "", - DISSECT => sub { + DISSECT_P => sub { my ($e,$l,$n) = @_; return "smb_io_dom_sid(\"$e->{NAME}\", &n, ps, depth)"; } @@ -179,7 +179,7 @@ my $known_types = { DECL => "POLICY_HND", INIT => "", - DISSECT => sub { + DISSECT_P => sub { my ($e,$l,$n) = @_; return "smb_io_pol_hnd(\"$e->{NAME}\", &n, ps, depth)"; } @@ -301,6 +301,7 @@ sub DissectType my $e = shift @_; my $l = shift @_; my $varname = shift @_; + my $what = shift @_; my $t = $known_types->{$l->{DATA_TYPE}}; @@ -309,11 +310,20 @@ sub DissectType return undef; } + my $dissect; + if ($what == 1) { #primitives + $dissect = $t->{DISSECT_P}; + } elsif ($what == 2) { + $dissect = $t->{DISSECT_D}; + } + + return "" if not defined($dissect); + # DISSECT can be a function - if (ref($t->{DISSECT}) eq "CODE") { - return $t->{DISSECT}->(@args); + if (ref($dissect) eq "CODE") { + return $dissect->(@args); } else { - return $t->{DISSECT}; + return $dissect; } } @@ -330,25 +340,40 @@ sub LoadTypes($) return "$n = $v;"; }; - my $dissect; + my $dissect_d; + my $dissect_p; if ($td->{DATA}->{TYPE} eq "UNION") { - $dissect = sub { - my ($e,$l,$n,$s) = @_; + $dissect_p = sub { + my ($e,$l,$n,$w,$s) = @_; + + return "$if->{NAME}_io_$td->{NAME}_p(\"$e->{NAME}\", &$n, $s, ps, depth)"; + }; - return "$if->{NAME}_io_$td->{NAME}(\"$e->{NAME}\", &$n, $s, ps, depth)"; + $dissect_d = sub { + my ($e,$l,$n,$w,$s) = @_; + + return "$if->{NAME}_io_$td->{NAME}_d(\"$e->{NAME}\", &$n, $s, ps, depth)"; }; + } else { - $dissect = sub { - my ($e,$l,$n) = @_; + $dissect_p = sub { + my ($e,$l,$n,$w) = @_; - return "$if->{NAME}_io_$td->{NAME}(\"$e->{NAME}\", &$n, ps, depth)"; + return "$if->{NAME}_io_$td->{NAME}_p(\"$e->{NAME}\", &$n, ps, depth)"; }; + $dissect_d = sub { + my ($e,$l,$n,$w) = @_; + + return "$if->{NAME}_io_$td->{NAME}_d(\"$e->{NAME}\", &$n, ps, depth)"; + }; + } AddType($td->{NAME}, { DECL => $decl, INIT => $init, - DISSECT => $dissect + DISSECT_D => $dissect_d, + DISSECT_P => $dissect_p }); } } |