pidl: Add skip option to elements.
authorAndreas Schneider <asn@samba.org>
Tue, 12 Mar 2013 10:36:38 +0000 (11:36 +0100)
committerGünther Deschner <gd@samba.org>
Fri, 15 Mar 2013 11:11:02 +0000 (12:11 +0100)
This option allows to skip struct elements in pull and push function.
This can be used to pass flags to the structure e.g. for string values.

Reviewed-by: Günther Deschner <gd@samba.org>
pidl/lib/Parse/Pidl/NDR.pm
pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm

index ed7fdab94cea5295be341e332b20998042dd347d..682715227f5c91f7c8a61093962330b8acfec7a5 100644 (file)
@@ -1073,6 +1073,7 @@ my %property_list = (
        "noprint"               => ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP", "ELEMENT", "PIPE"],
        "nopython"              => ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP"],
        "todo"                  => ["FUNCTION"],
+       "skip"                  => ["ELEMENT"],
 
        # union
        "switch_is"             => ["ELEMENT"],
index 8eb935bf228f7d404dd3f589f651e194000dc3fe..5ffb67846b3424cb6bc47cdfc62628e5277ffc8f 100644 (file)
@@ -958,7 +958,11 @@ sub ParseDataPull($$$$$$$)
 
                $var_name = get_pointer_to($var_name);
 
-               $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_pull", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+               if (has_property($e, "skip")) {
+                       $self->pidl("/* [skip] '$var_name' */");
+               } else {
+                       $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_pull", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+               }
 
                my $pl = GetPrevLevel($e, $l);
 
@@ -996,7 +1000,11 @@ sub ParseDataPush($$$$$$$)
                        $var_name = get_pointer_to($var_name);
                }
 
-               $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_push", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+               if (has_property($e, "skip")) {
+                       $self->pidl("/* [skip] '$var_name' */");
+               } else {
+                       $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_push", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+               }
        } else {
                $self->ParseTypePush($l->{DATA_TYPE}, $ndr, $var_name, $primitives, $deferred);
        }