Imported from libpng-1.0.4-pre1.tar
This commit is contained in:
parent
87544ac62b
commit
4393a9ad6b
91
ANNOUNCE
91
ANNOUNCE
@ -1,53 +1,56 @@
|
||||
|
||||
Libpng 1.0.3 - January 14, 1999
|
||||
Libpng 1.0.4 - September 17, 1999
|
||||
|
||||
This is a public release of libpng, intended for use in production codes.
|
||||
|
||||
Changes since the previous public release (1.0.2):
|
||||
Changes since the last public release (1.0.3):
|
||||
|
||||
libpng-1.0.3:
|
||||
|
||||
Replaced and extended code that was removed from png_set_filler() in 1.0.1a.
|
||||
Fixed a bug in png_do_filler() that made it fail to write filler bytes in
|
||||
the left-most pixel of each row (Kevin Bracey).
|
||||
Changed "static pngcharp tIME_string" to "static char tIME_string[30]"
|
||||
in pngtest.c (Duncan Simpson).
|
||||
Fixed a bug in pngtest.c that caused pngtest to try to write a tIME chunk
|
||||
even when no tIME chunk was present in the source file.
|
||||
Fixed a problem in pngrutil.c: gray_to_rgb didn't always work with 16-bit.
|
||||
Fixed a problem in png_read_push_finish_row(), which would not skip some
|
||||
passes that it should skip, for images that are less than 3 pixels high.
|
||||
Interchanged the order of calls to png_do_swap() and png_do_shift()
|
||||
in pngwtran.c (John Cromer).
|
||||
Added #ifdef PNG_DEBUG/#endif surrounding use of PNG_DEBUG in png.h .
|
||||
Changed "bad adaptive filter type" from error to warning in pngrutil.c .
|
||||
Fixed a documentation error about default filtering with 8-bit indexed-color.
|
||||
Separated the PNG_NO_STDIO macro into PNG_NO_STDIO and PNG_NO_CONSOLE_IO
|
||||
(L. Peter Deutsch).
|
||||
Added png_set_rgb_to_gray() and png_get_rgb_to_gray_status() functions.
|
||||
Added png_get_copyright() and png_get_header_version() functions.
|
||||
Revised comments on png_set_progressive_read_fn() in libpng.txt and example.c
|
||||
Added information about debugging in libpng.txt and libpng.3 .
|
||||
Changed "ln -sf" to "ln -s -f" in makefile.s2x, makefile.lnx, and makefile.sco.
|
||||
Removed lines after Dynamic Dependencies" in makefile.aco .
|
||||
Revised makefile.dec to make a shared library (Jeremie Petit).
|
||||
Removed trailing blanks from all files.
|
||||
Removed misplaced #endif and #ifdef PNG_NO_EXTERN near the end of png.h
|
||||
Added "if" tests to silence complaints about unused png_ptr in png.h and png.c
|
||||
Changed "check_if_png" function in example.c to return true (nonzero) if PNG.
|
||||
Changed libpng.txt to demonstrate png_sig_cmp() instead of png_check_sig()
|
||||
which is obsolete.
|
||||
Added makefile.hux, for Hewlett Packard HPUX 10.20 and 11.00 (Jim Rice)
|
||||
Added a statement of Y2K compliance in png.h, libpng.1, and Y2KINFO.
|
||||
Added check for PNG_READ_INTERLACE_SUPPORTED in pngread.c; issue a warning
|
||||
if an attempt is made to read an interlaced image when it's not supported.
|
||||
Added check if png_ptr->trans is defined before free'ing it in pngread.c
|
||||
Modified the Y2K statement to include versions back to version 0.71
|
||||
Fixed a bug in the check for valid IHDR bit_depth/color_types in pngrutil.c
|
||||
Modified makefile.wat (added -zp8 flag, ".symbolic", changed some comments)
|
||||
Replaced leading blanks with tab characters in makefile.hux
|
||||
Changed "dworkin.wustl.edu" to "ccrc.wustl.edu" in various documents.
|
||||
Changed (float)red and (float)green to (double)red, (double)green
|
||||
in png_set_rgb_to_gray() to avoid "promotion" problems in AIX.
|
||||
Fixed a bug in pngconf.h that omitted <stdio.h> when PNG_DEBUG==0 (K Bracey).
|
||||
Reformatted libpng.3 and libpngpf.3 with proper fonts (script by J. vanZandt).
|
||||
Updated documentation to refer to the PNG-1.2 specification.
|
||||
Removed ansi2knr.c and left pointers to the latest source for ansi2knr.c
|
||||
in makefile.knr, INSTALL, and README (L. Peter Deutsch)
|
||||
Fixed bugs in calculation of the length of rowbytes when adding alpha
|
||||
channels to 16-bit images, in pngrtran.c (Chris Nokleberg)
|
||||
Added function png_set_user_transform_info() to store user_transform_ptr,
|
||||
user_depth, and user_channels into the png_struct, and a function
|
||||
png_get_user_transform_ptr() to retrieve the pointer (Chris Nokleberg)
|
||||
Added function png_set_empty_plte_permitted() to make libpng useable
|
||||
in MNG applications.
|
||||
Corrected the typedef for png_free_ptr in png.h (Jesse Jones).
|
||||
Correct gamma with srgb is 45455 instead of 45000 in pngrutil.c, to be
|
||||
consistent with PNG-1.2, and allow variance of 500 before complaining.
|
||||
Added assembler code contributed by Intel in file pngvcrd.c and modified
|
||||
makefile.w32 to use it (Nirav Chhatrapati, INTEL Corporation, Gilles Vollant)
|
||||
Define PNG_USE_PNGVCRD in makefile.w32, to get MMX assembler code.
|
||||
Changed "ln -s -f" to "ln -f -s" in the makefiles to make Solaris happy.
|
||||
Added makefile.beo for BEOS on X86, contributed by Sander Stok.
|
||||
Replaced 2147483647L several places with PNG_MAX_UINT macro, defined in png.h
|
||||
Changed leading blanks to tabs in all makefiles.
|
||||
Made alternate versions of png_set_expand() in pngrtran.c, namely
|
||||
png_set_gray_1_2_4_to_8, png_set_palette_to_rgb, and png_set_tRNS_to_alpha
|
||||
(Greg Roelofs, in "PNG: The Definitive Guide").
|
||||
Relocated start of 'extern "C"' block in png.h so it doesn't include pngconf.h
|
||||
Revised calculation of num_blocks in pngmem.c to avoid a potentially
|
||||
negative shift distance, whose results are undefined in the C language.
|
||||
Added a check in pngset.c to prevent writing multiple tIME chunks.
|
||||
Added a check in pngwrite.c to detect invalid small window_bits sizes.
|
||||
Added a demo read_user_transform_fn that examines the row filters in pngtest.c
|
||||
Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined
|
||||
Made several minor corrections to pngtest.c
|
||||
Changed "hptr += 16L" to "hptr = hptr + 16L" in pngmem.c for Turbo 3.0
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu
|
||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||
|
||||
Glenn R-P
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
libpng maintainer
|
||||
PNG Development Group
|
||||
|
55
CHANGES
55
CHANGES
@ -386,4 +386,57 @@ version 1.0.2a [January 6, 1999]
|
||||
which is obsolete.
|
||||
version 1.0.3 [January 14, 1999]
|
||||
Added makefile.hux, for Hewlett Packard HPUX 10.20 and 11.00 (Jim Rice)
|
||||
Added a statement of Y2K compliance in png.h, libpng.1, and Y2KINFO.
|
||||
Added a statement of Y2K compliance in png.h, libpng.3, and Y2KINFO.
|
||||
version 1.0.3a [August 12, 1999]
|
||||
Added check for PNG_READ_INTERLACE_SUPPORTED in pngread.c; issue a warning
|
||||
if an attempt is made to read an interlaced image when it's not supported.
|
||||
Added check if png_ptr->trans is defined before free'ing it in pngread.c
|
||||
Modified the Y2K statement to include versions back to version 0.71
|
||||
Fixed a bug in the check for valid IHDR bit_depth/color_types in pngrutil.c
|
||||
Modified makefile.wat (added -zp8 flag, ".symbolic", changed some comments)
|
||||
Replaced leading blanks with tab characters in makefile.hux
|
||||
Changed "dworkin.wustl.edu" to "ccrc.wustl.edu" in various documents.
|
||||
Changed (float)red and (float)green to (double)red, (double)green
|
||||
in png_set_rgb_to_gray() to avoid "promotion" problems in AIX.
|
||||
Fixed a bug in pngconf.h that omitted <stdio.h> when PNG_DEBUG==0 (K Bracey).
|
||||
Reformatted libpng.3 and libpngpf.3 with proper fonts (script by J. vanZandt).
|
||||
Updated documentation to refer to the PNG-1.2 specification.
|
||||
Removed ansi2knr.c and left pointers to the latest source for ansi2knr.c
|
||||
in makefile.knr, INSTALL, and README (L. Peter Deutsch)
|
||||
Fixed bugs in calculation of the length of rowbytes when adding alpha
|
||||
channels to 16-bit images, in pngrtran.c (Chris Nokleberg)
|
||||
Added function png_set_user_transform_info() to store user_transform_ptr,
|
||||
user_depth, and user_channels into the png_struct, and a function
|
||||
png_get_user_transform_ptr() to retrieve the pointer (Chris Nokleberg)
|
||||
Added function png_set_empty_plte_permitted() to make libpng useable
|
||||
in MNG applications.
|
||||
Corrected the typedef for png_free_ptr in png.h (Jesse Jones).
|
||||
Correct gamma with srgb is 45455 instead of 45000 in pngrutil.c, to be
|
||||
consistent with PNG-1.2, and allow variance of 500 before complaining.
|
||||
Added assembler code contributed by Intel in file pngvcrd.c and modified
|
||||
makefile.w32 to use it (Nirav Chhatrapati, INTEL Corporation, Gilles Vollant)
|
||||
Changed "ln -s -f" to "ln -f -s" in the makefiles to make Solaris happy.
|
||||
Added some aliases for png_set_expand() in pngrtran.c, namely
|
||||
png_set_expand_PLTE(), png_set_expand_depth(), and png_set_expand_tRNS()
|
||||
(Greg Roelofs, in "PNG: The Definitive Guide").
|
||||
Added makefile.beo for BEOS on X86, contributed by Sander Stok.
|
||||
version 1.0.3b [August 26, 1999]
|
||||
Replaced 2147483647L several places with PNG_MAX_UINT macro, defined in png.h
|
||||
Changed leading blanks to tabs in all makefiles.
|
||||
Define PNG_USE_PNGVCRD in makefile.w32, to get MMX assembler code.
|
||||
Made alternate versions of png_set_expand() in pngrtran.c, namely
|
||||
png_set_gray_1_2_4_to_8, png_set_palette_to_rgb, and png_set_tRNS_to_alpha
|
||||
(Greg Roelofs, in "PNG: The Definitive Guide"). Deleted the 1.0.3a aliases.
|
||||
Relocated start of 'extern "C"' block in png.h so it doesn't include pngconf.h
|
||||
Revised calculation of num_blocks in pngmem.c to avoid a potentially
|
||||
negative shift distance, whose results are undefined in the C language.
|
||||
Added a check in pngset.c to prevent writing multiple tIME chunks.
|
||||
Added a check in pngwrite.c to detect invalid small window_bits sizes.
|
||||
version 1.0.3d [September 4, 1999]
|
||||
Fixed type casting of igamma in pngrutil.c
|
||||
Added new png_expand functions to scripts/pngdef.pas and pngos2.def
|
||||
Added a demo read_user_transform_fn that examines the row filters in pngtest.c
|
||||
version 1.0.4 [September 17, 1999]
|
||||
Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined
|
||||
Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h
|
||||
Made several minor corrections to pngtest.c
|
||||
|
12
INSTALL
12
INSTALL
@ -1,5 +1,5 @@
|
||||
|
||||
Installing libpng version 1.0.3 - January 14, 1999
|
||||
Installing libpng version 1.0.4 - September 17, 1999
|
||||
|
||||
Before installing libpng, you must first install zlib. zlib
|
||||
can usually be found wherever you got libpng. zlib can be
|
||||
@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
|
||||
version of zlib that's installed.
|
||||
|
||||
You can rename the directories that you downloaded (they
|
||||
might be called "libpng-1.0.3" or "lpng103" and "zlib-1.1.3"
|
||||
might be called "libpng-1.0.4" or "lpng103" and "zlib-1.1.3"
|
||||
or "zlib113") so that you have directories called "zlib" and "libpng".
|
||||
|
||||
Your directory structure should look like this:
|
||||
@ -41,18 +41,21 @@ include
|
||||
descrip.mms => VMS makefile for MMS or MMK
|
||||
makefile.std => Generic UNIX makefile
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with ansi2knr
|
||||
(Requires ansi2knr.c from ftp://ftp.cs.wisc.edu/ghost)
|
||||
makefile.dec => DEC Alpha UNIX makefile
|
||||
makefile.hux => HPUX (10.20 and 11.00) makefile
|
||||
makefile.sgi => Silicon Graphics IRIX makefile
|
||||
makefile.sun => Sun makefile
|
||||
makefile.s2x => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0)
|
||||
makefile.lnx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0)
|
||||
makefile.s2x => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.4)
|
||||
makefile.lnx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.4)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.mip => MIPS makefile
|
||||
makefile.aco => Acorn makefile
|
||||
makefile.ama => Amiga makefile
|
||||
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
|
||||
(Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
|
||||
makefile.atr => Atari makefile
|
||||
makefile.beo => BEOS makefile for X86
|
||||
makefile.bor => Borland makefile
|
||||
build.bat => MS-DOS batch file for Borland compiler
|
||||
makefile.dj2 => DJGPP 2 makefile
|
||||
@ -65,6 +68,7 @@ include
|
||||
makevms.com => VMS build script
|
||||
pngdll.mak => To make a png32bd.dll with Borland C++ 4.5
|
||||
pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
|
||||
SCOPTIONS.ppc => Used with smakefile.ppc
|
||||
|
||||
Copy the file (or files) that you need from the
|
||||
scripts directory into this directory, for example
|
||||
|
14
KNOWNBUG
14
KNOWNBUG
@ -1,5 +1,5 @@
|
||||
|
||||
Known bugs and suggested enhancements in libpng-1.0.3
|
||||
Known bugs and suggested enhancements in libpng-1.0.4
|
||||
|
||||
|
||||
1. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
|
||||
@ -14,12 +14,12 @@ Known bugs and suggested enhancements in libpng-1.0.3
|
||||
Question whether i-- or --i is better.
|
||||
|
||||
STATUS: Under investigation, postponed until after
|
||||
libpng-1.0.3. About 160 loops will be turned around
|
||||
libpng-1.0.4. About 160 loops will be turned around
|
||||
in libpng-1.0.Nn, for testing.
|
||||
|
||||
2. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
|
||||
|
||||
libpng-1.0.2 and earlier transform colors to gamma=1.0 space for
|
||||
libpng-1.0.4 and earlier transform colors to gamma=1.0 space for
|
||||
merging with background, and then back to the image's gamma. The
|
||||
bit_depth of the intermediate (gamma=1.0) representation is probably
|
||||
not sufficient. In the typical gamma=1/2.2 situation, the linear
|
||||
@ -29,4 +29,12 @@ Known bugs and suggested enhancements in libpng-1.0.3
|
||||
|
||||
STATUS: under development.
|
||||
|
||||
3. September 1999 -- ENHANCEMENT --
|
||||
|
||||
It should be possible to use libpng without floating-point aritmetic.
|
||||
|
||||
STATUS: Under investigation, implementation postponed until after
|
||||
libpng-1.0.4. The application interface will change because replacements
|
||||
for the png_set_gAMA(), png_set_cHRM(), and corresponding png_get_()
|
||||
functions will be needed.
|
||||
|
||||
|
72
README
72
README
@ -1,4 +1,4 @@
|
||||
README for libpng 1.0.3 - January 14, 1999 (shared library 2.1)
|
||||
README for libpng 1.0.4 - September 17, 1999 (shared library 2.1)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
@ -49,7 +49,7 @@ to set different actions based on whether the CRC error occurred in a
|
||||
critical or an ancillary chunk.
|
||||
|
||||
The changes made to the library, and bugs fixed are based on discussions
|
||||
on the PNG implementation mailing list <png-implement@dworking.wustl.edu>
|
||||
on the PNG implementation mailing list <png-implement@ccrc.wustl.edu>
|
||||
and not on material submitted to Guy.
|
||||
|
||||
For a detailed description on using libpng, read libpng.txt. For
|
||||
@ -98,8 +98,8 @@ fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
||||
This release was created and will be supported by myself (of course
|
||||
based in a large way on Guy's and Andreas' earlier work), and the PNG group.
|
||||
|
||||
randeg@alumni.rpi.edu
|
||||
png-implement@dworkin.wustl.edu
|
||||
randeg@alum.rpi.edu
|
||||
png-implement@ccrc.wustl.edu
|
||||
|
||||
You can't reach Guy, the original libpng author, at the addresses
|
||||
given in previous versions of this document. He and Andreas will read mail
|
||||
@ -108,7 +108,7 @@ addressed to the png-implement list, however.
|
||||
Please do not send general questions about PNG. Send them to
|
||||
the address in the specification (png-group@w3.org). At the same
|
||||
time, please do not send libpng questions to that address, send them to me
|
||||
or to png-implement@dworkin.wustl.edu. I'll
|
||||
or to png-implement@ccrc.wustl.edu. I'll
|
||||
get them in the end anyway. If you have a question about something
|
||||
in the PNG specification that is related to using libpng, send it
|
||||
to me. Send me any questions that start with "I was using libpng,
|
||||
@ -126,8 +126,6 @@ Files in this distribution:
|
||||
CHANGES => Description of changes between libpng versions
|
||||
README => This file
|
||||
TODO => Things not implemented in the current library
|
||||
ansi2knr.1 => Manual page for ansi2knr
|
||||
ansi2knr.c => Converts files to K&R style function declarations
|
||||
build.bat => MS-DOS batch file for Borland compiler
|
||||
descrip.mms => VMS project file
|
||||
example.c => Example code for using libpng functions
|
||||
@ -155,38 +153,42 @@ Files in this distribution:
|
||||
pngwtran.c => Write data transformations
|
||||
pngwutil.c => Write utility functions
|
||||
scripts => Directory containing scripts for building libpng:
|
||||
descrip.mms => VMS makefile for MMS or MMK
|
||||
makefile.std => Generic UNIX makefile
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with ansi2knr
|
||||
makefile.dec => DEC Alpha UNIX makefile
|
||||
makefile.hux => HPUX (10.20 and 11.00) makefile
|
||||
makefile.sgi => Silicon Graphics IRIX makefile
|
||||
makefile.sun => Sun makefile
|
||||
makefile.s2x => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0)
|
||||
makefile.lnx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0)
|
||||
makefile.mip => MIPS makefile
|
||||
makefile.aco => Acorn makefile
|
||||
makefile.ama => Amiga makefile
|
||||
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
|
||||
(Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
|
||||
makefile.atr => Atari makefile
|
||||
makefile.bor => Borland makefile
|
||||
build.bat => MS-DOS batch file for Borland compiler
|
||||
makefile.dj2 => DJGPP 2 makefile
|
||||
makefile.msc => Microsoft C makefile
|
||||
makefile.w32 => makefile for Microsoft Visual C++ 4.0 and later
|
||||
makefile.tc3 => Turbo C 3.0 makefile
|
||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
||||
makefile.wat => Watcom 10a+ Makefile, 32-bit flat memory model
|
||||
pngos2.def => OS/2 module definition file used by makefile.os2
|
||||
makevms.com => VMS build script
|
||||
pngdll.mak => To make a png32bd.dll with Borland C++ 4.5
|
||||
pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
|
||||
descrip.mms => VMS makefile for MMS or MMK
|
||||
makefile.std => Generic UNIX makefile
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with ansi2knr
|
||||
(Requires ansi2knr.c from ftp://ftp.cs.wisc.edu/ghost)
|
||||
makefile.dec => DEC Alpha UNIX makefile
|
||||
makefile.hux => HPUX (10.20 and 11.00) makefile
|
||||
makefile.sgi => Silicon Graphics IRIX makefile
|
||||
makefile.sun => Sun makefile
|
||||
makefile.s2x => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0)
|
||||
makefile.lnx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.mip => MIPS makefile
|
||||
makefile.aco => Acorn makefile
|
||||
makefile.ama => Amiga makefile
|
||||
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
|
||||
(Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
|
||||
makefile.atr => Atari makefile
|
||||
makefile.beo => BEOS makefile for X86
|
||||
makefile.bor => Borland makefile
|
||||
build.bat => MS-DOS batch file for Borland compiler
|
||||
makefile.dj2 => DJGPP 2 makefile
|
||||
makefile.msc => Microsoft C makefile
|
||||
makefile.w32 => makefile for Microsoft Visual C++ 4.0 and later
|
||||
makefile.tc3 => Turbo C 3.0 makefile
|
||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
||||
pngos2.def => OS/2 module definition file used by makefile.os2
|
||||
makefile.wat => Watcom 10a+ Makefile, 32-bit flat memory model
|
||||
makevms.com => VMS build script
|
||||
pngdll.mak => To make a png32bd.dll with Borland C++ 4.5
|
||||
pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
|
||||
SCOPTIONS.ppc => Used with smakefile.ppc
|
||||
|
||||
Good luck, and happy coding.
|
||||
|
||||
-Glenn Randers-Pehrson
|
||||
Internet: randeg@alumni.rpi.edu
|
||||
Internet: randeg@alum.rpi.edu
|
||||
Web: http://www.rpi.edu/~randeg/index.html
|
||||
|
||||
-Andreas Eric Dilger
|
||||
|
2
TODO
2
TODO
@ -10,7 +10,6 @@ Support for application-defined chunk handlers.
|
||||
Improve setjmp/longjmp usage or remove it in favor of returning error codes.
|
||||
High-level API for reading images.
|
||||
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||
Color to gray transformation.
|
||||
Improved dithering.
|
||||
Multi-lingual error and warning message support.
|
||||
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
||||
@ -22,3 +21,4 @@ Optional palette (sPLT) creation.
|
||||
Histogram creation.
|
||||
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||
Improve API by hiding the info_ptr.
|
||||
Make a no-floating-point version.
|
||||
|
19
Y2KINFO
19
Y2KINFO
@ -6,9 +6,9 @@
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.81 and
|
||||
upward are Y2K compliant. It is my belief that earlier versions were
|
||||
also Y2K compliant.
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.0.4 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||
that will hold years up to 65535. The other two hold the date in text
|
||||
@ -37,14 +37,17 @@
|
||||
clock time, which returns (year - 1900), which we properly convert to
|
||||
the full 4-digit year. There is a possibility that applications using
|
||||
libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
|
||||
function, or incorrectly passing only a 2-digit year instead of
|
||||
"year - 1900" into the png_convert_from_struct_tm() function, but this
|
||||
is not under our control. The libpng documentation has always stated
|
||||
that it works with 4-digit years, and the APIs have been documented as
|
||||
such.
|
||||
function, or that they are incorrectly passing only a 2-digit year
|
||||
instead of "year - 1900" into the png_convert_from_struct_tm() function,
|
||||
but this is not under our control. The libpng documentation has always
|
||||
stated that it works with 4-digit years, and the APIs have been
|
||||
documented as such.
|
||||
|
||||
The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
|
||||
integer to hold the year, and can hold years as large as 65535.
|
||||
|
||||
zlib, upon which libpng depends, is also Y2K compliant. It contains
|
||||
no date-related code.
|
||||
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
|
36
ansi2knr.1
36
ansi2knr.1
@ -1,36 +0,0 @@
|
||||
.TH ANSI2KNR 1 "19 Jan 1996"
|
||||
.SH NAME
|
||||
ansi2knr \- convert ANSI C to Kernighan & Ritchie C
|
||||
.SH SYNOPSIS
|
||||
.I ansi2knr
|
||||
[--varargs] input_file [output_file]
|
||||
.SH DESCRIPTION
|
||||
If no output_file is supplied, output goes to stdout.
|
||||
.br
|
||||
There are no error messages.
|
||||
.sp
|
||||
.I ansi2knr
|
||||
recognizes function definitions by seeing a non-keyword identifier at the left
|
||||
margin, followed by a left parenthesis, with a right parenthesis as the last
|
||||
character on the line, and with a left brace as the first token on the
|
||||
following line (ignoring possible intervening comments). It will recognize a
|
||||
multi-line header provided that no intervening line ends with a left or right
|
||||
brace or a semicolon. These algorithms ignore whitespace and comments, except
|
||||
that the function name must be the first thing on the line.
|
||||
.sp
|
||||
The following constructs will confuse it:
|
||||
.br
|
||||
- Any other construct that starts at the left margin and follows the
|
||||
above syntax (such as a macro or function call).
|
||||
.br
|
||||
- Some macros that tinker with the syntax of the function header.
|
||||
.sp
|
||||
The --varargs switch is obsolete, and is recognized only for
|
||||
backwards compatibility. The present version of
|
||||
.I ansi2knr
|
||||
will always attempt to convert a ... argument to va_alist and va_dcl.
|
||||
.SH AUTHOR
|
||||
L. Peter Deutsch <ghost@aladdin.com> wrote the original ansi2knr and
|
||||
continues to maintain the current version; most of the code in the current
|
||||
version is his work. ansi2knr also includes contributions by Francois
|
||||
Pinard <pinard@iro.umontreal.ca> and Jim Avera <jima@netcom.com>.
|
695
ansi2knr.c
695
ansi2knr.c
@ -1,695 +0,0 @@
|
||||
/* ansi2knr.c */
|
||||
|
||||
/* Convert ANSI C function definitions to K&R ("traditional C") syntax
|
||||
Copyright (C) 1989 Aladdin Enterprises. All rights reserved.
|
||||
Copyright (C) 1988 Richard M. Stallman
|
||||
|
||||
ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY. No author or distributor accepts responsibility to anyone for the
|
||||
consequences of using it or for whether it serves any particular purpose or
|
||||
works at all, unless he says so in writing. Refer to the GNU General Public
|
||||
License (the "GPL") for full details.
|
||||
|
||||
Everyone is granted permission to copy, modify and redistribute ansi2knr,
|
||||
but only under the conditions described in the GPL. A copy of this license
|
||||
is supposed to have been given to you along with ansi2knr so you can know
|
||||
your rights and responsibilities. It should be in a file named COPYLEFT.
|
||||
[In the LIBPNG distribution, the GPL appears below, not in a separate file.]
|
||||
Among other things, the copyright notice and this notice must be preserved
|
||||
on all copies.
|
||||
|
||||
We explicitly state here what we believe is already implied by the GPL: if
|
||||
the ansi2knr program is distributed as a separate source file and a
|
||||
separate executable file which are aggregated on a storage medium together
|
||||
with another program, this in itself does not bring the other program under
|
||||
the GPL, nor does the mere fact that such a program or the procedures for
|
||||
constructing it invoke the ansi2knr executable bring any other part of the
|
||||
program under the GPL.
|
||||
*/
|
||||
|
||||
/*
|
||||
---------- Here is the GNU GPL file COPYLEFT, referred to above ----------
|
||||
----- These terms do NOT apply to the LIBPNG software itself; see README ------
|
||||
|
||||
GHOSTSCRIPT GENERAL PUBLIC LICENSE
|
||||
(Clarified 11 Feb 1988)
|
||||
|
||||
Copyright (C) 1988 Richard M. Stallman
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license, but changing it is not allowed. You can also use this wording
|
||||
to make the terms for other programs.
|
||||
|
||||
The license agreements of most software companies keep you at the
|
||||
mercy of those companies. By contrast, our general public license is
|
||||
intended to give everyone the right to share Ghostscript. To make sure
|
||||
that you get the rights we want you to have, we need to make
|
||||
restrictions that forbid anyone to deny you these rights or to ask you
|
||||
to surrender the rights. Hence this license agreement.
|
||||
|
||||
Specifically, we want to make sure that you have the right to give
|
||||
away copies of Ghostscript, that you receive source code or else can get
|
||||
it if you want it, that you can change Ghostscript or use pieces of it
|
||||
in new free programs, and that you know you can do these things.
|
||||
|
||||
To make sure that everyone has such rights, we have to forbid you to
|
||||
deprive anyone else of these rights. For example, if you distribute
|
||||
copies of Ghostscript, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must tell them their rights.
|
||||
|
||||
Also, for our own protection, we must make certain that everyone finds
|
||||
out that there is no warranty for Ghostscript. If Ghostscript is
|
||||
modified by someone else and passed on, we want its recipients to know
|
||||
that what they have is not what we distributed, so that any problems
|
||||
introduced by others will not reflect on our reputation.
|
||||
|
||||
Therefore we (Richard M. Stallman and the Free Software Foundation,
|
||||
Inc.) make the following terms which say what you must do to be allowed
|
||||
to distribute or change Ghostscript.
|
||||
|
||||
|
||||
COPYING POLICIES
|
||||
|
||||
1. You may copy and distribute verbatim copies of Ghostscript source
|
||||
code as you receive it, in any medium, provided that you conspicuously
|
||||
and appropriately publish on each copy a valid copyright and license
|
||||
notice "Copyright (C) 1989 Aladdin Enterprises. All rights reserved.
|
||||
Distributed by Free Software Foundation, Inc." (or with whatever year is
|
||||
appropriate); keep intact the notices on all files that refer to this
|
||||
License Agreement and to the absence of any warranty; and give any other
|
||||
recipients of the Ghostscript program a copy of this License Agreement
|
||||
along with the program. You may charge a distribution fee for the
|
||||
physical act of transferring a copy.
|
||||
|
||||
2. You may modify your copy or copies of Ghostscript or any portion of
|
||||
it, and copy and distribute such modifications under the terms of
|
||||
Paragraph 1 above, provided that you also do the following:
|
||||
|
||||
a) cause the modified files to carry prominent notices stating
|
||||
that you changed the files and the date of any change; and
|
||||
|
||||
b) cause the whole of any work that you distribute or publish,
|
||||
that in whole or in part contains or is a derivative of Ghostscript
|
||||
or any part thereof, to be licensed at no charge to all third
|
||||
parties on terms identical to those contained in this License
|
||||
Agreement (except that you may choose to grant more extensive
|
||||
warranty protection to some or all third parties, at your option).
|
||||
|
||||
c) You may charge a distribution fee for the physical act of
|
||||
transferring a copy, and you may at your option offer warranty
|
||||
protection in exchange for a fee.
|
||||
|
||||
Mere aggregation of another unrelated program with this program (or its
|
||||
derivative) on a volume of a storage or distribution medium does not bring
|
||||
the other program under the scope of these terms.
|
||||
|
||||
3. You may copy and distribute Ghostscript (or a portion or derivative
|
||||
of it, under Paragraph 2) in object code or executable form under the
|
||||
terms of Paragraphs 1 and 2 above provided that you also do one of the
|
||||
following:
|
||||
|
||||
a) accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of
|
||||
Paragraphs 1 and 2 above; or,
|
||||
|
||||
b) accompany it with a written offer, valid for at least three
|
||||
years, to give any third party free (except for a nominal
|
||||
shipping charge) a complete machine-readable copy of the
|
||||
corresponding source code, to be distributed under the terms of
|
||||
Paragraphs 1 and 2 above; or,
|
||||
|
||||
c) accompany it with the information you received as to where the
|
||||
corresponding source code may be obtained. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form alone.)
|
||||
|
||||
For an executable file, complete source code means all the source code for
|
||||
all modules it contains; but, as a special exception, it need not include
|
||||
source code for modules which are standard libraries that accompany the
|
||||
operating system on which the executable file runs.
|
||||
|
||||
4. You may not copy, sublicense, distribute or transfer Ghostscript
|
||||
except as expressly provided under this License Agreement. Any attempt
|
||||
otherwise to copy, sublicense, distribute or transfer Ghostscript is
|
||||
void and your rights to use the program under this License agreement
|
||||
shall be automatically terminated. However, parties who have received
|
||||
computer software programs from you with this License Agreement will not
|
||||
have their licenses terminated so long as such parties remain in full
|
||||
compliance.
|
||||
|
||||
5. If you wish to incorporate parts of Ghostscript into other free
|
||||
programs whose distribution conditions are different, write to the Free
|
||||
Software Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not
|
||||
yet worked out a simple rule that can be stated here, but we will often
|
||||
permit this. We will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the
|
||||
sharing and reuse of software.
|
||||
|
||||
Your comments and suggestions about our licensing policies and our
|
||||
software are welcome! Please contact the Free Software Foundation,
|
||||
Inc., 675 Mass Ave, Cambridge, MA 02139, or call (617) 876-3296.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
BECAUSE GHOSTSCRIPT IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
|
||||
NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT
|
||||
WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, RICHARD
|
||||
M. STALLMAN, ALADDIN ENTERPRISES, L. PETER DEUTSCH, AND/OR OTHER PARTIES
|
||||
PROVIDE GHOSTSCRIPT "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
|
||||
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF GHOSTSCRIPT IS WITH
|
||||
YOU. SHOULD GHOSTSCRIPT PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
|
||||
NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
|
||||
STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., L. PETER DEUTSCH, ALADDIN
|
||||
ENTERPRISES, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE
|
||||
GHOSTSCRIPT AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING
|
||||
ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
|
||||
(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
|
||||
INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE
|
||||
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) GHOSTSCRIPT, EVEN IF YOU
|
||||
HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM
|
||||
BY ANY OTHER PARTY.
|
||||
|
||||
-------------------- End of file COPYLEFT ------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Usage:
|
||||
ansi2knr input_file [output_file]
|
||||
* If no output_file is supplied, output goes to stdout.
|
||||
* There are no error messages.
|
||||
*
|
||||
* ansi2knr recognizes function definitions by seeing a non-keyword
|
||||
* identifier at the left margin, followed by a left parenthesis,
|
||||
* with a right parenthesis as the last character on the line,
|
||||
* and with a left brace as the first token on the following line
|
||||
* (ignoring possible intervening comments).
|
||||
* It will recognize a multi-line header provided that no intervening
|
||||
* line ends with a left or right brace or a semicolon.
|
||||
* These algorithms ignore whitespace and comments, except that
|
||||
* the function name must be the first thing on the line.
|
||||
* The following constructs will confuse it:
|
||||
* - Any other construct that starts at the left margin and
|
||||
* follows the above syntax (such as a macro or function call).
|
||||
* - Some macros that tinker with the syntax of the function header.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The original and principal author of ansi2knr is L. Peter Deutsch
|
||||
* <ghost@aladdin.com>. Other authors are noted in the change history
|
||||
* that follows (in reverse chronological order):
|
||||
lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with
|
||||
compilers that don't understand void, as suggested by
|
||||
Tom Lane
|
||||
lpd 96-01-15 changed to require that the first non-comment token
|
||||
on the line following a function header be a left brace,
|
||||
to reduce sensitivity to macros, as suggested by Tom Lane
|
||||
<tgl@sss.pgh.pa.us>
|
||||
lpd 95-06-22 removed #ifndefs whose sole purpose was to define
|
||||
undefined preprocessor symbols as 0; changed all #ifdefs
|
||||
for configuration symbols to #ifs
|
||||
lpd 95-04-05 changed copyright notice to make it clear that
|
||||
including ansi2knr in a program does not bring the entire
|
||||
program under the GPL
|
||||
lpd 94-12-18 added conditionals for systems where ctype macros
|
||||
don't handle 8-bit characters properly, suggested by
|
||||
Francois Pinard <pinard@iro.umontreal.ca>;
|
||||
removed --varargs switch (this is now the default)
|
||||
lpd 94-10-10 removed CONFIG_BROKETS conditional
|
||||
lpd 94-07-16 added some conditionals to help GNU `configure',
|
||||
suggested by Francois Pinard <pinard@iro.umontreal.ca>;
|
||||
properly erase prototype args in function parameters,
|
||||
contributed by Jim Avera <jima@netcom.com>;
|
||||
correct error in writeblanks (it shouldn't erase EOLs)
|
||||
lpd 89-xx-xx original version
|
||||
*/
|
||||
|
||||
/* Most of the conditionals here are to make ansi2knr work with */
|
||||
/* or without the GNU configure machinery. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
|
||||
/*
|
||||
For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
|
||||
This will define HAVE_CONFIG_H and so, activate the following lines.
|
||||
*/
|
||||
|
||||
# if STDC_HEADERS || HAVE_STRING_H
|
||||
# include <string.h>
|
||||
# else
|
||||
# include <strings.h>
|
||||
# endif
|
||||
|
||||
#else /* not HAVE_CONFIG_H */
|
||||
|
||||
/* Otherwise do it the hard way */
|
||||
|
||||
# ifdef BSD
|
||||
# include <strings.h>
|
||||
# else
|
||||
# ifdef VMS
|
||||
extern int strlen(), strncmp();
|
||||
# else
|
||||
# include <string.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif /* not HAVE_CONFIG_H */
|
||||
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
/*
|
||||
malloc and free should be declared in stdlib.h,
|
||||
but if you've got a K&R compiler, they probably aren't.
|
||||
*/
|
||||
# ifdef MSDOS
|
||||
# include <malloc.h>
|
||||
# else
|
||||
# ifdef VMS
|
||||
extern char *malloc();
|
||||
extern void free();
|
||||
# else
|
||||
extern char *malloc();
|
||||
extern int free();
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The ctype macros don't always handle 8-bit characters correctly.
|
||||
* Compensate for this here.
|
||||
*/
|
||||
#ifdef isascii
|
||||
# undef HAVE_ISASCII /* just in case */
|
||||
# define HAVE_ISASCII 1
|
||||
#else
|
||||
#endif
|
||||
#if STDC_HEADERS || !HAVE_ISASCII
|
||||
# define is_ascii(c) 1
|
||||
#else
|
||||
# define is_ascii(c) isascii(c)
|
||||
#endif
|
||||
|
||||
#define is_space(c) (is_ascii(c) && isspace(c))
|
||||
#define is_alpha(c) (is_ascii(c) && isalpha(c))
|
||||
#define is_alnum(c) (is_ascii(c) && isalnum(c))
|
||||
|
||||
/* Scanning macros */
|
||||
#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
|
||||
#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
|
||||
|
||||
/* Forward references */
|
||||
char *skipspace();
|
||||
int writeblanks();
|
||||
int test1();
|
||||
int convert1();
|
||||
|
||||
/* The main program */
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{ FILE *in, *out;
|
||||
#define bufsize 5000 /* arbitrary size */
|
||||
char *buf;
|
||||
char *line;
|
||||
char *more;
|
||||
/*
|
||||
* In previous versions, ansi2knr recognized a --varargs switch.
|
||||
* If this switch was supplied, ansi2knr would attempt to convert
|
||||
* a ... argument to va_alist and va_dcl; if this switch was not
|
||||
* supplied, ansi2knr would simply drop any such arguments.
|
||||
* Now, ansi2knr always does this conversion, and we only
|
||||
* check for this switch for backward compatibility.
|
||||
*/
|
||||
int convert_varargs = 1;
|
||||
|
||||
if ( argc > 1 && argv[1][0] == '-' )
|
||||
{ if ( !strcmp(argv[1], "--varargs") )
|
||||
{ convert_varargs = 1;
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
else
|
||||
{ fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
switch ( argc )
|
||||
{
|
||||
default:
|
||||
printf("Usage: ansi2knr input_file [output_file]\n");
|
||||
exit(0);
|
||||
case 2:
|
||||
out = stdout;
|
||||
break;
|
||||
case 3:
|
||||
out = fopen(argv[2], "w");
|
||||
if ( out == NULL )
|
||||
{ fprintf(stderr, "Cannot open output file %s\n", argv[2]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
in = fopen(argv[1], "r");
|
||||
if ( in == NULL )
|
||||
{ fprintf(stderr, "Cannot open input file %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
fprintf(out, "#line 1 \"%s\"\n", argv[1]);
|
||||
buf = malloc(bufsize);
|
||||
line = buf;
|
||||
while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
|
||||
{
|
||||
test: line += strlen(line);
|
||||
switch ( test1(buf) )
|
||||
{
|
||||
case 2: /* a function header */
|
||||
convert1(buf, out, 1, convert_varargs);
|
||||
break;
|
||||
case 1: /* a function */
|
||||
/* Check for a { at the start of the next line. */
|
||||
more = ++line;
|
||||
f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
|
||||
goto wl;
|
||||
if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
|
||||
goto wl;
|
||||
switch ( *skipspace(more, 1) )
|
||||
{
|
||||
case '{':
|
||||
/* Definitely a function header. */
|
||||
convert1(buf, out, 0, convert_varargs);
|
||||
fputs(more, out);
|
||||
break;
|
||||
case 0:
|
||||
/* The next line was blank or a comment: */
|
||||
/* keep scanning for a non-comment. */
|
||||
line += strlen(line);
|
||||
goto f;
|
||||
default:
|
||||
/* buf isn't a function header, but */
|
||||
/* more might be. */
|
||||
fputs(buf, out);
|
||||
strcpy(buf, more);
|
||||
line = buf;
|
||||
goto test;
|
||||
}
|
||||
break;
|
||||
case -1: /* maybe the start of a function */
|
||||
if ( line != buf + (bufsize - 1) ) /* overflow check */
|
||||
continue;
|
||||
/* falls through */
|
||||
default: /* not a function */
|
||||
wl: fputs(buf, out);
|
||||
break;
|
||||
}
|
||||
line = buf;
|
||||
}
|
||||
if ( line != buf )
|
||||
fputs(buf, out);
|
||||
free(buf);
|
||||
fclose(out);
|
||||
fclose(in);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Skip over space and comments, in either direction. */
|
||||
char *
|
||||
skipspace(p, dir)
|
||||
register char *p;
|
||||
register int dir; /* 1 for forward, -1 for backward */
|
||||
{ for ( ; ; )
|
||||
{ while ( is_space(*p) )
|
||||
p += dir;
|
||||
if ( !(*p == '/' && p[dir] == '*') )
|
||||
break;
|
||||
p += dir; p += dir;
|
||||
while ( !(*p == '*' && p[dir] == '/') )
|
||||
{ if ( *p == 0 )
|
||||
return p; /* multi-line comment?? */
|
||||
p += dir;
|
||||
}
|
||||
p += dir; p += dir;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write blanks over part of a string.
|
||||
* Don't overwrite end-of-line characters.
|
||||
*/
|
||||
int
|
||||
writeblanks(start, end)
|
||||
char *start;
|
||||
char *end;
|
||||
{ char *p;
|
||||
for ( p = start; p < end; p++ )
|
||||
if ( *p != '\r' && *p != '\n' )
|
||||
*p = ' ';
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test whether the string in buf is a function definition.
|
||||
* The string may contain and/or end with a newline.
|
||||
* Return as follows:
|
||||
* 0 - definitely not a function definition;
|
||||
* 1 - definitely a function definition;
|
||||
* 2 - definitely a function prototype (NOT USED);
|
||||
* -1 - may be the beginning of a function definition,
|
||||
* append another line and look again.
|
||||
* The reason we don't attempt to convert function prototypes is that
|
||||
* Ghostscript's declaration-generating macros look too much like
|
||||
* prototypes, and confuse the algorithms.
|
||||
*/
|
||||
int
|
||||
test1(buf)
|
||||
char *buf;
|
||||
{ register char *p = buf;
|
||||
char *bend;
|
||||
char *endfn;
|
||||
int contin;
|
||||
|
||||
if ( !isidfirstchar(*p) )
|
||||
return 0; /* no name at left margin */
|
||||
bend = skipspace(buf + strlen(buf) - 1, -1);
|
||||
switch ( *bend )
|
||||
{
|
||||
case ';': contin = 0 /*2*/; break;
|
||||
case ')': contin = 1; break;
|
||||
case '{': return 0; /* not a function */
|
||||
case '}': return 0; /* not a function */
|
||||
default: contin = -1;
|
||||
}
|
||||
while ( isidchar(*p) )
|
||||
p++;
|
||||
endfn = p;
|
||||
p = skipspace(p, 1);
|
||||
if ( *p++ != '(' )
|
||||
return 0; /* not a function */
|
||||
p = skipspace(p, 1);
|
||||
if ( *p == ')' )
|
||||
return 0; /* no parameters */
|
||||
/* Check that the apparent function name isn't a keyword. */
|
||||
/* We only need to check for keywords that could be followed */
|
||||
/* by a left parenthesis (which, unfortunately, is most of them). */
|
||||
{ static char *words[] =
|
||||
{ "asm", "auto", "case", "char", "const", "double",
|
||||
"extern", "float", "for", "if", "int", "long",
|
||||
"register", "return", "short", "signed", "sizeof",
|
||||
"static", "switch", "typedef", "unsigned",
|
||||
"void", "volatile", "while", 0
|
||||
};
|
||||
char **key = words;
|
||||
char *kp;
|
||||
int len = endfn - buf;
|
||||
|
||||
while ( (kp = *key) != 0 )
|
||||
{ if ( strlen(kp) == len && !strncmp(kp, buf, len) )
|
||||
return 0; /* name is a keyword */
|
||||
key++;
|
||||
}
|
||||
}
|
||||
return contin;
|
||||
}
|
||||
|
||||
/* Convert a recognized function definition or header to K&R syntax. */
|
||||
int
|
||||
convert1(buf, out, header, convert_varargs)
|
||||
char *buf;
|
||||
FILE *out;
|
||||
int header; /* Boolean */
|
||||
int convert_varargs; /* Boolean */
|
||||
{ char *endfn;
|
||||
register char *p;
|
||||
char **breaks;
|
||||
unsigned num_breaks = 2; /* for testing */
|
||||
char **btop;
|
||||
char **bp;
|
||||
char **ap;
|
||||
char *vararg = 0;
|
||||
|
||||
/* Pre-ANSI implementations don't agree on whether strchr */
|
||||
/* is called strchr or index, so we open-code it here. */
|
||||
for ( endfn = buf; *(endfn++) != '('; )
|
||||
;
|
||||
top: p = endfn;
|
||||
breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
|
||||
if ( breaks == 0 )
|
||||
{ /* Couldn't allocate break table, give up */
|
||||
fprintf(stderr, "Unable to allocate break table!\n");
|
||||
fputs(buf, out);
|
||||
return -1;
|
||||
}
|
||||
btop = breaks + num_breaks * 2 - 2;
|
||||
bp = breaks;
|
||||
/* Parse the argument list */
|
||||
do
|
||||
{ int level = 0;
|
||||
char *lp = NULL;
|
||||
char *rp;
|
||||
char *end = NULL;
|
||||
|
||||
if ( bp >= btop )
|
||||
{ /* Filled up break table. */
|
||||
/* Allocate a bigger one and start over. */
|
||||
free((char *)breaks);
|
||||
num_breaks <<= 1;
|
||||
goto top;
|
||||
}
|
||||
*bp++ = p;
|
||||
/* Find the end of the argument */
|
||||
for ( ; end == NULL; p++ )
|
||||
{ switch(*p)
|
||||
{
|
||||
case ',':
|
||||
if ( !level ) end = p;
|
||||
break;
|
||||
case '(':
|
||||
if ( !level ) lp = p;
|
||||
level++;
|
||||
break;
|
||||
case ')':
|
||||
if ( --level < 0 ) end = p;
|
||||
else rp = p;
|
||||
break;
|
||||
case '/':
|
||||
p = skipspace(p, 1) - 1;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
/* Erase any embedded prototype parameters. */
|
||||
if ( lp )
|
||||
writeblanks(lp + 1, rp);
|
||||
p--; /* back up over terminator */
|
||||
/* Find the name being declared. */
|
||||
/* This is complicated because of procedure and */
|
||||
/* array modifiers. */
|
||||
for ( ; ; )
|
||||
{ p = skipspace(p - 1, -1);
|
||||
switch ( *p )
|
||||
{
|
||||
case ']': /* skip array dimension(s) */
|
||||
case ')': /* skip procedure args OR name */
|
||||
{ int level = 1;
|
||||
while ( level )
|
||||
switch ( *--p )
|
||||
{
|
||||
case ']': case ')': level++; break;
|
||||
case '[': case '(': level--; break;
|
||||
case '/': p = skipspace(p, -1) + 1; break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
|
||||
{ /* We found the name being declared */
|
||||
while ( !isidfirstchar(*p) )
|
||||
p = skipspace(p, 1) + 1;
|
||||
goto found;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
|
||||
{ if ( convert_varargs )
|
||||
{ *bp++ = "va_alist";
|
||||
vararg = p-2;
|
||||
}
|
||||
else
|
||||
{ p++;
|
||||
if ( bp == breaks + 1 ) /* sole argument */
|
||||
writeblanks(breaks[0], p);
|
||||
else
|
||||
writeblanks(bp[-1] - 1, p);
|
||||
bp--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ while ( isidchar(*p) ) p--;
|
||||
*bp++ = p+1;
|
||||
}
|
||||
p = end;
|
||||
}
|
||||
while ( *p++ == ',' );
|
||||
*bp = p;
|
||||
/* Make a special check for 'void' arglist */
|
||||
if ( bp == breaks+2 )
|
||||
{ p = skipspace(breaks[0], 1);
|
||||
if ( !strncmp(p, "void", 4) )
|
||||
{ p = skipspace(p+4, 1);
|
||||
if ( p == breaks[2] - 1 )
|
||||
{ bp = breaks; /* yup, pretend arglist is empty */
|
||||
writeblanks(breaks[0], p + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Put out the function name and left parenthesis. */
|
||||
p = buf;
|
||||
while ( p != endfn ) putc(*p, out), p++;
|
||||
/* Put out the declaration. */
|
||||
if ( header )
|
||||
{ fputs(");", out);
|
||||
for ( p = breaks[0]; *p; p++ )
|
||||
if ( *p == '\r' || *p == '\n' )
|
||||
putc(*p, out);
|
||||
}
|
||||
else
|
||||
{ for ( ap = breaks+1; ap < bp; ap += 2 )
|
||||
{ p = *ap;
|
||||
while ( isidchar(*p) )
|
||||
putc(*p, out), p++;
|
||||
if ( ap < bp - 1 )
|
||||
fputs(", ", out);
|
||||
}
|
||||
fputs(") ", out);
|
||||
/* Put out the argument declarations */
|
||||
for ( ap = breaks+2; ap <= bp; ap += 2 )
|
||||
(*ap)[-1] = ';';
|
||||
if ( vararg != 0 )
|
||||
{ *vararg = 0;
|
||||
fputs(breaks[0], out); /* any prior args */
|
||||
fputs("va_dcl", out); /* the final arg */
|
||||
fputs(bp[0], out);
|
||||
}
|
||||
else
|
||||
fputs(breaks[0], out);
|
||||
}
|
||||
free((char *)breaks);
|
||||
return 0;
|
||||
}
|
@ -151,7 +151,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
||||
/* tell libpng to strip 16 bit/color files down to 8 bits/color */
|
||||
png_set_strip_16(png_ptr);
|
||||
|
||||
/* Strip alpha bytes from the input data without combining with th
|
||||
/* Strip alpha bytes from the input data without combining with the
|
||||
* background (not recommended).
|
||||
*/
|
||||
png_set_strip_alpha(png_ptr);
|
||||
|
101
libpng.txt
101
libpng.txt
@ -1,8 +1,8 @@
|
||||
libpng.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.0.3 - January 14, 1999
|
||||
libpng version 1.0.4 - September 17, 1999
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<randeg@alumni.rpi.edu>
|
||||
<randeg@alum.rpi.edu>
|
||||
Copyright (c) 1998, 1999 Glenn Randers-Pehrson
|
||||
For conditions of distribution and use, see copyright
|
||||
notice in png.h.
|
||||
@ -22,6 +22,7 @@ libpng.txt - A description on how to use and modify libpng
|
||||
Copyright (c) 1995 Frank J. T. Wojcik
|
||||
December 18, 1995 && January 20, 1996
|
||||
|
||||
*
|
||||
I. Introduction
|
||||
|
||||
This file describes how to use and modify the PNG reference library
|
||||
@ -35,11 +36,17 @@ INSTALL file for instructions on how to install libpng.
|
||||
|
||||
Libpng was written as a companion to the PNG specification, as a way
|
||||
of reducing the amount of time and effort it takes to support the PNG
|
||||
file format in application programs. The PNG specification is available
|
||||
file format in application programs.
|
||||
|
||||
The PNG-1.2 specification is available at <http://www.cdrom.com/png>.
|
||||
|
||||
The PNG-1.0 specification is available
|
||||
as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/> and as a
|
||||
W3C Recommendation <http://www.w3.org/TR/REC.png.html>. Some
|
||||
additional chunks are described in the special-purpose public chunks
|
||||
documents at <ftp://ftp.uu.net/graphics/png/documents/>. Other information
|
||||
documents at <ftp://ftp.uu.net/graphics/png/documents/>.
|
||||
|
||||
Other information
|
||||
about PNG, and the latest version of libpng, can be found at the PNG home
|
||||
page, <http://www.cdrom.com/pub/png/>.
|
||||
|
||||
@ -261,6 +268,21 @@ You must supply the function
|
||||
See pngtest.c for a working example. Your function will be called
|
||||
after all of the other transformations have been processed.
|
||||
|
||||
You can also set up a pointer to a user structure for use by your
|
||||
callback function, and you can inform libpng that your transform
|
||||
function will change the number of channels or bit depth with the
|
||||
function
|
||||
|
||||
png_set_user_transform_info(png_ptr, user_ptr,
|
||||
user_depth, user_channels);
|
||||
|
||||
|
||||
You can retrieve the pointer via the function
|
||||
png_get_user_transform_ptr(). For example:
|
||||
|
||||
voidp read_user_transform_ptr =
|
||||
png_get_user_transform_ptr(png_ptr);
|
||||
|
||||
You are now ready to read all the file information up to the actual
|
||||
image data. You do this with a call to png_read_info().
|
||||
|
||||
@ -506,13 +528,18 @@ grayscale images with bit depths of 2 or 4 or if there is a multiple-image
|
||||
viewing application that wishes to treat all images in the same way.
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||
bit_depth <= 8) png_set_expand(png_ptr);
|
||||
bit_depth <= 8) png_set_palette_to_rgb(png_ptr);
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY &&
|
||||
bit_depth < 8) png_set_expand(png_ptr);
|
||||
bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
|
||||
|
||||
if (png_get_valid(png_ptr, info_ptr,
|
||||
PNG_INFO_tRNS)) png_set_expand(png_ptr);
|
||||
PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
|
||||
|
||||
These three functions are actually aliases for png_set_expand(), added
|
||||
in libpng version 1.0.4, with the function names expanded to improve code
|
||||
readability. In some future version they may actually do different
|
||||
things.
|
||||
|
||||
PNG can have files with 16 bits per channel. If you only can handle
|
||||
8 bits per channel, this will strip the pixels down to 8 bit.
|
||||
@ -599,7 +626,7 @@ and blue channels, leaving the green channel in the gray position.
|
||||
if (color_type == PNG_COLOR_TYPE_RGB ||
|
||||
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
png_set_rgb_to_gray(png_ptr, error_action,
|
||||
float red_weight, float green_weight);
|
||||
double red_weight, double green_weight);
|
||||
|
||||
error_action = 1: silently do the conversion
|
||||
error_action = 2: issue a warning if the original
|
||||
@ -648,7 +675,8 @@ which can be expressed with integers as
|
||||
The calculation is done in a linear colorspace, if the image gamma
|
||||
is known.
|
||||
|
||||
If you have a grayscale and you are using png_set_expand() to change to
|
||||
If you have a grayscale and you are using png_set_expand_depth() or
|
||||
png_set_expand() to change to
|
||||
a higher bit-depth, you must either supply the background color as a gray
|
||||
value at the original file bit-depth (need_expand = 1) or else supply the
|
||||
background color as an RGB triplet at the final, expanded bit depth
|
||||
@ -681,6 +709,8 @@ the amount of additional gamma correction needed to compensate for
|
||||
a (viewing_gamma=1.25) environment. In a dim or brightly lit room, no
|
||||
compensation other than the display_gamma is needed (viewing_gamma=1.0).
|
||||
|
||||
double gamma, screen_gamma;
|
||||
|
||||
if (/* We have a user-defined screen
|
||||
gamma value */)
|
||||
{
|
||||
@ -691,7 +721,7 @@ compensation other than the display_gamma is needed (viewing_gamma=1.0).
|
||||
else if ((gamma_str = getenv("SCREEN_GAMMA"))
|
||||
!= NULL)
|
||||
{
|
||||
screen_gamma = atof(gamma_str);
|
||||
screen_gamma = (double)atof(gamma_str);
|
||||
}
|
||||
/* If we don't have another value */
|
||||
else
|
||||
@ -831,7 +861,7 @@ row_pointers:
|
||||
png_read_row(png_ptr, &row_pointers, NULL);
|
||||
|
||||
If the file is interlaced (info_ptr->interlace_type != 0), things get
|
||||
somewhat harder. The only current (PNG Specification version 1.0)
|
||||
somewhat harder. The only current (PNG Specification version 1.2)
|
||||
interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7)
|
||||
is a somewhat complicated 2D interlace scheme, known as Adam7, that
|
||||
breaks down an image into seven smaller images of varying size, based
|
||||
@ -1194,7 +1224,7 @@ have no special needs in this area, let the library do what it wants by
|
||||
not calling this function at all, as it has been tuned to deliver a good
|
||||
speed/compression ratio. The second parameter to png_set_filter() is
|
||||
the filter method, for which the only valid value is '0' (as of the
|
||||
October 1996 PNG specification, version 1.0). The third parameter is a
|
||||
July 1999 PNG specification, version 1.2). The third parameter is a
|
||||
flag that indicates which filter type(s) are to be tested for each
|
||||
scanline. See the Compression Library for details on the specific filter
|
||||
types.
|
||||
@ -1226,7 +1256,7 @@ data. See the Compression Library for details on the compression levels.
|
||||
You now need to fill in the png_info structure with all the data you
|
||||
wish to write before the actual image. Note that the only thing you
|
||||
are allowed to write after the image is the text chunks and the time
|
||||
chunk (as of PNG Specification 1.0, anyway). See png_write_end() and
|
||||
chunk (as of PNG Specification 1.2, anyway). See png_write_end() and
|
||||
the latest PNG specification for more information on that. If you
|
||||
wish to write them before the image, fill them in now, and flag that
|
||||
data as being valid. If you want to wait until after the data, don't
|
||||
@ -1555,7 +1585,21 @@ You must supply the function
|
||||
row_info, png_bytep data)
|
||||
|
||||
See pngtest.c for a working example. Your function will be called
|
||||
before any of the other transformations have been processed.
|
||||
before any of the other transformations are processed.
|
||||
|
||||
You can also set up a pointer to a user structure for use by your
|
||||
callback function.
|
||||
|
||||
png_set_user_transform_info(png_ptr, user_ptr, 0, 0);
|
||||
|
||||
The user_channels and user_depth parameters of this function are ignored
|
||||
when writing; you can set them to zero as shown.
|
||||
|
||||
You can retrieve the pointer via the function
|
||||
png_get_user_transform_ptr(). For example:
|
||||
|
||||
voidp write_user_transform_ptr =
|
||||
png_get_user_transform_ptr(png_ptr);
|
||||
|
||||
It is possible to have libpng flush any pending output, either manually,
|
||||
or automatically after a certain number of lines have been written. To
|
||||
@ -1612,8 +1656,8 @@ row_pointers:
|
||||
png_write_row(png_ptr, &row_pointer);
|
||||
|
||||
When the file is interlaced, things can get a good deal more
|
||||
complicated. The only currently (as of February 1998 -- PNG Specification
|
||||
version 1.0, dated October 1996) defined interlacing scheme for PNG files
|
||||
complicated. The only currently (as of August 1999 -- PNG Specification
|
||||
version 1.2, dated July 1999) defined interlacing scheme for PNG files
|
||||
is the "Adam7" interlace scheme, that breaks down an
|
||||
image into seven smaller images of varying size. libpng will build
|
||||
these images for you, or you can do them yourself. If you want to
|
||||
@ -1658,7 +1702,6 @@ palette, or histogram, before the call to png_destroy_write_struct();
|
||||
|
||||
For a more compact example of writing a PNG image, see the file example.c.
|
||||
|
||||
|
||||
V. Modifying/Customizing libpng:
|
||||
|
||||
There are two issues here. The first is changing how libpng does
|
||||
@ -1685,7 +1728,8 @@ which currently just call fread() and fwrite(). The FILE * is stored in
|
||||
png_struct and is initialized via png_init_io(). If you wish to change
|
||||
the method of I/O, the library supplies callbacks that you can set
|
||||
through the function png_set_read_fn() and png_set_write_fn() at run
|
||||
time, instead of calling the png_init_io() function. These functions
|
||||
time, instead of calling the png_init_io() function.
|
||||
These functions
|
||||
also provide a void pointer that can be retrieved via the function
|
||||
png_get_io_ptr(). For example:
|
||||
|
||||
@ -1852,7 +1896,7 @@ images (with and without alpha), but not for paletted images nor
|
||||
for any images with bit depths less than 8 bits/pixel.
|
||||
|
||||
The 'method' parameter sets the main filtering method, which is
|
||||
currently only '0' in the PNG 1.0 specification. The 'filters'
|
||||
currently only '0' in the PNG 1.2 specification. The 'filters'
|
||||
parameter sets which filter(s), if any, should be used for each
|
||||
scanline. Possible values are PNG_ALL_FILTERS and PNG_NO_FILTERS
|
||||
to turn filtering on and off, respectively.
|
||||
@ -2021,9 +2065,9 @@ January 13, 1999
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.81 and
|
||||
upward are Y2K compliant. It is my belief that earlier versions were
|
||||
also Y2K compliant.
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.0.4 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
||||
will hold years up to 65535. The other two hold the date in text
|
||||
@ -2052,15 +2096,18 @@ png_convert_from_time_t() function calls gmtime() to convert from system
|
||||
clock time, which returns (year - 1900), which we properly convert to
|
||||
the full 4-digit year. There is a possibility that applications using
|
||||
libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
|
||||
function, or incorrectly passing only a 2-digit year instead of
|
||||
"year - 1900" into the png_convert_from_struct_tm() function, but this
|
||||
is not under our control. The libpng documentation has always stated
|
||||
that it works with 4-digit years, and the APIs have been documented as
|
||||
such.
|
||||
function, or that they are incorrectly passing only a 2-digit year
|
||||
instead of "year - 1900" into the png_convert_from_struct_tm() function,
|
||||
but this is not under our control. The libpng documentation has always
|
||||
stated that it works with 4-digit years, and the APIs have been
|
||||
documented as such.
|
||||
|
||||
The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
|
||||
integer to hold the year, and can hold years as large as 65535.
|
||||
|
||||
zlib, upon which libpng depends, is also Y2K compliant. It contains
|
||||
no date-related code.
|
||||
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
libpng maintainer
|
||||
|
580
libpngpf.3
580
libpngpf.3
@ -3,337 +3,495 @@
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.3 - January 14, 1999
|
||||
(private functions)
|
||||