[libpng16] Ported libpng 1.5 options.awk/dfn file handling to 1.6, fixed one bug.

This commit is contained in:
John Bowler 2013-02-15 23:40:34 -06:00 committed by Glenn Randers-Pehrson
parent 2d99978f67
commit 42835d3d19
17 changed files with 316 additions and 168 deletions

View File

@ -30,6 +30,7 @@ Version 1.6.1 [February 16, 2013]
to be included for preprocessor definitions only, so it can be used in non-C/C++
files. Back ported from libpng 1.7.
Made sRGB check numbers consistent.
Ported libpng 1.5 options.awk/dfn file handling to 1.6, fixed one bug.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4386,6 +4386,7 @@ Version 1.6.1 [February 16, 2013]
to be included for preprocessor definitions only, so it can be used in non-C/C++
files. Back ported from libpng 1.7.
Made sRGB check numbers consistent.
Ported libpng 1.5 options.awk/dfn file handling to 1.6, fixed one bug.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -180,16 +180,14 @@ SYMBOL_CFLAGS += -DPNG_PREFIX='@PNG_PREFIX@'
endif
.dfn.out:
rm -f $@ $*.c $*.tf[123]
rm -f $@ $*.c $*.tf[12]
test -d scripts || mkdir scripts
echo '#include "$<"' >$*.c
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\
$(CPPFLAGS) $(SYMBOL_CFLAGS) $*.c > $*.tf1
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
$*.tf1 >$*.tf2
$(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' $*.tf2 >$*.tf3
rm -f $*.c $*.tf[12]
mv $*.tf3 $@
$(AWK) -f "${srcdir}/scripts/dfn.awk" out="$*.tf2" $*.tf1 1>&2
rm -f $*.c $*.tf1
mv $*.tf2 $@
# The .dfn file for pnglibconf.h is machine generated
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)

View File

@ -1,5 +1,5 @@
Makefiles for libpng version 1.6.1beta01 - February 14, 2013
Makefiles for libpng version 1.6.1beta01 - February 16, 2013
pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile

View File

@ -8,31 +8,22 @@
* and license in png.h
*/
/* These macros exist to make the header and trailer shorter below: */
#define S PNG_DEFN_MAGIC
#define E PNG_DEFN_END
/* Write the export file header: */
S-;---------------------------------------------------------------E
S-; LIBPNG module definition file for OS/2-E
S-;---------------------------------------------------------------E
S--E
S-; If you give the library an explicit name one or other files-E
S-; may need modifying to support the new name on one or more-E
S-; systems.-E
S-LIBRARY-E
S-OS2 DESCRIPTION "PNG image compression library"-E
S-OS2 CODE PRELOAD MOVEABLE DISCARDABLE-E
S--E
S-EXPORTS-E
S-;Version 1.6.1beta01-E
PNG_DFN ";--------------------------------------------------------------"
PNG_DFN "; LIBPNG module definition file for OS/2"
PNG_DFN ";--------------------------------------------------------------"
PNG_DFN ""
PNG_DFN "; If you give the library an explicit name one or other files"
PNG_DFN "; may need modifying to support the new name on one or more"
PNG_DFN "; systems."
PNG_DFN "LIBRARY"
PNG_DFN "OS2 DESCRIPTION "PNG image compression library""
PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
PNG_DFN ""
PNG_DFN "EXPORTS"
PNG_DFN ";Version 1.6.1beta01"
/* 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 "@"
#include "../png.h"

135
scripts/dfn.awk Normal file
View File

@ -0,0 +1,135 @@
#!/bin/awk -f
# scripts/dfn.awk - process a .dfn file
#
# last changed in libpng version 1.5.14 - February 4, 2013
#
# Copyright (c) 2013-2013 Glenn Randers-Pehrson
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# The output of this script is written to the file given by
# the variable 'out', which should be set on the command line.
# Error messages are printed to stdout and if any are printed
# the script will exit with error code 1.
BEGIN{
out="/dev/null" # as a flag
out_count=0 # count of output lines
err=0 # set if an error occured
sort=0 # sort the output
array[""]=""
}
# The output file must be specified before any input:
NR==1 && out == "/dev/null" {
print "out=output.file must be given on the command line"
# but continue without setting the error code, this allows the
# script to be checked easily
}
# Output can be sorted; two lines are recognized
$1 == "PNG_DFN_START_SORT"{
sort=$2
next
}
$1 == "PNG_DFN_END_SORT"{
# Do a very simple, slow, sort; notice that blank lines won't be
# output by this
for (entry in array) {
while (array[entry] != "") {
key = entry
value = array[key]
array[key] = ""
for (alt in array) {
if (array[alt] != "" && alt < key) {
array[key] = value
value = array[alt]
key = alt
array[alt] = ""
}
}
print value >out
}
}
sort=0
next
}
/^[^"]*PNG_DFN *".*"[^"]*$/{
# A definition line, apparently correctly formated, extract the
# definition then replace any doubled "" that remain with a single
# double quote. Notice that the original doubled double quotes
# may have been split by tokenization
orig=$0
if (gsub(/^[^"]*PNG_DFN *"/,"") != 1 || gsub(/"[^"]*$/, "") != 1) {
print "line", NR, "processing failed:"
print orig
print $0
err=1
} else {
++out_count
}
# Now examine quotes within the value:
#
# @" - delete this and any following spaces
# "@ - delete this and any original spaces
# @' - replace this by a double quote
#
# This allows macro substitution by the C compiler thus:
#
# #define first_name John
# #define last_name Smith
#
# PNG_DFN"#define name @'@" first_name "@ @" last_name "@@'"
#
# Might get C preprocessed to:
#
# PNG_DFN "#define foo @'@" John "@ @" Smith "@@'"
#
# Which this script reduces to:
#
# #define name "John Smith"
#
while (sub(/@" */, "")) {
if (!sub(/ *"@/, "")) {
print "unbalanced @\" ... \"@ pair"
err=1
break
}
}
# Put any needed double quotes in
gsub(/@'/,"\"")
# Remove any trailing spaces (not really required, but for
# editorial consistency
sub(/ *$/, "")
if (sort)
array[$(sort)] = $0
else
print $0 >out
next
}
/PNG_DFN/{
print "line", NR, "incorrectly formated PNG_DFN line:"
print $0
err = 1
}
END{
if (out_count > 0 || err > 0)
exit err
print "no definition lines found"
exit 1
}

View File

@ -10,10 +10,10 @@
*/
#define PNG_INTERNAL_DATA(type, name, array)\
PNG_DEFN_MAGIC-name-PNG_DEFN_END
PNG_DFN "@" name "@"
#define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\
PNG_DEFN_MAGIC-name-PNG_DEFN_END
PNG_DFN "@" name "@"
#define PNGPREFIX_H /* self generation */
#include "../pngpriv.h"

View File

@ -43,7 +43,7 @@ LN_SF=ln -sf
#ARCH = -march=pentium3
#ARCH = -march=i686
ARCH =
ARCH =
CDEBUG = -g -DPNG_DEBUG=5
LDDEBUG =
CRELEASE = -O2

View File

@ -39,6 +39,7 @@ CPP = $(CC) -E
ECHO = echo
DFNFLAGS = # DFNFLAGS contains -D options to use in the libpng build
DFA_EXTRA = # extra files that can be used to control configuration
CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
@ -50,23 +51,23 @@ all: libpng.a pngtest
# The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
# copy this if the following doesn't work.
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
$(RM_F) $@ dfn?.out
$(AWK) -f scripts/options.awk out=dfn1.out version=search pngconf.h\
scripts/pnglibconf.dfa $(DFA_XTRA) 1>&2
$(AWK) -f scripts/options.awk out=dfn2.out dfn1.out 1>&2
cp dfn2.out $@
$(RM_F) dfn?.out
pnglibconf.h: pnglibconf.dfn
$(RM_F) $@ dfn.c dfn?.out
$(ECHO) '#include "pnglibconf.dfn"' >dfn.c
$(CPP) $(DFNFLAGS) dfn.c >dfn1.out
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
dfn1.out >dfn2.out
$(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out
cp dfn3.out $@
$(RM_F) dfn.c dfn?.out
$(RM_F) $@ pnglibconf.c pnglibconf.out pnglibconf.tmp
$(ECHO) '#include "pnglibconf.dfn"' >pnglibconf.c
$(ECHO) "If '$(CC) -E' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
$(CPP) $(DFNFLAGS) pnglibconf.c >pnglibconf.out
$(AWK) -f "scripts/dfn.awk" out="pnglibconf.tmp" pnglibconf.out 1>&2
mv pnglibconf.tmp $@
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
$(RM_F) $@ pnglibconf.pre pnglibconf.tmp
$(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
$(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2
$(AWK) -f scripts/options.awk out="pnglibconf.pre"\
version=search pngconf.h scripts/pnglibconf.dfa\
pngusr.dfa $(DFA_XTRA) 1>&2
$(AWK) -f scripts/options.awk out="pnglibconf.tmp" pnglibconf.pre 1>&2
mv pnglibconf.tmp $@
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)
@ -96,7 +97,7 @@ install: libpng.a pnglibconf.h
chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
clean:
$(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.* dfn.c dfn?.out
$(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.*
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:

View File

@ -35,17 +35,28 @@ 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
subs="@\" " # Substitute start (substitute a C macro)
sube=" \"@" # Substitute end
comment=start "/*" # Comment start
cend="*/" end # Comment end
def=start "#define PNG_" ct # Arbitrary define
sup=ct "_SUPPORTED" 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" 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 +113,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
}
@ -473,6 +483,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
@ -492,10 +504,17 @@ END{
# All the requirements have been processed, output
# this setting.
if (deb) print "setting", i
deflt = defaults[i]
# A leading @ means leave it unquoted so the preprocessor
# can substitute the build time value
if (deflt ~ /^ @/)
deflt = " " subs substr(deflt, 3) sube
# Remove any spurious trailing spaces
sub(/ *$/,"",deflt)
print "" >out
print "/* setting: ", i >out
print " * requires:" setting[i] >out
print " * default: ", defaults[i], "*/" >out
print " * default: ", defaults[i] defltinfo, "*/" >out
if (defaults[i] == "") { # no default, only check if defined
print "#ifdef PNG_" i >out
}
@ -507,13 +526,14 @@ END{
if (defaults[i] != "") { # default handling
print "#ifdef PNG_" i >out
}
print def i, "PNG_" i end >out
# PNG_<i> is defined, so substitute the value:
print def i, subs "PNG_" i sube end >out
if (defaults[i] != "") {
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 "# define PNG_" i deflt >out
print def i deflt end >out
}
print "#endif" >out
@ -529,6 +549,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
@ -623,6 +644,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
@ -774,10 +798,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
}
}

View File

@ -190,13 +190,17 @@ setting DEFAULT_READ_MACROS default 1
# because the name of the setting is prefixed by PNG_
#
# The TEXT values are the defaults when writing compressed text (all forms)
#
# Include the zlib header too, so that the defaults below are known
@# include <zlib.h>
setting Z_DEFAULT_COMPRESSION default Z_DEFAULT_COMPRESSION
setting Z_DEFAULT_STRATEGY default Z_FILTERED
setting Z_DEFAULT_NOFILTER_STRATEGY default Z_DEFAULT_STRATEGY
# The '@' here means to substitute the value when pnglibconf.h is built
setting Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION
setting Z_DEFAULT_STRATEGY default @Z_FILTERED
setting Z_DEFAULT_NOFILTER_STRATEGY default @Z_DEFAULT_STRATEGY
setting TEXT_Z_DEFAULT_COMPRESSION default Z_DEFAULT_COMPRESSION
setting TEXT_Z_DEFAULT_STRATEGY default Z_DEFAULT_STRATEGY
setting TEXT_Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION
setting TEXT_Z_DEFAULT_STRATEGY default @Z_DEFAULT_STRATEGY
# The alternative is to call functions to read PNG values, if
# the functions are turned *off* the read macros must always

View File

@ -3,7 +3,7 @@
/* pnglibconf.h - library build configuration */
/* Libpng 1.6.1beta01 - February 14, 2013 */
/* Libpng 1.6.1beta01 - February 16, 2013 */
/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */
@ -32,15 +32,15 @@
#define PNG_QUANTIZE_BLUE_BITS 5
#define PNG_QUANTIZE_GREEN_BITS 5
#define PNG_QUANTIZE_RED_BITS 5
#define PNG_sCAL_PRECISION 5
#define PNG_sRGB_PROFILE_CHECKS 2
#define PNG_TEXT_Z_DEFAULT_COMPRESSION Z_DEFAULT_COMPRESSION
#define PNG_TEXT_Z_DEFAULT_STRATEGY Z_DEFAULT_STRATEGY
#define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1)
#define PNG_TEXT_Z_DEFAULT_STRATEGY 0
#define PNG_WEIGHT_SHIFT 8
#define PNG_ZBUF_SIZE 8192
#define PNG_Z_DEFAULT_COMPRESSION Z_DEFAULT_COMPRESSION
#define PNG_Z_DEFAULT_NOFILTER_STRATEGY Z_DEFAULT_STRATEGY
#define PNG_Z_DEFAULT_STRATEGY Z_FILTERED
#define PNG_Z_DEFAULT_COMPRESSION (-1)
#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
#define PNG_Z_DEFAULT_STRATEGY 1
#define PNG_sCAL_PRECISION 5
#define PNG_sRGB_PROFILE_CHECKS 2
/* end of settings */
/* options */
#define PNG_16BIT_SUPPORTED
@ -48,10 +48,8 @@
#define PNG_BENIGN_ERRORS_SUPPORTED
#define PNG_BENIGN_READ_ERRORS_SUPPORTED
/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/
#define PNG_bKGD_SUPPORTED
#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
#define PNG_cHRM_SUPPORTED
#define PNG_COLORSPACE_SUPPORTED
#define PNG_CONSOLE_IO_SUPPORTED
#define PNG_CONVERT_tIME_SUPPORTED
@ -63,20 +61,13 @@
#define PNG_FLOATING_POINT_SUPPORTED
#define PNG_FORMAT_AFIRST_SUPPORTED
#define PNG_FORMAT_BGR_SUPPORTED
#define PNG_gAMA_SUPPORTED
#define PNG_GAMMA_SUPPORTED
#define PNG_GET_PALETTE_MAX_SUPPORTED
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
#define PNG_hIST_SUPPORTED
#define PNG_iCCP_SUPPORTED
#define PNG_INCH_CONVERSIONS_SUPPORTED
#define PNG_INFO_IMAGE_SUPPORTED
#define PNG_IO_STATE_SUPPORTED
#define PNG_iTXt_SUPPORTED
#define PNG_MNG_FEATURES_SUPPORTED
#define PNG_oFFs_SUPPORTED
#define PNG_pCAL_SUPPORTED
#define PNG_pHYs_SUPPORTED
#define PNG_POINTER_INDEXING_SUPPORTED
#define PNG_PROGRESSIVE_READ_SUPPORTED
#define PNG_READ_16BIT_SUPPORTED
@ -84,62 +75,60 @@
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_READ_BACKGROUND_SUPPORTED
#define PNG_READ_BGR_SUPPORTED
#define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
#define PNG_READ_cHRM_SUPPORTED
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
#define PNG_READ_EXPAND_16_SUPPORTED
#define PNG_READ_EXPAND_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED
#define PNG_READ_gAMA_SUPPORTED
#define PNG_READ_GAMMA_SUPPORTED
#define PNG_READ_GET_PALETTE_MAX_SUPPORTED
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
#define PNG_READ_hIST_SUPPORTED
#define PNG_READ_iCCP_SUPPORTED
#define PNG_READ_INTERLACING_SUPPORTED
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
#define PNG_READ_INVERT_ALPHA_SUPPORTED
#define PNG_READ_INVERT_SUPPORTED
#define PNG_READ_iTXt_SUPPORTED
#define PNG_READ_oFFs_SUPPORTED
#define PNG_READ_OPT_PLTE_SUPPORTED
#define PNG_READ_PACK_SUPPORTED
#define PNG_READ_PACKSWAP_SUPPORTED
#define PNG_READ_pCAL_SUPPORTED
#define PNG_READ_pHYs_SUPPORTED
#define PNG_READ_PACK_SUPPORTED
#define PNG_READ_QUANTIZE_SUPPORTED
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
#define PNG_READ_sBIT_SUPPORTED
#define PNG_READ_SCALE_16_TO_8_SUPPORTED
#define PNG_READ_sCAL_SUPPORTED
#define PNG_READ_SHIFT_SUPPORTED
#define PNG_READ_sPLT_SUPPORTED
#define PNG_READ_sRGB_SUPPORTED
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_SUPPORTED
#define PNG_READ_SWAP_ALPHA_SUPPORTED
#define PNG_READ_SWAP_SUPPORTED
#define PNG_READ_tEXt_SUPPORTED
#define PNG_READ_TEXT_SUPPORTED
#define PNG_READ_tIME_SUPPORTED
#define PNG_READ_TRANSFORMS_SUPPORTED
#define PNG_READ_tRNS_SUPPORTED
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_READ_USER_CHUNKS_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_cHRM_SUPPORTED
#define PNG_READ_gAMA_SUPPORTED
#define PNG_READ_hIST_SUPPORTED
#define PNG_READ_iCCP_SUPPORTED
#define PNG_READ_iTXt_SUPPORTED
#define PNG_READ_oFFs_SUPPORTED
#define PNG_READ_pCAL_SUPPORTED
#define PNG_READ_pHYs_SUPPORTED
#define PNG_READ_sBIT_SUPPORTED
#define PNG_READ_sCAL_SUPPORTED
#define PNG_READ_sPLT_SUPPORTED
#define PNG_READ_sRGB_SUPPORTED
#define PNG_READ_tEXt_SUPPORTED
#define PNG_READ_tIME_SUPPORTED
#define PNG_READ_tRNS_SUPPORTED
#define PNG_READ_zTXt_SUPPORTED
/*#undef PNG_SAFE_LIMITS_SUPPORTED*/
#define PNG_SAVE_INT_32_SUPPORTED
#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_sBIT_SUPPORTED
#define PNG_sCAL_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED
#define PNG_SETJMP_SUPPORTED
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
#define PNG_SETJMP_SUPPORTED
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED
#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
@ -148,15 +137,10 @@
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
#define PNG_sPLT_SUPPORTED
#define PNG_sRGB_SUPPORTED
#define PNG_STDIO_SUPPORTED
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_tEXt_SUPPORTED
#define PNG_TEXT_SUPPORTED
#define PNG_TIME_RFC1123_SUPPORTED
#define PNG_tIME_SUPPORTED
#define PNG_tRNS_SUPPORTED
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_USER_CHUNKS_SUPPORTED
#define PNG_USER_LIMITS_SUPPORTED
@ -167,46 +151,62 @@
#define PNG_WRITE_16BIT_SUPPORTED
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_WRITE_BGR_SUPPORTED
#define PNG_WRITE_bKGD_SUPPORTED
#define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
#define PNG_WRITE_cHRM_SUPPORTED
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
#define PNG_WRITE_FILLER_SUPPORTED
#define PNG_WRITE_FILTER_SUPPORTED
#define PNG_WRITE_FLUSH_SUPPORTED
#define PNG_WRITE_gAMA_SUPPORTED
#define PNG_WRITE_GET_PALETTE_MAX_SUPPORTED
#define PNG_WRITE_hIST_SUPPORTED
#define PNG_WRITE_iCCP_SUPPORTED
#define PNG_WRITE_INTERLACING_SUPPORTED
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
#define PNG_WRITE_INVERT_SUPPORTED
#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
#define PNG_WRITE_PACKSWAP_SUPPORTED
#define PNG_WRITE_PACK_SUPPORTED
#define PNG_WRITE_SHIFT_SUPPORTED
#define PNG_WRITE_SUPPORTED
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
#define PNG_WRITE_SWAP_SUPPORTED
#define PNG_WRITE_TEXT_SUPPORTED
#define PNG_WRITE_TRANSFORMS_SUPPORTED
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#define PNG_WRITE_bKGD_SUPPORTED
#define PNG_WRITE_cHRM_SUPPORTED
#define PNG_WRITE_gAMA_SUPPORTED
#define PNG_WRITE_hIST_SUPPORTED
#define PNG_WRITE_iCCP_SUPPORTED
#define PNG_WRITE_iTXt_SUPPORTED
#define PNG_WRITE_oFFs_SUPPORTED
#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
#define PNG_WRITE_PACK_SUPPORTED
#define PNG_WRITE_PACKSWAP_SUPPORTED
#define PNG_WRITE_pCAL_SUPPORTED
#define PNG_WRITE_pHYs_SUPPORTED
#define PNG_WRITE_sBIT_SUPPORTED
#define PNG_WRITE_sCAL_SUPPORTED
#define PNG_WRITE_SHIFT_SUPPORTED
#define PNG_WRITE_sPLT_SUPPORTED
#define PNG_WRITE_sRGB_SUPPORTED
#define PNG_WRITE_SUPPORTED
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
#define PNG_WRITE_SWAP_SUPPORTED
#define PNG_WRITE_tEXt_SUPPORTED
#define PNG_WRITE_TEXT_SUPPORTED
#define PNG_WRITE_tIME_SUPPORTED
#define PNG_WRITE_TRANSFORMS_SUPPORTED
#define PNG_WRITE_tRNS_SUPPORTED
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#define PNG_WRITE_zTXt_SUPPORTED
#define PNG_bKGD_SUPPORTED
#define PNG_cHRM_SUPPORTED
#define PNG_gAMA_SUPPORTED
#define PNG_hIST_SUPPORTED
#define PNG_iCCP_SUPPORTED
#define PNG_iTXt_SUPPORTED
#define PNG_oFFs_SUPPORTED
#define PNG_pCAL_SUPPORTED
#define PNG_pHYs_SUPPORTED
#define PNG_sBIT_SUPPORTED
#define PNG_sCAL_SUPPORTED
#define PNG_sPLT_SUPPORTED
#define PNG_sRGB_SUPPORTED
#define PNG_tEXt_SUPPORTED
#define PNG_tIME_SUPPORTED
#define PNG_tRNS_SUPPORTED
#define PNG_zTXt_SUPPORTED
/* end of options */
#endif /* PNGLCONF_H */

View File

@ -3,7 +3,7 @@
#
# These lines are copied from Makefile.am, they illustrate
# how to automate the build of pnglibconf.h from scripts/pnglibconf.dfa
# given 'awk' and 'sed'
# given just 'awk', a C preprocessor and standard command line utilities
# Override as appropriate, these definitions can be overridden on
# the make command line (AWK='nawk' for example).
@ -12,10 +12,9 @@ AWK = mawk
AWK = nawk
AWK = one-true-awk
AWK = awk # Crashes on SunOS 5.10 - use 'nawk'
CPP = $(CC) -E # Does not work on SUN OS 5.10 - use /lib/cpp
SED = sed
CPP = $(CC) -E # On SUN OS 5.10 if this causes problems use /lib/cpp
COPY = cp
MOVE = mv
DELETE = rm -f
ECHO = echo
DFA_XTRA = # Put your configuration file here, see scripts/pnglibconf.dfa. Eg:
@ -32,28 +31,24 @@ srcdir = .
# The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
# copy this if the following doesn't work.
pnglibconf.h: pnglibconf.dfn
$(DELETE) $@ dfn.c dfn1.out dfn2.out dfn3.out
$(ECHO) '#include "pnglibconf.dfn"' >dfn.c
$(CPP) $(DFNFLAGS) dfn.c >dfn1.out
$(ECHO) "If 'cpp -e' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
dfn1.out >dfn2.out
$(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out
$(COPY) dfn3.out $@
$(DELETE) dfn.c dfn1.out dfn2.out dfn3.out
$(DELETE) $@ pnglibconf.c pnglibconf.out pnglibconf.tmp
$(ECHO) '#include "pnglibconf.dfn"' >pnglibconf.c
$(ECHO) "If '$(CC) -E' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
$(CPP) $(DFNFLAGS) pnglibconf.c >pnglibconf.out
$(AWK) -f "$(srcdir)/scripts/dfn.awk" out="pnglibconf.tmp" pnglibconf.out 1>&2
$(MOVE) pnglibconf.tmp $@
pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk $(srcdir)/pngconf.h $(srcdir)/pngusr.dfa
$(DELETE) $@ dfn1.out dfn2.out
pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk $(srcdir)/pngconf.h $(srcdir)/pngusr.dfa $(DFA_XTRA)
$(DELETE) $@ pnglibconf.pre pnglibconf.tmp
$(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
$(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2
$(AWK) -f $(srcdir)/scripts/options.awk out=dfn1.out version=search\
$(srcdir)/pngconf.h $(srcdir)/scripts/pnglibconf.dfa\
$(srcdir)/pngusr.dfa $(DFA_XTRA) 1>&2
$(AWK) -f $(srcdir)/scripts/options.awk out=dfn2.out dfn1.out 1>&2
$(COPY) dfn2.out $@
$(DELETE) dfn1.out dfn2.out
$(AWK) -f $(srcdir)/scripts/options.awk out="pnglibconf.pre"\
version=search $(srcdir)/pngconf.h $(srcdir)/scripts/pnglibconf.dfa\
$(srcdir)/pngusr.dfa $(DFA_XTRA) 1>&2
$(AWK) -f $(srcdir)/scripts/options.awk out="pnglibconf.tmp" pnglibconf.pre 1>&2
$(MOVE) pnglibconf.tmp $@
clean-pnglibconf:
$(DELETE) pnglibconf.h pnglibconf.dfn dfn.c dfn1.out dfn2.out dfn3.out
$(DELETE) pnglibconf.*
clean: clean-pnglibconf

View File

@ -10,11 +10,15 @@
*/
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
PNG_DEFN_MAGIC-name-PNG_DEFN_END
PNG_DFN "@" name "@"
/* The configuration information *before* the additional of symbol renames,
* the list is the C name list; no symbol prefix.
*/
#include "pnglibconf.out"
PNG_DFN_START_SORT 1
#include "../png.h"
PNG_DFN_END_SORT

View File

@ -10,6 +10,6 @@
*/
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
PNG_DEFN_MAGIC-SYMBOL_PREFIX PNG_JOIN name-PNG_DEFN_END
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"
#include "../png.h"

View File

@ -17,11 +17,11 @@
*/
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
PNG_DEFN_MAGIC-name @ordinal-PNG_DEFN_END
PNG_DFN "@" name "@ @@" ordinal "@"
#define PNG_REMOVED(ordinal, type, name, args, attributes)\
PNG_DEFN_MAGIC-; name @ordinal-PNG_DEFN_END
PNG_DFN "; @" name "@ @@" ordinal "@"
#define PNG_EXPORT_LAST_ORDINAL(ordinal)\
PNG_DEFN_MAGIC-; @ordinal-PNG_DEFN_END
PNG_DFN "; @@" ordinal "@"
/* Read the defaults, but use scripts/pnglibconf.h.prebuilt; the 'standard'
* header file.

View File

@ -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: *; };"