From d67c94de9c33b626fac93a2034968268be8c11e0 Mon Sep 17 00:00:00 2001 From: teastep Date: Thu, 26 Mar 2009 18:18:09 +0000 Subject: [PATCH] Move extension script handling to generate_script_1() Signed-off-by: Tom Eastep git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9739 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/Perl/Shorewall/Compiler.pm | 39 ++++++++++++++++++---------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index 0217db9ef..1e778cb34 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -74,8 +74,9 @@ sub reinitialize() { # # First stage of script generation. # -# Copy the prog.header to the generated script. - +# Copy prog.header to the generated script. +# Generate the various user-exit jacket functions. +# sub generate_script_1() { my $date = localtime; @@ -90,18 +91,12 @@ sub generate_script_1() { copy $globals{SHAREDIRPL} . 'prog.header6'; } } -} -# -# Second stage of script generation. -# -# Generate the various user-exit jacket functions. -# Generate the 'initialize()' function. -# -# Note: This function is not called when $command eq 'check'. So it must have no side effects other -# than those related to writing to the object file. - -sub generate_script_2() { + emit <<'EOF'; +################################################################################ +# Functions to execute the various user exits (extension scripts) +################################################################################ +EOF for my $exit qw/init isusable start tcclear started stop stopped clear refresh refreshed restored/ { emit "\nrun_${exit}_exit() {"; @@ -111,6 +106,24 @@ sub generate_script_2() { emit '}'; } + emit <<'EOF'; +################################################################################ +# End user exit functions +################################################################################ +EOF + +} + +# +# Second stage of script generation. +# +# Generate the 'initialize()' function. +# +# Note: This function is not called when $command eq 'check'. So it must have no side effects other +# than those related to writing to the object file. + +sub generate_script_2() { + emit ( '', '#', '# This function initializes the global variables used by the program',