summaryrefslogtreecommitdiff
path: root/docbook/make-wsluarm.pl
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2015-07-07 11:30:44 -0400
committerHadriel Kaplan <hadrielk@yahoo.com>2015-07-12 02:08:24 +0000
commit0caf0616ba53282cf4ef5587e13989a7aacc9588 (patch)
tree298c5cb80751accd9076a6da6c2cd89ac31e9d87 /docbook/make-wsluarm.pl
parentec1e099dc0b1a1307df1c7f002905e7d38a5f2c7 (diff)
downloadwireshark-0caf0616ba53282cf4ef5587e13989a7aacc9588.tar.gz
Lua: split up wslua files into class-based files
The size of some of the wslua source files has grown large, and it's hard to quickly find things. So split them up based on class name, as much as seems reasonable. Also have the make-wsluarm.pl Perl script handle this. Change-Id: Ib495ec5c2a4df90495c0a05504856288a0b09213 Reviewed-on: https://code.wireshark.org/review/9579 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Diffstat (limited to 'docbook/make-wsluarm.pl')
-rwxr-xr-xdocbook/make-wsluarm.pl57
1 files changed, 46 insertions, 11 deletions
diff --git a/docbook/make-wsluarm.pl b/docbook/make-wsluarm.pl
index 35f92a8644..4bba10b9c0 100755
--- a/docbook/make-wsluarm.pl
+++ b/docbook/make-wsluarm.pl
@@ -545,16 +545,19 @@ for (@control) {
$anymatch .= ')';
# for each file given in the command line args
-my $file;
-while ( $file = shift) {
+my $file = shift;
+my $docfile = 0;
- next unless -f $file;
+while ( $file ) {
- %module = ();
+ # continue to next loop if the file is not plain text
+ next unless -f $file;
- my $docfile = $file;
- $docfile =~ s#.*/##;
- $docfile =~ s/\.c$/.$out_extension/;
+ if (!$docfile) {
+ $docfile = $file;
+ $docfile =~ s#.*/##;
+ $docfile =~ s/\.c$/.$out_extension/;
+ }
open C, "< $file" or die "Can't open input file $file: $!";
open D, "> wsluarm_src/$docfile" or die "Can't open output file wsluarm_src/$docfile: $!";
@@ -562,6 +565,8 @@ while ( $file = shift) {
my $b = '';
$b .= $_ while (<C>);
+ close C;
+
while ($b =~ /$anymatch/ms ) {
my $match = $1;
# print "\n-----\n$match\n-----\n";
@@ -575,6 +580,34 @@ while ( $file = shift) {
}
}
+ # peek at next file to see if it's continuing this module
+ $file = shift;
+ # make sure we get the next plain text file
+ while ($file and !(-f $file)) {
+ $file = shift;
+ }
+
+ if ($file) {
+ # we have another file - check it out
+
+ open C, "< $file" or die "Can't open input file $file: $!";
+
+ my $peek_for_continue = '';
+ $peek_for_continue .= $_ while (<C>);
+
+ close C;
+
+ if ($peek_for_continue =~ /WSLUA_CONTINUE_MODULE\s*([A-Z][a-zA-Z0-9]+)/) {
+ if ($module{name} ne $1) {
+ die "Input file $file continues a different module: $1 (previous module is $module{name})!";
+ }
+ # ok, we're continuing the same module
+ next;
+ }
+ }
+
+ # if we got here, we're not continuing the module
+
$modules{$module{name}} = $docfile;
print "Generating source XML for: $module{name}\n";
@@ -640,15 +673,17 @@ while ( $file = shift) {
print D ${$template_ref}{global_functions_footer};
}
+ printf D ${$template_ref}{module_footer}, $module{name};
+
+ close D;
+
+ %module = ();
%classes = ();
$class = undef;
$function = undef;
@functions = ();
- close C;
+ $docfile = 0;
- printf D ${$template_ref}{module_footer}, $module{name};
-
- close D;
}
sub function_descr {