Diff of /gendefs.awk [3f615e] .. [8fd865] Maximize Restore

  Switch to side-by-side view

--- a/gendefs.awk
+++ b/gendefs.awk
@@ -29,11 +29,19 @@
 #                   message set.
 #
 #   <message text>  is the fallback text defined for the message; it
-#                   must all on the same line as the `#define' token.
+#                   must all appear on the same line as the `#define'
+#                   token, or that line must terminate with a reverse
+#                   solidus, so escaping the newline, to indicate that
+#                   the following line is to be subsumed as a logical
+#                   continuation of the `#define' line; continuation,
+#                   in this manner, may be extended over any number
+#                   of consecutive input lines, by similarly escaping
+#                   the terminal newline on all but the last physical
+#                   input line of any such single logical line.
 #
 #
 # Written by Keith Marshall  <keithmarshall@users.sourceforge.net>
-# Last modification: 05-Mar-2007
+# Last modification: 02-Jan-2008
 #
 #
 # This is free software.  It is provided AS IS, in the hope that it may
@@ -53,7 +61,29 @@
 
 # Establish the default convention for identifying message definitions.
 #
-  BEGIN { MSGTAG = "MSG_[A-Z_a-z0-9]+" }
+  BEGIN { MSGTAG = "MSG_[A-Z_a-z0-9]+"; MULTILINE = 0 }
+#
+# If we enabled MULTILINE mode, on the preceding input line, then we treat
+# the current input line as a logical continuation of the preceding line.
+# We must handle this case *before* any other condition, because such line
+# continuation overrides any other line type identification checks.
+#
+  MULTILINE == 1 {
+#
+#   If this continuation line is not itself continued,
+#   then we turn off MULTILINE, effective from the *next* input line.
+#
+    if( $0 !~ /\\$/ ) MULTILINE = 0;
+#
+#   We then emit the continuation line, and immediately proceed to
+#   the next input line.
+#
+    print
+    next
+  }
+#
+# If we are *not* in MULTILINE mode, then we proceed to the normal input
+# line interpretation strategy...
 #
 # Allow the user to substitute an alternative identification convention,
 # by assigning a new MSGTAG value in the input stream.
@@ -76,6 +106,12 @@
 #
   { sub( "^#[ 	]*define[ 	]+", "# define " ) }
   $1$2 == "#define" && match( $3, MSGTAG ) == 1 && RLENGTH == length( $3 ){
+#
+#   Only lines, such as this, which begin with a `#define' token, are permitted
+#   to initiate MULTILINE continuation mode; when such a line is terminated by
+#   a reverse solidus escaped newline, then initiate MULTILINE mode.
+#
+    if( $0 ~ /\\$/ ) MULTILINE = 1
 #
 #   Extract the set number from the message definition;
 #   if it differs from that of the set identified by CURSET,
@@ -106,4 +142,4 @@
     print MSGNUM, $0
   }
 #
-# $RCSfile$Revision: end of file
+# $RCSfile$Revision$: end of file