From 10303740d163698aabe6195accae31b618091335 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Tue, 5 Feb 2013 07:30:11 -0600 Subject: [PATCH] [libpng15] Updated scripts/makefile.msys, options.awk, and vers.dfn --- scripts/makefile.msys | 2 +- scripts/options.awk | 39 +++++++++++++++++++++++++++------------ scripts/vers.dfn | 15 ++++----------- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/scripts/makefile.msys b/scripts/makefile.msys index d281bc1e8..eeb88d46f 100644 --- a/scripts/makefile.msys +++ b/scripts/makefile.msys @@ -43,7 +43,7 @@ LN_SF=ln -sf #ARCH = -march=pentium3 #ARCH = -march=i686 -ARCH = +ARCH = CDEBUG = -g -DPNG_DEBUG=5 LDDEBUG = CRELEASE = -O2 diff --git a/scripts/options.awk b/scripts/options.awk index 2e55697d6..c5f6eac54 100755 --- a/scripts/options.awk +++ b/scripts/options.awk @@ -35,17 +35,26 @@ BEGIN{ version="libpng version unknown" # version information version_file="" # where to find the version err=0 # in-line exit sets this - start="PNG_DEFN_MAGIC-" # Arbitrary start - end="-PNG_DEFN_END" # Arbitrary end - ct="PNG_JOIN" # Join two tokens - cx= "/" ct "*" # Open C comment for output file - comment=start cx # Comment start + # The following definitions prevent the C preprocessor noticing the lines + # that will be in the final output file. Some C preprocessors tokenise + # the lines, for example by inserting spaces around operators, and all + # C preprocessors notice lines that start with '#', most remove comments. + # The technique adopted here is to make the final output lines into + # C strings (enclosed in double quotes), preceeded by PNG_DFN. As a + # consequence the output cannot contain a 'raw' double quote - instead put + # @' in, this will be replaced by a single " afterward. See the parser + # script dfn.awk for more capabilities (not required here). Note that if + # you need a " in a 'setting' in pnglibconf.dfa it must also be @'! + dq="@'" # For a single double quote + start=" PNG_DFN \"" # Start stuff to output (can't contain a "!) + end="\" " # End stuff to output + comment=start "/*" # Comment start cend="*/" end # Comment end - def=start "#define PNG_" ct # Arbitrary define - sup=ct "_SUPPORTED 1" end # end supported option - und=comment "#undef PNG_" ct # Unsupported option - une=ct "_SUPPORTED" cend # end unsupported option - error=start "ERROR:" # error message + def=start "#define PNG_" # Arbitrary define + sup="_SUPPORTED 1" end # end supported option + und=comment "#undef PNG_" # Unsupported option + une="_SUPPORTED" cend # end unsupported option + error=start "ERROR:" # error message, terminate with 'end' # Variables deb=0 # debug - set on command line @@ -102,7 +111,6 @@ pre && version == "search" && version_file != FILENAME{ pre && version == "search" && $0 ~ /^ \* libpng version/{ version = substr($0, 4) - gsub(/\./, " PNG_JOIN . PNG_JOIN", version) print "version =", version >out next } @@ -468,6 +476,8 @@ END{ print "" >out print "/* SETTINGS */" >out print comment, "settings", cend >out + # Sort (in dfn.awk) on field 2, the setting name + print "PNG_DFN_START_SORT 2" >out finished = 0 while (!finished) { finished = 1 @@ -524,6 +534,7 @@ END{ exit 1 } } + print "PNG_DFN_END_SORT" >out print comment, "end of settings", cend >out # Now do the options - somewhat more complex. The dependency @@ -618,6 +629,9 @@ END{ } if (err) exit 1 + # Sort options too + print "PNG_DFN_START_SORT 2" >out + # option[i] is now the complete list of all the tokens we may # need to output, go through it as above, depth first. finished = 0 @@ -769,10 +783,11 @@ END{ exit 1 } } + print "PNG_DFN_END_SORT" >out print comment, "end of options", cend >out # Regular end - everything looks ok if (protect != "") { - print start "#endif", cx, protect, "*/" end >out + print start "#endif", "/*", protect, "*/" end >out } } diff --git a/scripts/vers.dfn b/scripts/vers.dfn index 89d5f3879..b9ee5b58a 100644 --- a/scripts/vers.dfn +++ b/scripts/vers.dfn @@ -9,18 +9,11 @@ * and license in png.h */ -#define HEADER PNG_DEFN_MAGIC-PNGLIB_LIBNAME {global:-PNG_DEFN_END - -/* NOTE: PNG_JOIN is interpreted by the calling script as a signal to - * join the two things on either side, so we can do symbol - * substitution within the name, regular C ## joins the pp-tokens, - * not their final values. - */ #define PNG_EXPORTA(ordinal, type, name, args, attributes)\ - PNG_DEFN_MAGIC- SYMBOL_PREFIX PNG_JOIN name;-PNG_DEFN_END + PNG_DFN " @" SYMBOL_PREFIX "@@" name "@;" -#define TRAILER PNG_DEFN_MAGIC-local: *; };-PNG_DEFN_END +PNG_DFN "@" PNGLIB_LIBNAME "@ {global:" -HEADER #include "../png.h" -TRAILER + +PNG_DFN "local: *; };"