aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/make-init-lua.pl
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2016-12-17 10:08:54 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2016-12-20 10:36:31 +0000
commitd4eeeaf6d463f930c89e9026b682339e1e114b34 (patch)
tree19c3f736edb85e2aa904aceb7e7da9c5257bf980 /epan/wslua/make-init-lua.pl
parentd9cc2b52260dac9830ac60239c4d80721df59b96 (diff)
Lua: Add unit names support.
Add support for using unit names in ProtoField integer types by using base.UNIT_STRING. Add unit name table argument in ProtoField.float() and ProtoField.double() (and made backward compatibility). The use of base.UNIT_STRING is not really the best API for adding unit names in Lua, but is the simples solution without adding new arguments to ProtoField. Change-Id: Ib5d064480cffd970a41db1764440642f6c593bb2 Reviewed-on: https://code.wireshark.org/review/19313 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan/wslua/make-init-lua.pl')
-rwxr-xr-xepan/wslua/make-init-lua.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/epan/wslua/make-init-lua.pl b/epan/wslua/make-init-lua.pl
index f1b2e945f8..9c848048c1 100755
--- a/epan/wslua/make-init-lua.pl
+++ b/epan/wslua/make-init-lua.pl
@@ -184,6 +184,12 @@ while(<PROTO_H>) {
$bases_table .= "\t[\"$1\"] = $2,\n";
}
+ if (/^#define\s+BASE_(UNIT_STRING)[ ]*((0x)?[0-9]+) / ) {
+ # Handle BASE_UNIT_STRING as a valid base value in Lua
+ my $num = hex($2);
+ $bases_table .= "\t[\"$1\"] = $num,\n";
+ }
+
if (/^.define\s+PI_SEVERITY_MASK /) {
$in_severity = 1;
$skip_this = 1;