aboutsummaryrefslogtreecommitdiffstats
path: root/docbook/make-wsluarm.pl
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-10-17 02:08:44 +0200
committerAnders Broman <a.broman58@gmail.com>2016-10-18 04:09:14 +0000
commit8a1adf1a66cb0324e418e2e588cf47c68c4a287a (patch)
treeaecd0a2c6c3805b98445f4a17c1d076f07d7f3f5 /docbook/make-wsluarm.pl
parentf07b1bc6042925cba6ca2bfb762c9521513259ba (diff)
wslua: fix errors in documentation, add notational conventions
Improve example with better formatting, clarification comments and more common variable names. Extend make-wsluarm.pl to support arguments containing underscores. Fixes the description of dissect_tcp_pdus. Change TvbRange.tvb(tvb) into tvbrange:tvb() and ByteArray.tvb(name) into bytearray:tvb(name), these are really instance methods. Change-Id: I1e20ef46195dc6c06f9ac790d3432db283d21a5e Reviewed-on: https://code.wireshark.org/review/18226 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'docbook/make-wsluarm.pl')
-rwxr-xr-xdocbook/make-wsluarm.pl23
1 files changed, 11 insertions, 12 deletions
diff --git a/docbook/make-wsluarm.pl b/docbook/make-wsluarm.pl
index 16bc9135c0..ec297e276e 100755
--- a/docbook/make-wsluarm.pl
+++ b/docbook/make-wsluarm.pl
@@ -357,6 +357,9 @@ my $out_extension = "asciidoc";
# XXX: support \" within ""
my $QUOTED_RE = "\042\050\133^\042\135*\051\042";
+# group 1: whole trailing comment (possibly empty), e.g. " /* foo */"
+# group 2: any leading whitespace. XXX why is this not removed using (?:...)
+# group 3: actual comment text, e.g. " foo ".
my $TRAILING_COMMENT_RE = '((\s*|[\n\r]*)/\*(.*?)\*/)?';
my $IN_COMMENT_RE = '[\s\r\n]*((.*?)\*/)?';
@@ -460,30 +463,26 @@ sub {
push @{${$class}{methods}}, $function;
} ],
-[ '#define WSLUA_(OPT)?ARG_([A-Za-z0-9_]+)_([A-Z0-9]+)\s+\d+' . $TRAILING_COMMENT_RE,
+# Splits "WSLUA_OPTARG_ProtoField_int8_NAME /* food */" into
+# "OPT" (1), "ProtoField_int8" (2), "NAME" (3), ..., ..., " food " (6)
+# Handles functions like "loadfile(filename)" too.
+[ '#define WSLUA_(OPT)?ARG_((?:[A-Za-z0-9]+_)?[a-z0-9_]+)_([A-Z0-9_]+)\s+\d+' . $TRAILING_COMMENT_RE,
sub {
- deb ">a=$1=$2=$3=$4=$5=$6=$7=\n";
+ deb ">a=$1=$2=$3=$4=$5=$6=\n";
my $name = $1 eq 'OPT' ? "[$3]" : $3;
push @{${$function}{arglist}} , $name;
${${$function}{args}}{$name} = {descr=>parse_function_arg_desc($6),}
} ],
-[ '\057\052\s*WSLUA_(OPT)?ARG_([A-Za-z0-9_]+)_([A-Z0-9]+)\s*(.*?)\052\057',
+# same as above, except that there is no macro but a (multi-line) comment.
+[ '\057\052\s*WSLUA_(OPT)?ARG_((?:[A-Za-z0-9]+_)?[a-z0-9_]+)_([A-Z0-9_]+)\s*(.*?)\052\057',
sub {
- deb ">a=$1=$2=$3=$4=$5=$6=$7=\n";
+ deb ">a=$1=$2=$3=$4\n";
my $name = $1 eq 'OPT' ? "[$3]" : $3;
push @{${$function}{arglist}} , $name;
${${$function}{args}}{$name} = {descr=>parse_function_arg_desc($4),}
} ],
-[ '#define WSLUA_(OPT)?ARG_([A-Za-z0-9]+)_([a-z_]+)_([A-Z0-9]+)\s+\d+' . $TRAILING_COMMENT_RE,
-sub {
- deb ">ca=$1=$2=$3=$4=$5=$6=$7=\n";
- my $name = $1 eq 'OPT' ? "[$4]" : $4;
- push @{${$function}{arglist}} , $name;
- ${${$function}{args}}{$name} = {descr=>parse_function_arg_desc($7),optional => $1 eq '' ? 1 : 0 }
-} ],
-
[ '/\052\s+WSLUA_ATTRIBUTE\s+([A-Za-z0-9]+)_([a-z_]+)\s+([A-Z]*)\s*(.*?)\052/',
sub {
deb ">at=$1=$2=$3=$4=$5=$6=$7=\n";