[devel] Improved the options.awk script; added an "everything off" option.

This commit is contained in:
Glenn Randers-Pehrson
2010-04-28 07:52:16 -05:00
parent 34713ce23c
commit cd74549840
20 changed files with 247 additions and 79 deletions

View File

@@ -199,6 +199,7 @@ version 1.5.0beta21 [April 27, 2010]
version 1.5.0beta22 [April 28, 2010] version 1.5.0beta22 [April 28, 2010]
Fixed dependencies of GET_INT_32 - it does not require READ_INT_FUNCTIONS Fixed dependencies of GET_INT_32 - it does not require READ_INT_FUNCTIONS
because it has a macro equivalent. because it has a macro equivalent.
Improved the options.awk script; added an "everything off" option.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net: Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit (subscription required; visit

View File

@@ -2681,6 +2681,7 @@ version 1.5.0beta21 [April 27, 2010]
version 1.5.0beta22 [April 28, 2010] version 1.5.0beta22 [April 28, 2010]
Fixed dependencies of GET_INT_32 - it does not require READ_INT_FUNCTIONS Fixed dependencies of GET_INT_32 - it does not require READ_INT_FUNCTIONS
because it has a macro equivalent. because it has a macro equivalent.
Improved the options.awk script; added an "everything off" option.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@@ -1,9 +1,9 @@
Makefiles for libpng version 1.5.0beta21 - April 27, 2010 Makefiles for libpng version 1.5.0beta22 - April 28, 2010
pnglibconf.h => Stores configuration settings pnglibconf.h => Stores configuration settings
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng15.so.15.1.5.0beta21) (gcc, creates libpng15.so.15.1.5.0beta22)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from ansi2knr (Requires ansi2knr.c from
@@ -20,7 +20,7 @@ pnglibconf.h => Stores configuration settings
makefile.dec => DEC Alpha UNIX makefile makefile.dec => DEC Alpha UNIX makefile
makefile.dj2 => DJGPP 2 makefile makefile.dj2 => DJGPP 2 makefile
makefile.elf => Linux/ELF makefile symbol versioning, makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng15.so.15.1.5.0beta21) gcc, creates libpng15.so.15.1.5.0beta22)
makefile.freebsd => FreeBSD makefile makefile.freebsd => FreeBSD makefile
makefile.gcc => Generic gcc makefile makefile.gcc => Generic gcc makefile
makefile.hpgcc => HPUX makefile using gcc makefile.hpgcc => HPUX makefile using gcc
@@ -35,12 +35,12 @@ pnglibconf.h => Stores configuration settings
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def) makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.sggcc => Silicon Graphics (gcc, makefile.sggcc => Silicon Graphics (gcc,
creates libpng15.so.15.1.5.0beta21) creates libpng15.so.15.1.5.0beta22)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.solaris => Solaris 2.X makefile (gcc, makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng15.so.15.1.5.0beta21) creates libpng15.so.15.1.5.0beta22)
makefile.so9 => Solaris 9 makefile (gcc, makefile.so9 => Solaris 9 makefile (gcc,
creates libpng15.so.15.1.5.0beta21) creates libpng15.so.15.1.5.0beta22)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile

View File

@@ -1,4 +1,4 @@
#!/bin/awk #!/bin/awk -f
# Check a list of symbols against the master definition # Check a list of symbols against the master definition
# (official) list. Arguments: # (official) list. Arguments:
# #

View File

@@ -11,7 +11,7 @@
# Modeled after libxml-config. # Modeled after libxml-config.
version=1.5.0beta21 version=1.5.0beta22
prefix="" prefix=""
libdir="" libdir=""
libs="" libs=""

View File

@@ -5,6 +5,6 @@ includedir=@includedir@/libpng15
Name: libpng Name: libpng
Description: Loads and saves PNG files Description: Loads and saves PNG files
Version: 1.5.0beta21 Version: 1.5.0beta22
Libs: -L${libdir} -lpng15 Libs: -L${libdir} -lpng15
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng15
LIB= png15 LIB= png15
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.5.0beta21 SHLIB_MINOR= 1.5.0beta22
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
LIB= png LIB= png
SHLIB_MAJOR= 3 SHLIB_MAJOR= 3
SHLIB_MINOR= 1.5.0beta21 SHLIB_MINOR= 1.5.0beta22
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.5.0beta21 SHLIB_MINOR= 1.5.0beta22
LIB= png LIB= png
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \ SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \

View File

@@ -52,9 +52,9 @@ all: libpng.a pngtest
# copy this if the following doesn't work. # copy this if the following doesn't work.
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
$(RM_F) $@ dfn?.out $(RM_F) $@ dfn?.out
$(AWK) -f scripts/options.awk pre=1 out=dfn1.out\ $(AWK) -f scripts/options.awk out=dfn1.out\
scripts/pnglibconf.dfa 1>&2 scripts/pnglibconf.dfa $(DFA_XTRA) 1>&2
$(AWK) -f scripts/options.awk pre=0 out=dfn2.out dfn1.out 1>&2 $(AWK) -f scripts/options.awk out=dfn2.out dfn1.out 1>&2
cp dfn2.out $@ cp dfn2.out $@
$(RM_F) dfn?.out $(RM_F) dfn?.out

View File

@@ -1,7 +1,7 @@
#!/bin/awk -f #!/bin/awk -f
# scripts/options.awk - library build configuration control # scripts/options.awk - library build configuration control
# #
# last changed in libpng version 1.5.0 - April 27, 2010 # last changed in libpng version 1.5.0 - April 28, 2010
# #
# Copyright (c) 1998-2010 Glenn Randers-Pehrson # Copyright (c) 1998-2010 Glenn Randers-Pehrson
# #
@@ -12,16 +12,25 @@
# The output of this script is written to the file given by # The output of this script is written to the file given by
# the variable 'out'. The script is run twice, once with # the variable 'out'. The script is run twice, once with
# an intermediate output file, 'options.tmp' then again on # an intermediate output file, 'options.tmp' then again on
# that file to produce the final output. Each time the # that file to produce the final output:
# output files and whether or not to pre-prrocess must be
# specified:
# #
# awk -f scripts/options.awk pre=1 out=options.tmp scripts/options.dat 1>&2 # awk -f scripts/options.awk out=options.tmp scripts/options.dfa 1>&2
# awk -f scripts/options.awk pre=0 out=options.dfn options.tmp 1>&2 # awk -f scripts/options.awk out=options.dfn options.tmp 1>&2
#
# Some options may be specified on the command line:
#
# deb=1 Causes debugging to be output
# logunsupported=1 Causes all options to be recorded in the output
# everything=off Causes all options to be disabled by default
# everything=on Causes all options to be enabled by default
#
# These options may also be specified in the original input file (and
# are copied to the preprocessed file).
BEGIN{ BEGIN{
out="/dev/null" # intermediate, preprocessed, file out="/dev/null" # intermediate, preprocessed, file
pre=-1 # preprocess pre=-1 # preprocess (first line)
err=0 # in-line exit sets this
start="PNG_DEFN_MAGIC-" # Arbitrary start start="PNG_DEFN_MAGIC-" # Arbitrary start
end="-PNG_DEFN_END" # Arbitrary end end="-PNG_DEFN_END" # Arbitrary end
cx= "/@@@*" # Open C comment for output file cx= "/@@@*" # Open C comment for output file
@@ -32,11 +41,14 @@ BEGIN{
und=comment "#undef PNG_@@@" # Unsupported option und=comment "#undef PNG_@@@" # Unsupported option
une="@@@_SUPPORTED" cend # end unsupported option une="@@@_SUPPORTED" cend # end unsupported option
error=start "ERROR:" # error message error=start "ERROR:" # error message
# Variables
deb=0 # debug - set on command line deb=0 # debug - set on command line
everything="" # do not override defaults
logunsupported=0 # write unsupported options too logunsupported=0 # write unsupported options too
# Precreate arrays # Precreate arrays
option[""] = "" # list of all options: default on/off/"" option[""] = "" # list of all options: default enabled/disabled
done[""] = 1 # marks option as having been output done[""] = 1 # marks option as having been output
requires[""] = "" # requires by option requires[""] = "" # requires by option
iffs[""] = "" # if by option iffs[""] = "" # if by option
@@ -50,6 +62,27 @@ BEGIN{
protect = "" protect = ""
} }
# The output file must be specified before any input:
out == "/dev/null" {
print "out=output.file must be given on the command line"
err = 1
exit 1
}
# The very first line indicates whether we are reading pre-processed
# input or not, this must come *first* because 'PREPROCESSED' needs
# to be the very first line in the temporary file.
pre == -1{
if ($0 == "PREPROCESSED") {
pre = 0
next
} else {
pre = 1
print "PREPROCESSED" >out
# And fall through to continue processing
}
}
# Preprocessing - this just copies the input file with lines # Preprocessing - this just copies the input file with lines
# that need preprocessing (just chunk at present) expanded # that need preprocessing (just chunk at present) expanded
pre && $1 != "chunk"{ pre && $1 != "chunk"{
@@ -116,23 +149,66 @@ $1 == "file" && NF >= 2{
next next
} }
# option NAME ( (requires|enables|if) NAME* | on | off )* # variable=value
# Declares an option 'NAME' and describes its default setting (on|off) # Sets the given variable to the given value (the syntax is fairly
# free form, except for deb (you are expected to understand how to
# set the debug variable...)
$0 ~ /^[ ]*everything[ =]*off[ ]*$/{
everything = "off"
next
}
$0 ~ /^[ ]*everything[ =]*on[ ]*$/{
everything = "on"
next
}
$0 ~ /^[ ]*logunsupported[ =]*0[ ]*$/{
logunsupported = 0
next
}
$0 ~ /^[ ]*logunsupported[ =]*1[ ]*$/{
logunsupported = 1
next
}
$1 == "deb" && $2 == "=" && NF == 3{
deb = $3
next
}
# option NAME ( (requires|enables|if) NAME* | on | off | disabled )*
# Declares an option 'NAME' and describes its default setting (disabled)
# and its relationship to other options. The option is disabled # and its relationship to other options. The option is disabled
# unless *all* the options listed after 'requires' are set and at # unless *all* the options listed after 'requires' are set and at
# least one of the options listed after 'if' is set. If the # least one of the options listed after 'if' is set. If the
# option is set then it turns on all the options listed after 'enables'. # option is set then it turns on all the options listed after 'enables'.
#
# Note that "enables" takes priority over the required/if/disabled/off
# setting of the target option.
#
# The definition file may list an option as 'disabled': off by default,
# otherwise the option is enabled: on by default. A later (and it must
# be later) entry may turn an option on or off explicitly.
$1 == "option" && NF >= 2{ $1 == "option" && NF >= 2{
onoff = option[$2] # records default on or default off onoff = option[$2] # records current (and the default is "", enabled)
key = "" key = ""
for (i=3; i<=NF; ++i) { for (i=3; i<=NF; ++i) {
if ($(i) == "on" || $(i) == "off") { if ($(i) == "on" || $(i) == "off" || $(i) == "disabled") {
key = "" key = ""
if (onoff != $(i)) { if (onoff != $(i)) {
if (onoff == "") # on or off can zap disabled or enabled:
if (onoff == "" ||
(onoff == "disabled" || onoff == "enabled") &&
($(i) == "on" || $(i) == "off")) {
# It's easy to mis-spell the option when turning it
# on or off, so warn about it here:
if (onoff == "" && ($(i) == "on" || $(i) == "off")) {
print $2 ": ERROR: turning unrecognized option", $(i)
# For the moment error out - it is safer
err = 1 # prevent END{} running
exit 1
}
onoff = $(i) onoff = $(i)
else { } else {
# Print a message, otherwise the error # Print a message, otherwise the error
# below is incomprehensible # below is incomprehensible
print $2 ": currently", onoff ": attempt to turn", $(i) print $2 ": currently", onoff ": attempt to turn", $(i)
@@ -152,17 +228,15 @@ $1 == "option" && NF >= 2{
} }
if (i > NF) { if (i > NF) {
# Set the option - this may explicitly set it to "", that's good # Set the option, defaulting to 'enabled'
# becaue we need to ensure it exists and we can't rely on some if (onoff == "") onoff = "enabled"
# actually quite sensible awk implementation not optimising the
# read above away (gawk doesn't)
option[$2] = onoff option[$2] = onoff
next next
} }
# Else fall through to the error handler # Else fall through to the error handler
} }
# chunk NAME [requires OPT] [off] # chunk NAME [requires OPT] [on|off|disabled]
# Expands to the 'option' settings appropriate to the reading and # Expands to the 'option' settings appropriate to the reading and
# writing of an ancilliary PNG chunk 'NAME': # writing of an ancilliary PNG chunk 'NAME':
# #
@@ -184,7 +258,7 @@ pre && $1 == "chunk" && NF >= 2{
# read the keywords/additional OPTS # read the keywords/additional OPTS
req = 0 req = 0
for (i=3; i<=NF; ++i) { for (i=3; i<=NF; ++i) {
if ($(i) == "on" || $(i) == "off") { if ($(i) == "on" || $(i) == "off" || $(i) == "disabled") {
if (onoff != $(i)) { if (onoff != $(i)) {
if (onoff == "") if (onoff == "")
onoff = $(i) onoff = $(i)
@@ -243,6 +317,7 @@ $1 == "setting" && (NF == 2 || NF >= 3 && ($3 == "requires" || $3 == "default"))
break # Format error, handled below break # Format error, handled below
setting[$2] = reqs setting[$2] = reqs
# NOTE: this overwrites a previous value silently
if (isdef && deflt == "") if (isdef && deflt == "")
deflt = " " # as a flag to force output deflt = " " # as a flag to force output
defaults[$2] = deflt defaults[$2] = deflt
@@ -302,6 +377,7 @@ $1 ~ /^@/{
# any other format errors. # any other format errors.
{ {
print "options.awk: bad line (" NR "):", $0 print "options.awk: bad line (" NR "):", $0
err = 1 # prevent END{} running
exit 1 exit 1
} }
@@ -324,15 +400,15 @@ $1 ~ /^@/{
# of the names to be enabled. # of the names to be enabled.
END{ END{
if (out == "/dev/null") { # END{} gets run on an exit (a traditional awk feature)
print "out=output.file must be given on the command line" if (err) exit 1
exit 1
}
if (pre) { if (pre) {
if (pre != 1) { # Record the variables
print "pre=0 or pre=1 must be given on command line" print "deb =", deb
exit 1 if (everything != "")
} print "everything =", everything
print "logunsupported =", logunsupported
exit 0 exit 0
} }
@@ -377,6 +453,9 @@ END{
print def i, "PNG_" i end >out print def i, "PNG_" i end >out
if (defaults[i] != "") { if (defaults[i] != "") {
print "#else /*default*/" >out print "#else /*default*/" >out
# And add the default definition for the benefit
# of later settings an options test:
print "# define PNG_" i defaults[i] >out
print def i defaults[i] end >out print def i defaults[i] end >out
} }
print "#endif" >out print "#endif" >out
@@ -408,8 +487,16 @@ END{
print "/* OPTIONS */" >out print "/* OPTIONS */" >out
print comment, "options", cend >out print comment, "options", cend >out
for (opt in enabledby) tree[opt] = 1 # may not be explicit options for (opt in enabledby) tree[opt] = 1 # may not be explicit options
for (opt in option) tree[opt] = "" # so unlisted options marked for (opt in option) if (opt != "") {
for (opt in tree) { o = option[opt]
# option should always be one of the following values
if (o != "on" && o != "off" && o != "disabled" && o != "enabled") {
print "internal option error (" o ")"
exit 1
}
tree[opt] = "" # so unlisted options marked
}
for (opt in tree) if (opt != "") {
if (tree[opt] == 1) { if (tree[opt] == 1) {
tree[opt] = "" tree[opt] = ""
if (option[opt] != "") { if (option[opt] != "") {
@@ -418,7 +505,7 @@ END{
} }
# Macros only listed in 'enables' remain off unless # Macros only listed in 'enables' remain off unless
# one of the enabling macros is on. # one of the enabling macros is on.
option[opt] = "off" option[opt] = "disabled"
} }
split("", list) # clear 'list' split("", list) # clear 'list'
@@ -432,6 +519,51 @@ END{
# print the tree for extreme debugging # print the tree for extreme debugging
if (deb > 2) for (i in tree) if (i != "") print i, "depends-on" tree[i] if (deb > 2) for (i in tree) if (i != "") print i, "depends-on" tree[i]
# Ok, now check all options marked explicitly 'on' or 'off':
#
# If an option[opt] is 'on' then turn on all requires[opt]
# If an option[opt] is 'off' then turn off all enabledby[opt]
#
# Error out if we have to turn 'on' an 'off' option or vice versa.
npending = 0
for (opt in option) if (opt != "") {
if (option[opt] == "on" || option[opt] == "off")
pending[++npending] = opt
}
err = 0 # set on error
while (npending > 0) {
opt = pending[npending--]
if (option[opt] == "on") {
nreqs = split(requires[opt], r)
for (j=1; j<=nreqs; ++j) {
if (option[r[j]] == "off") {
print "option", opt, "turned on, but requirement", r[j], "is turned off"
err = 1
} else if (option[r[j]] != "on") {
option[r[j]] = "on"
pending[++npending] = r[j]
}
}
} else {
if (option[opt] != "off") {
print "internal error (2)"
exit 1
}
nreqs = split(enabledby[opt], r)
for (j=1; j<=nreqs; ++j) {
if (option[r[j]] == "on") {
print "option", opt, "turned off, but enabled by", r[j], "which is turned on"
err = 1
} else if (option[r[j]] != "off") {
option[r[j]] = "off"
pending[++npending] = r[j]
}
}
}
}
if (err) exit 1
# option[i] is now the complete list of all the tokens we may # option[i] is now the complete list of all the tokens we may
# need to output, go through it as above, depth first. # need to output, go through it as above, depth first.
finished = 0 finished = 0
@@ -460,7 +592,10 @@ END{
# an 'enabledby' is _SUPPORTED # an 'enabledby' is _SUPPORTED
# OR: # OR:
# NO_name is not defined AND # NO_name is not defined AND
# the option is not marked "off" # the option is not disabled; an option is disabled if:
# option == off
# option == disabled && everything != on
# option == "" && everything == off
if (deb) print "option", i if (deb) print "option", i
print "" >out print "" >out
print "/* option:", i, option[i] >out print "/* option:", i, option[i] >out
@@ -475,6 +610,11 @@ END{
for (j=1; j<=nreqs; ++j) { for (j=1; j<=nreqs; ++j) {
print "#ifndef PNG_" r[j] "_SUPPORTED" >out print "#ifndef PNG_" r[j] "_SUPPORTED" >out
print "# undef PNG_on /*!" r[j] "*/" >out print "# undef PNG_on /*!" r[j] "*/" >out
# this error appears in the final output if something
# was switched 'on' but the processing above to force
# the requires did not work
if (option[i] == "on")
print error, i, "requires", r[j] end >out
print "#endif" >out print "#endif" >out
} }
@@ -491,6 +631,11 @@ END{
} }
print "#ifdef PNG_no_if /*missing if*/" >out print "#ifdef PNG_no_if /*missing if*/" >out
print "# undef PNG_on" >out print "# undef PNG_on" >out
# There is no checking above for this, because we
# don't know which 'if' to choose, so whine about
# it here:
if (option[i] == "on")
print error, i, "needs one of:", iffs[i] end >out
print "#endif" >out print "#endif" >out
} }
@@ -503,12 +648,18 @@ END{
for (j=1; j<=nreqs; ++j) { for (j=1; j<=nreqs; ++j) {
print "#ifdef PNG_" r[j] "_SUPPORTED" >out print "#ifdef PNG_" r[j] "_SUPPORTED" >out
print "# undef PNG_not_enabled /*" r[j] "*/" >out print "# undef PNG_not_enabled /*" r[j] "*/" >out
# Oops, probably not intended (should be factored
# out by the checks above).
if (option[i] == "off")
print error, i, "enabled by:", r[j] end >out
print "#endif" >out print "#endif" >out
} }
print "# ifndef PNG_" i "_SUPPORTED /*!command line*/" >out print "# ifndef PNG_" i "_SUPPORTED /*!command line*/" >out
print "# ifdef PNG_not_enabled /*!enabled*/" >out print "# ifdef PNG_not_enabled /*!enabled*/" >out
if (option[i] == "off") { if (option[i] == "off" ||
option[i] == "disabled" && everything != "on" ||
option[i] == "enabled" && everything == "off") {
print "# undef PNG_on /*default off*/" >out print "# undef PNG_on /*default off*/" >out
} else { } else {
print "# ifdef PNG_NO_" i >out print "# ifdef PNG_NO_" i >out
@@ -529,7 +680,7 @@ END{
# pnglibconf.h # pnglibconf.h
print "# ifdef PNG_on" >out print "# ifdef PNG_on" >out
if (i ~ /^fail_/) if (i ~ /^fail_/)
print error, i, "if" iffs[i], "requires" requires[i] end >out print error, i, "is on: enabled by:" iffs[i] enabledby[i] ", requires" requires[i] end >out
else if (i !~ /^ok_/) else if (i !~ /^ok_/)
print def i sup >out print def i sup >out
print "# endif /* definition */" >out print "# endif /* definition */" >out
@@ -539,7 +690,7 @@ END{
if (logunsupported) if (logunsupported)
print und i une >out print und i une >out
if (i ~ /^ok_/) if (i ~ /^ok_/)
print error, i, "if" iffs[i], "requires" requires[i] end >out print error, i, "not enabled: requires:" requires[i] ", enabled by:" iffs[i] enabledby[i] end >out
print "#endif" >out print "#endif" >out
} }

View File

@@ -6,7 +6,7 @@
# #
com pnglibconf.h - library build configuration com pnglibconf.h - library build configuration
com com
com libpng version PNGLIB_VERSION - last changed on April 27, 2010 com libpng version PNGLIB_VERSION - last changed on April 28, 2010
com com
com Copyright (c) 1998-2010 Glenn Randers-Pehrson com Copyright (c) 1998-2010 Glenn Randers-Pehrson
com com
@@ -28,11 +28,15 @@ file pnglibconf.h scripts/pnglibconf.dfa PNGLCONF_H
# #
# setting <name> [requires ...] [default] # setting <name> [requires ...] [default]
# #define PNG_<name> <value> /* value comes from current setting */ # #define PNG_<name> <value> /* value comes from current setting */
# option <name> [requires ...] [if ...] [enables ...] [on|off] # option <name> [requires ...] [if ...] [enables ...] [disabled]
# #define PNG_<name>_SUPPORTED if the requirements are met and # #define PNG_<name>_SUPPORTED if the requirements are met and
# enable the other options listed # enable the other options listed
# chunk <name> [requires ...] [on|off] # chunk <name> [requires ...] [disabled]
# Enable chunk processing for the given ancillary chunk # Enable chunk processing for the given ancillary chunk
#
# Note that the 'on' and 'off' keywords, while valid on both option
# and chunk, should not be used in this file because they force the
# relevant options on or off.
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@@ -50,7 +54,7 @@ file pnglibconf.h scripts/pnglibconf.dfa PNGLCONF_H
# decoding but does change the libpng API because some chunks # decoding but does change the libpng API because some chunks
# will be ignored. # will be ignored.
# #
# There are three ways of disabling features, in order of correctness: # There are three ways of disabling features, in no particular order:
# #
# 1) Create 'pngusr.h', enter the required private build information # 1) Create 'pngusr.h', enter the required private build information
# detailed below and #define PNG_NO_<option> for each option you # detailed below and #define PNG_NO_<option> for each option you
@@ -81,11 +85,18 @@ file pnglibconf.h scripts/pnglibconf.dfa PNGLCONF_H
# can also change settings from pngpriv.h (read pngpriv.h) safely # can also change settings from pngpriv.h (read pngpriv.h) safely
# without API changes. Do that in the same way. # without API changes. Do that in the same way.
# #
# 3) Edit this file and add 'off' to the end of every option you # 3) Write a new '.dfa' file (say 'pngusr.dfa') and in this file
# don't want enabled, make other changes as required. Only do # provide override values for setting entries and turn option or
# this if you are proposing a permanent change to the PNG API # chunk values explicitly 'on' or 'off':
# or ABI. Do *not* release the result, under any circumstances. #
# setting FOO default VALUE
# option BAR [on|off]
#
# Then add this file to the options.awk command line (the *first*
# one) after this file.
#
# Don't edit this file unless you are contributing a patch to
# libpng and need new or modified options/settings.
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# PNG_USER_CONFIG has to be defined on the compiler command line # PNG_USER_CONFIG has to be defined on the compiler command line
@@ -146,11 +157,11 @@ option READ_INT_FUNCTIONS requires READ
# The same for write, but these can only be switched off if # The same for write, but these can only be switched off if
# no writing is required at all - hence the use of an 'enables' # no writing is required at all - hence the use of an 'enables'
# not a 'requires' below: # not a 'requires' below:
option WRITE_INT_FUNCTIONS off option WRITE_INT_FUNCTIONS disabled
option WRITE enables WRITE_INT_FUNCTIONS option WRITE enables WRITE_INT_FUNCTIONS
# Generic options - affect both read and write. # Generic options - affect both read and write.
option BENIGN_ERRORS off option BENIGN_ERRORS disabled
option MNG_FEATURES option MNG_FEATURES
option FLOATING_POINT enables ok_math option FLOATING_POINT enables ok_math
option FIXED_POINT enables ok_math option FIXED_POINT enables ok_math
@@ -181,7 +192,7 @@ option SETJMP
= NO_SETJMP SETJMP_NOT_SUPPORTED = NO_SETJMP SETJMP_NOT_SUPPORTED
# For the moment this is disabled (no code support): # For the moment this is disabled (no code support):
option ERROR_NUMBERS off option ERROR_NUMBERS disabled
# If this is disabled it is not possible for apps to get the # If this is disabled it is not possible for apps to get the
# values from the 'info' structure, this effectively removes # values from the 'info' structure, this effectively removes
@@ -197,7 +208,7 @@ option IO_STATE
# This is only for PowerPC big-endian and 680x0 systems # This is only for PowerPC big-endian and 680x0 systems
# some testing, not enabled by default. # some testing, not enabled by default.
# NO LONGER USED # NO LONGER USED
#option READ_BIG_ENDIAN off #option READ_BIG_ENDIAN disabled
# Allow users to control limits on what the READ code will # Allow users to control limits on what the READ code will
# read: # read:
@@ -250,7 +261,7 @@ option READ_INVERT requires READ_TRANSFORMS
option READ_BACKGROUND requires READ_TRANSFORMS option READ_BACKGROUND requires READ_TRANSFORMS
option READ_16_TO_8 requires READ_TRANSFORMS option READ_16_TO_8 requires READ_TRANSFORMS
option READ_FILLER requires READ_TRANSFORMS option READ_FILLER requires READ_TRANSFORMS
option READ_GAMMA requires READ_TRANSFORMS option READ_GAMMA requires READ_TRANSFORMS enables READ_gAMA
option READ_GRAY_TO_RGB requires READ_TRANSFORMS option READ_GRAY_TO_RGB requires READ_TRANSFORMS
option READ_SWAP_ALPHA requires READ_TRANSFORMS option READ_SWAP_ALPHA requires READ_TRANSFORMS
option READ_INVERT_ALPHA requires READ_TRANSFORMS option READ_INVERT_ALPHA requires READ_TRANSFORMS
@@ -272,14 +283,14 @@ option READ_COMPOSITE_NODIV requires READ
= NO_READ_COMPOSITE_NODIV PNG_NO_READ_COMPOSITED_NODIV = NO_READ_COMPOSITE_NODIV PNG_NO_READ_COMPOSITED_NODIV
# Inch conversions: not switched on by default # Inch conversions: not switched on by default
option INCH_CONVERSIONS requires FLOATING_POINT off option INCH_CONVERSIONS requires FLOATING_POINT disabled
= INCH_CONVERSIONS PNG_INCH_CONVERSIONS = INCH_CONVERSIONS PNG_INCH_CONVERSIONS
# IN DEVELOPMENT # IN DEVELOPMENT
# These are currently experimental features, define them if you want # These are currently experimental features, define them if you want
# Very little testing, not enabled by default. # Very little testing, not enabled by default.
option READ_16_TO_8_ACCURATE_SCALE requires READ off option READ_16_TO_8_ACCURATE_SCALE requires READ disabled
# WRITE options # WRITE options
option WRITE option WRITE
@@ -373,7 +384,7 @@ option WRITE_UNKNOWN_CHUNKS requires WRITE
option HANDLE_AS_UNKNOWN option HANDLE_AS_UNKNOWN
option GET_INT_32 requires READ READ_INT_FUNCTIONS option GET_INT_32 requires READ
# png_get_int_32 is required by the ancillary chunks oFFs and pCAL # png_get_int_32 is required by the ancillary chunks oFFs and pCAL
option READ_oFFs enables GET_INT_32 option READ_oFFs enables GET_INT_32
option READ_pCAL enables GET_INT_32 option READ_pCAL enables GET_INT_32

View File

@@ -1,7 +1,7 @@
/* libpng-1.5.0beta21 STANDARD API DEFINITION */ /* libpng-1.5.0beta22 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */ /* pnglibconf.h - library build configuration */
/* last changed in libpng version 1.5.0 - April 27, 2010 */ /* last changed in libpng version 1.5.0 - April 28, 2010 */
/* Copyright (c) 1998-2010 Glenn Randers-Pehrson */ /* Copyright (c) 1998-2010 Glenn Randers-Pehrson */

View File

@@ -12,12 +12,16 @@ CPP = $(CC) -E
COPY = cp COPY = cp
DELETE = rm -f DELETE = rm -f
ECHO = echo ECHO = echo
DFA_XTRA = # Appended to scripts/options.awk
# CPPFLAGS should contain the options to control the result, # CPPFLAGS should contain the options to control the result,
# but DEFS and CFLAGS are also supported here, override # but DEFS and CFLAGS are also supported here, override
# as appropriate # as appropriate
DFNFLAGS = $(DEFS) $(CPPFLAGS) $(CFLAGS) DFNFLAGS = $(DEFS) $(CPPFLAGS) $(CFLAGS)
# srcdir is a defacto standard for the location of the source
srcdir = .
# The standard pnglibconf.h exists as scripts/pnglibconf.h, # The standard pnglibconf.h exists as scripts/pnglibconf.h,
# copy this if the following doesn't work. # copy this if the following doesn't work.
pnglibconf.h: pnglibconf.dfn pnglibconf.h: pnglibconf.dfn
@@ -30,11 +34,11 @@ pnglibconf.h: pnglibconf.dfn
$(COPY) dfn3.out $@ $(COPY) dfn3.out $@
$(DELETE) dfn.c dfn1.out dfn2.out dfn3.out $(DELETE) dfn.c dfn1.out dfn2.out dfn3.out
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk
$(DELETE) $@ dfn1.out dfn2.out $(DELETE) $@ dfn1.out dfn2.out
$(AWK) -f scripts/options.awk pre=1 out=dfn1.out\ $(AWK) -f $(srcdir)/scripts/options.awk out=dfn1.out\
scripts/pnglibconf.dfa 1>&2 $(srcdir)/scripts/pnglibconf.dfa $(DFA_XTRA) 1>&2
$(AWK) -f scripts/options.awk pre=0 out=dfn2.out dfn1.out 1>&2 $(AWK) -f $(srcdir)/scripts/options.awk out=dfn2.out dfn1.out 1>&2
$(COPY) dfn2.out $@ $(COPY) dfn2.out $@
$(DELETE) dfn1.out dfn2.out $(DELETE) dfn1.out dfn2.out

View File

@@ -11,7 +11,7 @@ LIBRARY
;OS2 CODE PRELOAD MOVEABLE DISCARDABLE ;OS2 CODE PRELOAD MOVEABLE DISCARDABLE
EXPORTS EXPORTS
;Version 1.5.0beta21 ;Version 1.5.0beta22
png_access_version_number @1 png_access_version_number @1
png_set_sig_bytes @2 png_set_sig_bytes @2
png_sig_cmp @3 png_sig_cmp @3

View File

@@ -1,7 +1,7 @@
/* pngwin.dfn - define format of pngwin.def /* pngwin.dfn - define format of pngwin.def
* *
* Last changed in libpng version 1.5.0 [April 27, 2010] * Last changed in libpng version 1.5.0 [April 28, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* *
* This code is released under the libpng license. * This code is released under the libpng license.

View File

@@ -1,7 +1,7 @@
/* sym.dfn - define format of libpng.sym /* sym.dfn - define format of libpng.sym
* *
* Last changed in libpng version 1.5.0 [April 27, 2010] * Last changed in libpng version 1.5.0 [April 28, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* *
* This code is released under the libpng license. * This code is released under the libpng license.

View File

@@ -5,7 +5,7 @@
LIBRARY LIBRARY
EXPORTS EXPORTS
;Version 1.5.0beta21 ;Version 1.5.0beta22
png_access_version_number @1 png_access_version_number @1
png_set_sig_bytes @2 png_set_sig_bytes @2
png_sig_cmp @3 png_sig_cmp @3

View File

@@ -1,7 +1,7 @@
/* symbols.dfn - find all exported symbols /* symbols.dfn - find all exported symbols
* *
* Last changed in libpng version 1.5.0 [April 27, 2010] * Last changed in libpng version 1.5.0 [April 28, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* *
* This code is released under the libpng license. * This code is released under the libpng license.

View File

@@ -1,7 +1,7 @@
/* vers.dfn - define format of libpng.vers /* vers.dfn - define format of libpng.vers
* *
* Last changed in libpng version 1.5.0 [April 27, 2010] * Last changed in libpng version 1.5.0 [April 28, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* *
* This code is released under the libpng license. * This code is released under the libpng license.