Author: tpot
Date: 2004-09-04 01:31:02 +0000 (Sat, 04 Sep 2004)
New Revision: 2221

WebSVN: 
http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/build/pidl&rev=2221&nolog=1

Log:
Experiment with extra properties for telling the ethereal parser what
to do.  There is a patch to the grammar and idl files for this but I
won't commit that just yet.

Modified:
   branches/SAMBA_4_0/source/build/pidl/eparser.pm


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/eparser.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/eparser.pm     2004-09-04 00:02:43 UTC (rev 
2220)
+++ branches/SAMBA_4_0/source/build/pidl/eparser.pm     2004-09-04 01:31:02 UTC (rev 
2221)
@@ -822,12 +822,18 @@
     return "FT_BYTES";
 }
 
-sub type2base($)
+# Determine the display base for an element
+
+sub elementbase($)
 {
-    my($t) = shift;
+    my($e) = shift;
+
+    if (my $base = util::has_property($e, "display")) {
+       return "BASE_" . uc($base);
+    }
  
-    return "BASE_DEC", if ($t eq "uint32") or ($t eq "uint16") or
-       ($t eq "uint8");
+    return "BASE_DEC", if ($e->{TYPE} eq "uint32") or 
+       ($e->{TYPE} eq "uint16") or ($e->{TYPE} eq "uint8");
     return "BASE_NONE";
 }
 
@@ -857,8 +863,8 @@
                        'name' => field2name($e->{NAME}),
                        'type' => $e->{TYPE},
                        'ft'   => type2ft($e->{TYPE}),
-                       'base' => type2base($e->{TYPE})
-                       };
+                       'base' => elementbase($e)
+                       }, if !defined($needed{"hf_$e->{NAME}_$e->{TYPE}"});
                    $e->{PARENT} = $fn;
                } else {
                    $needed{"ett_$e->{TYPE}"} = 1;
@@ -887,7 +893,7 @@
                        'name' => field2name($e->{NAME}),
                        'type' => $e->{TYPE},
                        'ft'   => type2ft($e->{TYPE}),
-                       'base' => type2base($e->{TYPE})
+                       'base' => elementbase($e)
                        };
                    
                    $e->{PARENT} = $t->{DATA};

Reply via email to