aboutsummaryrefslogtreecommitdiffstats
path: root/docbook
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
parentec1e099dc0b1a1307df1c7f002905e7d38a5f2c7 (diff)
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')
-rw-r--r--docbook/CMakeLists.txt14
-rw-r--r--docbook/Makefile.common14
-rwxr-xr-xdocbook/make-wsluarm.pl57
3 files changed, 74 insertions, 11 deletions
diff --git a/docbook/CMakeLists.txt b/docbook/CMakeLists.txt
index e218bbc259..5c3164516b 100644
--- a/docbook/CMakeLists.txt
+++ b/docbook/CMakeLists.txt
@@ -255,6 +255,9 @@ set(WSDG_SOURCE
${WSDG_GRAPHICS}
)
+# Note: file order here MATTERS!
+# new WSLUA_MODULE files must come right before any WSLUA_CONTINUE_MODULE
+# files for the same module
set(WSLUA_MODULES
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_dumper.c
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_field.c
@@ -262,10 +265,21 @@ set(WSLUA_MODULES
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_int64.c
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_listener.c
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_pinfo.c
+ ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_address.c
+ ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_column.c
+ ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_nstime.c
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_proto.c
+ ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_dissector.c
+ ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_pref.c
+ ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_proto_expert.c
+ ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_proto_field.c
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_tree.c
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_tvb.c
+ ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_byte_array.c
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_file.c
+ ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_file_handler.c
+ ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_frame_info.c
+ ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_capture_info.c
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_dir.c
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_util.c
${CMAKE_SOURCE_DIR}/epan/wslua/wslua_struct.c
diff --git a/docbook/Makefile.common b/docbook/Makefile.common
index 4c9e941334..a2edd2e393 100644
--- a/docbook/Makefile.common
+++ b/docbook/Makefile.common
@@ -253,18 +253,32 @@ CLEANDIRS = \
wsug_html_chunked \
wsluarm_src
+# Note: file order here MATTERS!
+# new WSLUA_MODULE files must come right before any WSLUA_CONTINUE_MODULE
+# files for the same module
WSLUA_MODULES = \
$(top_srcdir)/epan/wslua/wslua_dumper.c \
$(top_srcdir)/epan/wslua/wslua_field.c \
$(top_srcdir)/epan/wslua/wslua_gui.c \
$(top_srcdir)/epan/wslua/wslua_listener.c \
$(top_srcdir)/epan/wslua/wslua_pinfo.c \
+ $(top_srcdir)/epan/wslua/wslua_address.c \
+ $(top_srcdir)/epan/wslua/wslua_column.c \
+ $(top_srcdir)/epan/wslua/wslua_nstime.c \
$(top_srcdir)/epan/wslua/wslua_proto.c \
+ $(top_srcdir)/epan/wslua/wslua_dissector.c \
+ $(top_srcdir)/epan/wslua/wslua_pref.c \
+ $(top_srcdir)/epan/wslua/wslua_proto_expert.c \
+ $(top_srcdir)/epan/wslua/wslua_proto_field.c \
$(top_srcdir)/epan/wslua/wslua_int64.c \
$(top_srcdir)/epan/wslua/wslua_struct.c \
$(top_srcdir)/epan/wslua/wslua_tree.c \
$(top_srcdir)/epan/wslua/wslua_tvb.c \
+ $(top_srcdir)/epan/wslua/wslua_byte_array.c \
$(top_srcdir)/epan/wslua/wslua_file.c \
+ $(top_srcdir)/epan/wslua/wslua_file_handler.c \
+ $(top_srcdir)/epan/wslua/wslua_frame_info.c \
+ $(top_srcdir)/epan/wslua/wslua_capture_info.c \
$(top_srcdir)/epan/wslua/wslua_dir.c \
$(top_srcdir)/epan/wslua/wslua_util.c
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 {