rarified
3 years ago
368 changed files with 0 additions and 163385 deletions
Binary file not shown.
@ -1,122 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="blowfish" - Package Owner=<4> |
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00 |
||||
# ** DO NOT EDIT ** |
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104 |
||||
|
||||
CFG=blowfish - Win32 Debug |
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE, |
||||
!MESSAGE use the Export Makefile command and run |
||||
!MESSAGE |
||||
!MESSAGE NMAKE /f "Blowfish.mak". |
||||
!MESSAGE |
||||
!MESSAGE You can specify a configuration when running NMAKE |
||||
!MESSAGE by defining the macro CFG on the command line. For example: |
||||
!MESSAGE |
||||
!MESSAGE NMAKE /f "Blowfish.mak" CFG="blowfish - Win32 Debug" |
||||
!MESSAGE |
||||
!MESSAGE Possible choices for configuration are: |
||||
!MESSAGE |
||||
!MESSAGE "blowfish - Win32 Release" (based on "Win32 (x86) Static Library") |
||||
!MESSAGE "blowfish - Win32 Debug" (based on "Win32 (x86) Static Library") |
||||
!MESSAGE |
||||
|
||||
# Begin Project |
||||
# PROP Scc_ProjName "" |
||||
# PROP Scc_LocalPath "" |
||||
CPP=cl.exe |
||||
|
||||
!IF "$(CFG)" == "blowfish - Win32 Release" |
||||
|
||||
# PROP BASE Use_MFC 0 |
||||
# PROP BASE Use_Debug_Libraries 0 |
||||
# PROP BASE Output_Dir "Release" |
||||
# PROP BASE Intermediate_Dir "Release" |
||||
# PROP BASE Target_Dir "" |
||||
# PROP Use_MFC 0 |
||||
# PROP Use_Debug_Libraries 0 |
||||
# PROP Output_Dir "Release" |
||||
# PROP Intermediate_Dir "Release" |
||||
# PROP Target_Dir "" |
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c |
||||
# ADD CPP /nologo /GB /Za /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c |
||||
BSC32=bscmake.exe |
||||
# ADD BASE BSC32 /nologo |
||||
# ADD BSC32 /nologo |
||||
LIB32=link.exe -lib |
||||
# ADD BASE LIB32 /nologo |
||||
# ADD LIB32 /nologo |
||||
|
||||
!ELSEIF "$(CFG)" == "blowfish - Win32 Debug" |
||||
|
||||
# PROP BASE Use_MFC 0 |
||||
# PROP BASE Use_Debug_Libraries 1 |
||||
# PROP BASE Output_Dir "Debug" |
||||
# PROP BASE Intermediate_Dir "Debug" |
||||
# PROP BASE Target_Dir "" |
||||
# PROP Use_MFC 0 |
||||
# PROP Use_Debug_Libraries 1 |
||||
# PROP Output_Dir "Debug" |
||||
# PROP Intermediate_Dir "Debug" |
||||
# PROP Target_Dir "" |
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c |
||||
# ADD CPP /nologo /GB /Za /W4 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c |
||||
BSC32=bscmake.exe |
||||
# ADD BASE BSC32 /nologo |
||||
# ADD BSC32 /nologo |
||||
LIB32=link.exe -lib |
||||
# ADD BASE LIB32 /nologo |
||||
# ADD LIB32 /nologo |
||||
|
||||
!ENDIF |
||||
|
||||
# Begin Target |
||||
|
||||
# Name "blowfish - Win32 Release" |
||||
# Name "blowfish - Win32 Debug" |
||||
# Begin Group "Source Files" |
||||
|
||||
# PROP Default_Filter ".c" |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_cbc.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_cfb64.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_ecb.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_enc.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_ofb64.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_skey.c |
||||
# End Source File |
||||
# End Group |
||||
# Begin Group "Include Files" |
||||
|
||||
# PROP Default_Filter ".h" |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_locl.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_pi.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\blowfish.h |
||||
# End Source File |
||||
# End Group |
||||
# End Target |
||||
# End Project |
@ -1,128 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="blowfish" - Package Owner=<4> |
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00 |
||||
# ** DO NOT EDIT ** |
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104 |
||||
|
||||
CFG=blowfish - Win32 Debug |
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE, |
||||
!MESSAGE use the Export Makefile command and run |
||||
!MESSAGE |
||||
!MESSAGE NMAKE /f "Blowfish.mak". |
||||
!MESSAGE |
||||
!MESSAGE You can specify a configuration when running NMAKE |
||||
!MESSAGE by defining the macro CFG on the command line. For example: |
||||
!MESSAGE |
||||
!MESSAGE NMAKE /f "Blowfish.mak" CFG="blowfish - Win32 Debug" |
||||
!MESSAGE |
||||
!MESSAGE Possible choices for configuration are: |
||||
!MESSAGE |
||||
!MESSAGE "blowfish - Win32 Release" (based on "Win32 (x86) Static Library") |
||||
!MESSAGE "blowfish - Win32 Debug" (based on "Win32 (x86) Static Library") |
||||
!MESSAGE |
||||
|
||||
# Begin Project |
||||
# PROP AllowPerConfigDependencies 0 |
||||
# PROP Scc_ProjName "" |
||||
# PROP Scc_LocalPath "" |
||||
CPP=cl.exe |
||||
RSC=rc.exe |
||||
|
||||
!IF "$(CFG)" == "blowfish - Win32 Release" |
||||
|
||||
# PROP BASE Use_MFC 0 |
||||
# PROP BASE Use_Debug_Libraries 0 |
||||
# PROP BASE Output_Dir "Release" |
||||
# PROP BASE Intermediate_Dir "Release" |
||||
# PROP BASE Target_Dir "" |
||||
# PROP Use_MFC 0 |
||||
# PROP Use_Debug_Libraries 0 |
||||
# PROP Output_Dir "Release" |
||||
# PROP Intermediate_Dir "Release" |
||||
# PROP Target_Dir "" |
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c |
||||
# ADD CPP /nologo /Za /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c |
||||
# ADD BASE RSC /l 0x409 |
||||
# ADD RSC /l 0x409 |
||||
BSC32=bscmake.exe |
||||
# ADD BASE BSC32 /nologo |
||||
# ADD BSC32 /nologo |
||||
LIB32=link.exe -lib |
||||
# ADD BASE LIB32 /nologo |
||||
# ADD LIB32 /nologo |
||||
|
||||
!ELSEIF "$(CFG)" == "blowfish - Win32 Debug" |
||||
|
||||
# PROP BASE Use_MFC 0 |
||||
# PROP BASE Use_Debug_Libraries 1 |
||||
# PROP BASE Output_Dir "Debug" |
||||
# PROP BASE Intermediate_Dir "Debug" |
||||
# PROP BASE Target_Dir "" |
||||
# PROP Use_MFC 0 |
||||
# PROP Use_Debug_Libraries 1 |
||||
# PROP Output_Dir "Debug" |
||||
# PROP Intermediate_Dir "Debug" |
||||
# PROP Target_Dir "" |
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c |
||||
# ADD CPP /nologo /Za /W4 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c |
||||
# ADD BASE RSC /l 0x409 |
||||
# ADD RSC /l 0x409 |
||||
BSC32=bscmake.exe |
||||
# ADD BASE BSC32 /nologo |
||||
# ADD BSC32 /nologo |
||||
LIB32=link.exe -lib |
||||
# ADD BASE LIB32 /nologo |
||||
# ADD LIB32 /nologo |
||||
|
||||
!ENDIF |
||||
|
||||
# Begin Target |
||||
|
||||
# Name "blowfish - Win32 Release" |
||||
# Name "blowfish - Win32 Debug" |
||||
# Begin Group "Source Files" |
||||
|
||||
# PROP Default_Filter ".c" |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_cbc.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_cfb64.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_ecb.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_enc.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_ofb64.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_skey.c |
||||
# End Source File |
||||
# End Group |
||||
# Begin Group "Include Files" |
||||
|
||||
# PROP Default_Filter ".h" |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_locl.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\bf_pi.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\blowfish.h |
||||
# End Source File |
||||
# End Group |
||||
# End Target |
||||
# End Project |
@ -1,46 +0,0 @@
|
||||
Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au) |
||||
All rights reserved. |
||||
|
||||
This package is an Blowfish implementation written |
||||
by Eric Young (eay@mincom.oz.au). |
||||
|
||||
This library is free for commercial and non-commercial use as long as |
||||
the following conditions are aheared to. The following conditions |
||||
apply to all code found in this distribution. |
||||
|
||||
Copyright remains Eric Young's, and as such any Copyright notices in |
||||
the code are not to be removed. |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions |
||||
are met: |
||||
1. Redistributions of source code must retain the copyright |
||||
notice, this list of conditions and the following disclaimer. |
||||
2. Redistributions in binary form must reproduce the above copyright |
||||
notice, this list of conditions and the following disclaimer in the |
||||
documentation and/or other materials provided with the distribution. |
||||
3. All advertising materials mentioning features or use of this software |
||||
must display the following acknowledgement: |
||||
This product includes software developed by Eric Young (eay@mincom.oz.au) |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
SUCH DAMAGE. |
||||
|
||||
The license and distribution terms for any publically available version or |
||||
derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
copied and put under another distrubution license |
||||
[including the GNU Public License.] |
||||
|
||||
The reason behind this being stated in this direct manner is past |
||||
experience in code simply being copied and the attribution removed |
||||
from it and then being distributed as part of other packages. This |
||||
implementation was a non-trivial and unpaid effort. |
@ -1,14 +0,0 @@
|
||||
This Eric Young's blowfish implementation, taken from his SSLeay library |
||||
and made available as a separate library. |
||||
|
||||
The version number (0.7.2m) is the SSLeay version that this library was |
||||
taken from. |
||||
|
||||
To build, just unpack and type make. |
||||
If you are not using gcc, edit the Makefile. |
||||
If you are compiling for an x86 box, try the assembler (it needs improving). |
||||
There are also some compile time options that can improve performance, |
||||
these are documented in the Makefile. |
||||
|
||||
eric 15-Apr-1997 |
||||
|
@ -1,160 +0,0 @@
|
||||
# Targets
|
||||
# make - twidle the options yourself :-)
|
||||
# make cc - standard cc options
|
||||
# make gcc - standard gcc options
|
||||
# make x86-elf - linux-elf etc
|
||||
# make x86-out - linux-a.out, FreeBSD etc
|
||||
# make x86-solaris
|
||||
# make x86-bdsi
|
||||
|
||||
# use BF_PTR2 for intel boxes,
|
||||
# BF_PTR for sparc and MIPS/SGI
|
||||
# use nothing for Alpha and HP.
|
||||
|
||||
# There are 3 possible performance options, experiment :-)
|
||||
#OPTS= -DBF_PTR # usr for sparc and MIPS/SGI
|
||||
#OPTS= -DBF_PTR2 # use for pentium
|
||||
#OPTS= # use for pentium pro, Alpha and HP
|
||||
|
||||
MAKE=make -f Makefile
|
||||
CC=cc
|
||||
CFLAG= -O
|
||||
|
||||
#CC=gcc
|
||||
#CFLAG= -O4 -funroll-loops -fomit-frame-pointer
|
||||
#CFLAG= -O3 -fomit-frame-pointer
|
||||
|
||||
CFLAGS=$(OPTS) $(CFLAG)
|
||||
CPP=$(CC) -E
|
||||
AS=as
|
||||
|
||||
# Assember version of bf_encrypt().
|
||||
BF_ENC=bf_enc.o # normal C version
|
||||
#BF_ENC=asm/bx86-elf.o # elf format x86
|
||||
#BF_ENC=asm/bx86-out.o # a.out format x86
|
||||
#BF_ENC=asm/bx86-sol.o # solaris format x86
|
||||
#BF_ENC=asm/bx86bsdi.o # bsdi format x86
|
||||
|
||||
LIBDIR=/usr/local/lib
|
||||
BINDIR=/usr/local/bin
|
||||
INCDIR=/usr/local/include
|
||||
MANDIR=/usr/local/man
|
||||
MAN1=1
|
||||
MAN3=3
|
||||
SHELL=/bin/sh
|
||||
LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cbc.o bf_cfb64.o bf_ofb64.o
|
||||
LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cbc.c bf_cfb64.c bf_ofb64.c
|
||||
|
||||
GENERAL=Makefile Makefile.ssl Makefile.uni asm bf_locl.org README \
|
||||
COPYRIGHT INSTALL blowfish.doc
|
||||
|
||||
TESTING= bftest bfspeed
|
||||
TESTING_SRC=bftest.c bfspeed.c
|
||||
HEADERS=bf_locl.h blowfish.h bf_pi.h
|
||||
|
||||
ALL= $(GENERAL) $(TESTING_SRC) $(LIBSRC) $(HEADERS)
|
||||
|
||||
BLIB= libblowfish.a
|
||||
|
||||
all: $(BLIB) $(TESTING) |
||||
|
||||
cc: |
||||
$(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all
|
||||
|
||||
gcc: |
||||
$(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-elf: |
||||
$(MAKE) BF_ENC='asm/bx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-out: |
||||
$(MAKE) BF_ENC='asm/bx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-solaris: |
||||
$(MAKE) BF_ENC='asm/bx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-bsdi: |
||||
$(MAKE) BF_ENC='asm/bx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all
|
||||
|
||||
# elf
|
||||
asm/bx86-elf.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CPP) -DELF asm/bx86unix.cpp | $(AS) -o asm/bx86-elf.o
|
||||
|
||||
# solaris
|
||||
asm/bx86-sol.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s
|
||||
as -o asm/bx86-sol.o asm/bx86-sol.s
|
||||
rm -f asm/bx86-sol.s
|
||||
|
||||
# a.out
|
||||
asm/bx86-out.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CPP) -DOUT asm/bx86unix.cpp | $(AS) -o asm/bx86-out.o
|
||||
|
||||
# bsdi
|
||||
asm/bx86bsdi.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CPP) -DBSDI asm/bx86unix.cpp | $(AS) -o asm/bx86bsdi.o
|
||||
|
||||
test: all |
||||
./bftest
|
||||
|
||||
$(BLIB): $(LIBOBJ) |
||||
/bin/rm -f $(BLIB)
|
||||
ar cr $(BLIB) $(LIBOBJ)
|
||||
-if test -s /bin/ranlib; then /bin/ranlib $(BLIB); \
|
||||
else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(BLIB); \
|
||||
else exit 0; fi; fi
|
||||
|
||||
bftest: bftest.o $(BLIB) |
||||
$(CC) $(CFLAGS) -o bftest bftest.o $(BLIB)
|
||||
|
||||
bfspeed: bfspeed.o $(BLIB) |
||||
$(CC) $(CFLAGS) -o bfspeed bfspeed.o $(BLIB)
|
||||
|
||||
tags: |
||||
ctags $(TESTING_SRC) $(LIBBF)
|
||||
|
||||
tar: |
||||
tar chf libbf.tar $(ALL)
|
||||
|
||||
shar: |
||||
shar $(ALL) >libbf.shar
|
||||
|
||||
depend: |
||||
makedepend $(LIBBF) $(TESTING_SRC)
|
||||
|
||||
clean: |
||||
rm -f *.o tags core $(TESTING) $(BLIB) .nfs* *.old *.bak asm/*.o
|
||||
|
||||
dclean: |
||||
sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new
|
||||
mv -f Makefile.new Makefile
|
||||
|
||||
# Eric is probably going to choke when he next looks at this --tjh
|
||||
install: $(BLIB) |
||||
if test $(INSTALLTOP); then \
|
||||
echo SSL style install; \
|
||||
cp $(BLIB) $(INSTALLTOP)/lib; \
|
||||
if test -s /bin/ranlib; then \
|
||||
/bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \
|
||||
else \
|
||||
if test -s /usr/bin/ranlib; then \
|
||||
/usr/bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \
|
||||
fi; fi; \
|
||||
chmod 644 $(INSTALLTOP)/lib/$(BLIB); \
|
||||
cp blowfish.h $(INSTALLTOP)/include; \
|
||||
chmod 644 $(INSTALLTOP)/include/blowfish.h; \
|
||||
else \
|
||||
echo Standalone install; \
|
||||
cp $(BLIB) $(LIBDIR)/$(BLIB); \
|
||||
if test -s /bin/ranlib; then \
|
||||
/bin/ranlib $(LIBDIR)/$(BLIB); \
|
||||
else \
|
||||
if test -s /usr/bin/ranlib; then \
|
||||
/usr/bin/ranlib $(LIBDIR)/$(BLIB); \
|
||||
fi; \
|
||||
fi; \
|
||||
chmod 644 $(LIBDIR)/$(BLIB); \
|
||||
cp blowfish.h $(INCDIR)/blowfish.h; \
|
||||
chmod 644 $(INCDIR)/blowfish.h; \
|
||||
fi
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
@ -1,104 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/blowfish/Makefile
|
||||
#
|
||||
|
||||
DIR= bf
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
CPP= $(CC) -E
|
||||
INCLUDES=
|
||||
CFLAG=-g
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= makedepend -fMakefile.ssl
|
||||
MAKEFILE= Makefile.ssl
|
||||
|
||||
BF_ENC= bf_enc.o
|
||||
# or use
|
||||
#DES_ENC= bx86-elf.o
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=bftest.c
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cbc.c bf_cfb64.c bf_ofb64.c
|
||||
LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cbc.o bf_cfb64.o bf_ofb64.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= blowfish.h
|
||||
HEADER= bf_pi.h bf_locl.h $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top: |
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib |
||||
|
||||
lib: $(LIBOBJ) |
||||
ar r $(LIB) $(LIBOBJ)
|
||||
sh $(TOP)/util/ranlib.sh $(LIB)
|
||||
@touch lib
|
||||
|
||||
# elf
|
||||
asm/bx86-elf.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CPP) -DELF asm/bx86unix.cpp | as -o asm/bx86-elf.o
|
||||
|
||||
# solaris
|
||||
asm/bx86-sol.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s
|
||||
as -o asm/bx86-sol.o asm/bx86-sol.s
|
||||
rm -f asm/bx86-sol.s
|
||||
|
||||
# a.out
|
||||
asm/bx86-out.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CPP) -DOUT asm/bx86unix.cpp | as -o asm/bx86-out.o
|
||||
|
||||
# bsdi
|
||||
asm/bx86bsdi.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CPP) -DBSDI asm/bx86unix.cpp | as -o asm/bx86bsdi.o
|
||||
|
||||
files: |
||||
perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links: |
||||
/bin/rm -f Makefile
|
||||
$(TOP)/util/point.sh Makefile.ssl Makefile ;
|
||||
/bin/rm -f des.doc
|
||||
$(TOP)/util/point.sh ../../doc/blowfish.doc blowfish.doc ;
|
||||
$(TOP)/util/mklink.sh ../../include $(EXHEADER)
|
||||
$(TOP)/util/mklink.sh ../../test $(TEST)
|
||||
$(TOP)/util/mklink.sh ../../apps $(APPS)
|
||||
|
||||
install: |
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALLTOP)/include/$$i; \
|
||||
chmod 644 $(INSTALLTOP)/include/$$i ); \
|
||||
done;
|
||||
|
||||
tags: |
||||
ctags $(SRC)
|
||||
|
||||
tests: |
||||
|
||||
lint: |
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend: |
||||
$(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean: |
||||
perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean: |
||||
/bin/rm -f *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
errors: |
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
@ -1,160 +0,0 @@
|
||||
# Targets
|
||||
# make - twidle the options yourself :-)
|
||||
# make cc - standard cc options
|
||||
# make gcc - standard gcc options
|
||||
# make x86-elf - linux-elf etc
|
||||
# make x86-out - linux-a.out, FreeBSD etc
|
||||
# make x86-solaris
|
||||
# make x86-bdsi
|
||||
|
||||
# use BF_PTR2 for intel boxes,
|
||||
# BF_PTR for sparc and MIPS/SGI
|
||||
# use nothing for Alpha and HP.
|
||||
|
||||
# There are 3 possible performance options, experiment :-)
|
||||
OPTS= -DBF_PTR # usr for sparc and MIPS/SGI
|
||||
#OPTS= -DBF_PTR2 # use for pentium
|
||||
#OPTS= # use for pentium pro, Alpha and HP
|
||||
|
||||
MAKE=make -f Makefile
|
||||
#CC=cc
|
||||
#CFLAG= -O
|
||||
|
||||
CC=gcc
|
||||
#CFLAG= -O4 -funroll-loops -fomit-frame-pointer
|
||||
CFLAG= -O3 -fomit-frame-pointer
|
||||
|
||||
CFLAGS=$(OPTS) $(CFLAG)
|
||||
CPP=$(CC) -E
|
||||
AS=as
|
||||
|
||||
# Assember version of bf_encrypt().
|
||||
BF_ENC=bf_enc.o # normal C version
|
||||
#BF_ENC=asm/bx86-elf.o # elf format x86
|
||||
#BF_ENC=asm/bx86-out.o # a.out format x86
|
||||
#BF_ENC=asm/bx86-sol.o # solaris format x86
|
||||
#BF_ENC=asm/bx86bsdi.o # bsdi format x86
|
||||
|
||||
LIBDIR=/usr/local/lib
|
||||
BINDIR=/usr/local/bin
|
||||
INCDIR=/usr/local/include
|
||||
MANDIR=/usr/local/man
|
||||
MAN1=1
|
||||
MAN3=3
|
||||
SHELL=/bin/sh
|
||||
LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cbc.o bf_cfb64.o bf_ofb64.o
|
||||
LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cbc.c bf_cfb64.c bf_ofb64.c
|
||||
|
||||
GENERAL=Makefile Makefile.ssl Makefile.uni asm bf_locl.org README \
|
||||
COPYRIGHT INSTALL blowfish.doc
|
||||
|
||||
TESTING= bftest bfspeed
|
||||
TESTING_SRC=bftest.c bfspeed.c
|
||||
HEADERS=bf_locl.h blowfish.h bf_pi.h
|
||||
|
||||
ALL= $(GENERAL) $(TESTING_SRC) $(LIBSRC) $(HEADERS)
|
||||
|
||||
BLIB= libblowfish.a
|
||||
|
||||
all: $(BLIB) $(TESTING) |
||||
|
||||
cc: |
||||
$(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all
|
||||
|
||||
gcc: |
||||
$(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-elf: |
||||
$(MAKE) BF_ENC='asm/bx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-out: |
||||
$(MAKE) BF_ENC='asm/bx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-solaris: |
||||
$(MAKE) BF_ENC='asm/bx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all
|
||||
|
||||
x86-bsdi: |
||||
$(MAKE) BF_ENC='asm/bx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all
|
||||
|
||||
# elf
|
||||
asm/bx86-elf.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CPP) -DELF asm/bx86unix.cpp | $(AS) -o asm/bx86-elf.o
|
||||
|
||||
# solaris
|
||||
asm/bx86-sol.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s
|
||||
as -o asm/bx86-sol.o asm/bx86-sol.s
|
||||
rm -f asm/bx86-sol.s
|
||||
|
||||
# a.out
|
||||
asm/bx86-out.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CPP) -DOUT asm/bx86unix.cpp | $(AS) -o asm/bx86-out.o
|
||||
|
||||
# bsdi
|
||||
asm/bx86bsdi.o: asm/bx86-cpp.s asm/bx86unix.cpp |
||||
$(CPP) -DBSDI asm/bx86unix.cpp | $(AS) -o asm/bx86bsdi.o
|
||||
|
||||
test: all |
||||
./bftest
|
||||
|
||||
$(BLIB): $(LIBOBJ) |
||||
/bin/rm -f $(BLIB)
|
||||
ar cr $(BLIB) $(LIBOBJ)
|
||||
-if test -s /bin/ranlib; then /bin/ranlib $(BLIB); \
|
||||
else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(BLIB); \
|
||||
else exit 0; fi; fi
|
||||
|
||||
bftest: bftest.o $(BLIB) |
||||
$(CC) $(CFLAGS) -o bftest bftest.o $(BLIB)
|
||||
|
||||
bfspeed: bfspeed.o $(BLIB) |
||||
$(CC) $(CFLAGS) -o bfspeed bfspeed.o $(BLIB)
|
||||
|
||||
tags: |
||||
ctags $(TESTING_SRC) $(LIBBF)
|
||||
|
||||
tar: |
||||
tar chf libbf.tar $(ALL)
|
||||
|
||||
shar: |
||||
shar $(ALL) >libbf.shar
|
||||
|
||||
depend: |
||||
makedepend $(LIBBF) $(TESTING_SRC)
|
||||
|
||||
clean: |
||||
/bin/rm -f *.o tags core $(TESTING) $(BLIB) .nfs* *.old *.bak asm/*.o
|
||||
|
||||
dclean: |
||||
sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new
|
||||
mv -f Makefile.new Makefile
|
||||
|
||||
# Eric is probably going to choke when he next looks at this --tjh
|
||||
install: $(BLIB) |
||||
if test $(INSTALLTOP); then \
|
||||
echo SSL style install; \
|
||||
cp $(BLIB) $(INSTALLTOP)/lib; \
|
||||
if test -s /bin/ranlib; then \
|
||||
/bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \
|
||||
else \
|
||||
if test -s /usr/bin/ranlib; then \
|
||||
/usr/bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \
|
||||
fi; fi; \
|
||||
chmod 644 $(INSTALLTOP)/lib/$(BLIB); \
|
||||
cp blowfish.h $(INSTALLTOP)/include; \
|
||||
chmod 644 $(INSTALLTOP)/include/blowfish.h; \
|
||||
else \
|
||||
echo Standalone install; \
|
||||
cp $(BLIB) $(LIBDIR)/$(BLIB); \
|
||||
if test -s /bin/ranlib; then \
|
||||
/bin/ranlib $(LIBDIR)/$(BLIB); \
|
||||
else \
|
||||
if test -s /usr/bin/ranlib; then \
|
||||
/usr/bin/ranlib $(LIBDIR)/$(BLIB); \
|
||||
fi; \
|
||||
fi; \
|
||||
chmod 644 $(LIBDIR)/$(BLIB); \
|
||||
cp blowfish.h $(INCDIR)/blowfish.h; \
|
||||
chmod 644 $(INCDIR)/blowfish.h; \
|
||||
fi
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
@ -1,8 +0,0 @@
|
||||
This is a quick packaging up of my blowfish code into a library. |
||||
It has been lifted from SSLeay. |
||||
The copyright notices seem a little harsh because I have not spent the |
||||
time to rewrite the conditions from the normal SSLeay ones. |
||||
|
||||
Basically if you just want to play with the library, not a problem. |
||||
|
||||
eric 15-Apr-1997 |
@ -1,159 +0,0 @@
|
||||
|
||||
#!/usr/local/bin/perl |
||||
|
||||
$prog="bf586.pl"; |
||||
|
||||
# base code is in microsft |
||||
# op dest, source |
||||
# format. |
||||
# |
||||
|
||||
if ( ($ARGV[0] eq "elf")) |
||||
{ require "x86unix.pl"; } |
||||
elsif ( ($ARGV[0] eq "a.out")) |
||||
{ $aout=1; require "x86unix.pl"; } |
||||
elsif ( ($ARGV[0] eq "sol")) |
||||
{ $sol=1; require "x86unix.pl"; } |
||||
elsif ( ($ARGV[0] eq "cpp")) |
||||
{ $cpp=1; require "x86unix.pl"; } |
||||
elsif ( ($ARGV[0] eq "win32")) |
||||
{ require "x86ms.pl"; } |
||||
else |
||||
{ |
||||
print STDERR <<"EOF"; |
||||
Pick one target type from |
||||
elf - linux, FreeBSD etc |
||||
a.out - old linux |
||||
sol - x86 solaris |
||||
cpp - format so x86unix.cpp can be used |
||||
win32 - Windows 95/Windows NT |
||||
EOF |
||||
exit(1); |
||||
} |
||||
|
||||
&comment("Don't even think of reading this code"); |
||||
&comment("It was automatically generated by $prog"); |
||||
&comment("Which is a perl program used to generate the x86 assember for"); |
||||
&comment("any of elf, a.out, Win32, or Solaris"); |
||||
&comment("It can be found in SSLeay 0.7.0+"); |
||||
&comment("eric <eay\@mincom.oz.au>"); |
||||
&comment(""); |
||||
|
||||
&file("bfx86xxxx"); |
||||
|
||||
$BF_ROUNDS=16; |
||||
$BF_OFF=($BF_ROUNDS+2)*4; |
||||
$L="ecx"; |
||||
$R="edx"; |
||||
$P="edi"; |
||||
$tot="esi"; |
||||
$tmp1="eax"; |
||||
$tmp2="ebx"; |
||||
$tmp3="ebp"; |
||||
|
||||
&des_encrypt("BF_encrypt"); |
||||
|
||||
&file_end(); |
||||
|
||||
sub des_encrypt |
||||
{ |
||||
local($name)=@_; |
||||
|
||||
&function_begin($name,3); |
||||
|
||||
&comment(""); |
||||
&comment("Load the 2 words"); |
||||
&mov("eax",&wparam(0)); |
||||
&mov($L,&DWP(0,"eax","",0)); |
||||
&mov($R,&DWP(4,"eax","",0)); |
||||
|
||||
&comment(""); |
||||
&comment("P pointer, s and enc flag"); |
||||
&mov($P,&wparam(1)); |
||||
|
||||
&xor( $tmp1, $tmp1); |
||||
&xor( $tmp2, $tmp2); |
||||
|
||||
# encrypting part |
||||
|
||||
&mov("ebp",&wparam(2)); # get encrypt flag |
||||
&cmp("ebp","0"); |
||||
&je(&label("start_decrypt")); |
||||
|
||||
&xor($L,&DWP(0,$P,"",0)); |
||||
for ($i=0; $i<$BF_ROUNDS; $i+=2) |
||||
{ |
||||
&comment(""); |
||||
&comment("Round $i"); |
||||
&BF_ENCRYPT($i+1,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3); |
||||
|
||||
&comment(""); |
||||
&comment("Round ".sprintf("%d",$i+1)); |
||||
&BF_ENCRYPT($i+2,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3); |
||||
} |
||||
&xor($R,&DWP(($BF_ROUNDS+1)*4,$P,"",0)); |
||||
|
||||
&mov("eax",&wparam(0)); |
||||
&mov(&DWP(0,"eax","",0),$R); |
||||
&mov(&DWP(4,"eax","",0),$L); |
||||
&function_end_A($name); |
||||
|
||||
&set_label("start_decrypt"); |
||||
|
||||
&xor($L,&DWP(($BF_ROUNDS+1)*4,$P,"",0)); |
||||
for ($i=$BF_ROUNDS; $i>0; $i-=2) |
||||
{ |
||||
&comment(""); |
||||
&comment("Round $i"); |
||||
&BF_ENCRYPT($i,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3); |
||||
&comment(""); |
||||
&comment("Round ".sprintf("%d",$i-1)); |
||||
&BF_ENCRYPT($i-1,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3); |
||||
} |
||||
&xor($R,&DWP(0,$P,"",0)); |
||||
|
||||
&mov("eax",&wparam(0)); |
||||
&mov(&DWP(0,"eax","",0),$R); |
||||
&mov(&DWP(4,"eax","",0),$L); |
||||
&function_end_A($name); |
||||
|
||||
&function_end_B($name); |
||||
} |
||||
|
||||
sub BF_ENCRYPT |
||||
{ |
||||
local($i,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3)=@_; |
||||
|
||||
&rotr( $R, 16); |
||||
&mov( $tot, &DWP(&n2a($i*4),$P,"",0)); |
||||
|
||||
&movb( &LB($tmp1), &HB($R)); |
||||
&movb( &LB($tmp2), &LB($R)); |
||||
|
||||
&rotr( $R, 16); |
||||
&xor( $L, $tot); |
||||
|
||||
&mov( $tot, &DWP(&n2a($BF_OFF+0x0000),$P,$tmp1,4)); |
||||
&mov( $tmp3, &DWP(&n2a($BF_OFF+0x0400),$P,$tmp2,4)); |
||||
|
||||
&movb( &LB($tmp1), &HB($R)); |
||||
&movb( &LB($tmp2), &LB($R)); |
||||
|
||||
&add( $tot, $tmp3); |
||||
&mov( $tmp1, &DWP(&n2a($BF_OFF+0x0800),$P,$tmp1,4)); # delay |
||||
|
||||
&xor( $tot, $tmp1); |
||||
&mov( $tmp3, &DWP(&n2a($BF_OFF+0x0C00),$P,$tmp2,4)); |
||||
|
||||
&add( $tot, $tmp3); |
||||
&xor( $tmp1, $tmp1); |
||||
|
||||
&xor( $L, $tot); |
||||
# delay |
||||
} |
||||
|
||||
sub n2a |
||||
{ |
||||
sprintf("%d",$_[0]); |
||||
} |
||||
|
@ -1,666 +0,0 @@
|
||||
/* Don't even think of reading this code */ |
||||
/* It was automatically generated by bf586.pl */ |
||||
/* Which is a perl program used to generate the x86 assember for */ |
||||
/* any of elf, a.out, Win32, or Solaris */ |
||||
/* It can be found in SSLeay 0.7.0+ */ |
||||
/* eric <eay@mincom.oz.au> */ |
||||
|
||||
.file "bfx86xxxx.s" |
||||
.version "01.01" |
||||
gcc2_compiled.: |
||||
.text |
||||
.align ALIGN
|
||||
.globl BF_encrypt
|
||||
TYPE(BF_encrypt,@function)
|
||||
BF_encrypt: |
||||
pushl %ebp |
||||
pushl %ebx |
||||
pushl %esi |
||||
pushl %edi |
||||
|
||||
|
||||
/* Load the 2 words */ |
||||
movl 20(%esp), %eax |
||||
movl (%eax), %ecx |
||||
movl 4(%eax), %edx |
||||
|
||||
/* P pointer, s and enc flag */ |
||||
movl 24(%esp), %edi |
||||
xorl %eax, %eax |
||||
xorl %ebx, %ebx |
||||
movl 28(%esp), %ebp |
||||
cmpl $0, %ebp |
||||
je .L000start_decrypt |
||||
xorl (%edi), %ecx |
||||
|
||||
/* Round 0 */ |
||||
rorl $16, %ecx |
||||
movl 4(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 1 */ |
||||
rorl $16, %edx |
||||
movl 8(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 2 */ |
||||
rorl $16, %ecx |
||||
movl 12(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 3 */ |
||||
rorl $16, %edx |
||||
movl 16(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 4 */ |
||||
rorl $16, %ecx |
||||
movl 20(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 5 */ |
||||
rorl $16, %edx |
||||
movl 24(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 6 */ |
||||
rorl $16, %ecx |
||||
movl 28(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 7 */ |
||||
rorl $16, %edx |
||||
movl 32(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 8 */ |
||||
rorl $16, %ecx |
||||
movl 36(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 9 */ |
||||
rorl $16, %edx |
||||
movl 40(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 10 */ |
||||
rorl $16, %ecx |
||||
movl 44(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 11 */ |
||||
rorl $16, %edx |
||||
movl 48(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 12 */ |
||||
rorl $16, %ecx |
||||
movl 52(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 13 */ |
||||
rorl $16, %edx |
||||
movl 56(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 14 */ |
||||
rorl $16, %ecx |
||||
movl 60(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 15 */ |
||||
rorl $16, %edx |
||||
movl 64(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
xorl 68(%edi), %edx |
||||
movl 20(%esp), %eax |
||||
movl %edx, (%eax) |
||||
movl %ecx, 4(%eax) |
||||
popl %edi |
||||
popl %esi |
||||
popl %ebx |
||||
popl %ebp |
||||
ret |
||||
.align ALIGN
|
||||
.L000start_decrypt: |
||||
xorl 68(%edi), %ecx |
||||
|
||||
/* Round 16 */ |
||||
rorl $16, %ecx |
||||
movl 64(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 15 */ |
||||
rorl $16, %edx |
||||
movl 60(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 14 */ |
||||
rorl $16, %ecx |
||||
movl 56(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 13 */ |
||||
rorl $16, %edx |
||||
movl 52(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 12 */ |
||||
rorl $16, %ecx |
||||
movl 48(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 11 */ |
||||
rorl $16, %edx |
||||
movl 44(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 10 */ |
||||
rorl $16, %ecx |
||||
movl 40(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 9 */ |
||||
rorl $16, %edx |
||||
movl 36(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 8 */ |
||||
rorl $16, %ecx |
||||
movl 32(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 7 */ |
||||
rorl $16, %edx |
||||
movl 28(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 6 */ |
||||
rorl $16, %ecx |
||||
movl 24(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 5 */ |
||||
rorl $16, %edx |
||||
movl 20(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 4 */ |
||||
rorl $16, %ecx |
||||
movl 16(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 3 */ |
||||
rorl $16, %edx |
||||
movl 12(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
|
||||
/* Round 2 */ |
||||
rorl $16, %ecx |
||||
movl 8(%edi), %esi |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
rorl $16, %ecx |
||||
xorl %esi, %edx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %ch, %al |
||||
movb %cl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %edx |
||||
|
||||
/* Round 1 */ |
||||
rorl $16, %edx |
||||
movl 4(%edi), %esi |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
rorl $16, %edx |
||||
xorl %esi, %ecx |
||||
movl 72(%edi,%eax,4),%esi |
||||
movl 1096(%edi,%ebx,4),%ebp |
||||
movb %dh, %al |
||||
movb %dl, %bl |
||||
addl %ebp, %esi |
||||
movl 2120(%edi,%eax,4),%eax |
||||
xorl %eax, %esi |
||||
movl 3144(%edi,%ebx,4),%ebp |
||||
addl %ebp, %esi |
||||
xorl %eax, %eax |
||||
xorl %esi, %ecx |
||||
xorl (%edi), %edx |
||||
movl 20(%esp), %eax |
||||
movl %edx, (%eax) |
||||
movl %ecx, 4(%eax) |
||||
popl %edi |
||||
popl %esi |
||||
popl %ebx |
||||
popl %ebp |
||||
ret |
||||
.BF_encrypt_end: |
||||
SIZE(BF_encrypt,.BF_encrypt_end-BF_encrypt) |
||||
.ident "desasm.pl" |
@ -1,33 +0,0 @@
|
||||
|
||||
#define TYPE(a,b) .type a,b |
||||
#define SIZE(a,b) .size a,b |
||||
|
||||
#ifdef OUT |
||||
#define OK 1 |
||||
#define BF_encrypt _BF_encrypt |
||||
#define ALIGN 4 |
||||
#endif |
||||
|
||||
#ifdef BSDI |
||||
#define OK 1 |
||||
#define BF_encrypt _BF_encrypt |
||||
#define ALIGN 4 |
||||
#undef SIZE |
||||
#undef TYPE |
||||
#endif |
||||
|
||||
#if defined(ELF) || defined(SOL) |
||||
#define OK 1 |
||||
#define ALIGN 16 |
||||
#endif |
||||
|
||||
#ifndef OK |
||||
You need to define one of |
||||
ELF - elf systems - linux-elf, NetBSD and DG-UX |
||||
OUT - a.out systems - linux-a.out and FreeBSD |
||||
SOL - solaris systems, which are elf with strange comment lines |
||||
BSDI - a.out with a very primative version of as. |
||||
#endif |
||||
|
||||
#include "bx86-cpp.s" |
||||
|
@ -1,3 +0,0 @@
|
||||
If you want more of an idea of how this all works, |
||||
have a read of the readme file in SSLeay/crypto/des/asm. |
||||
SSLeay can be found at ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL. |
@ -1,663 +0,0 @@
|
||||
; Don't even think of reading this code |
||||
; It was automatically generated by bf586.pl |
||||
; Which is a perl program used to generate the x86 assember for |
||||
; any of elf, a.out, Win32, or Solaris |
||||
; It can be found in SSLeay 0.7.0+ |
||||
; eric <eay@mincom.oz.au> |
||||
; |
||||
TITLE bfx86xxxx.asm |
||||
.386 |
||||
.model FLAT |
||||
_TEXT SEGMENT |
||||
PUBLIC _BF_encrypt |
||||
EXTRN _des_SPtrans:DWORD |
||||
_BF_encrypt PROC NEAR |
||||
push ebp |
||||
push ebx |
||||
push esi |
||||
push edi |
||||
; |
||||
; Load the 2 words |
||||
mov eax, DWORD PTR 20[esp] |
||||
mov ecx, DWORD PTR [eax] |
||||
mov edx, DWORD PTR 4[eax] |
||||
; |
||||
; P pointer, s and enc flag |
||||
mov edi, DWORD PTR 24[esp] |
||||
xor eax, eax |
||||
xor ebx, ebx |
||||
mov ebp, DWORD PTR 28[esp] |
||||
cmp ebp, 0 |
||||
je $L000start_decrypt |
||||
xor ecx, DWORD PTR [edi] |
||||
; |
||||
; Round 0 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 4[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 1 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 8[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 2 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 12[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 3 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 16[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 4 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 20[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 5 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 24[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 6 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 28[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 7 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 32[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 8 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 36[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 9 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 40[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 10 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 44[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 11 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 48[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 12 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 52[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 13 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 56[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 14 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 60[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 15 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 64[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
xor edx, DWORD PTR 68[edi] |
||||
mov eax, DWORD PTR 20[esp] |
||||
mov DWORD PTR [eax],edx |
||||
mov DWORD PTR 4[eax],ecx |
||||
pop edi |
||||
pop esi |
||||
pop ebx |
||||
pop ebp |
||||
ret |
||||
$L000start_decrypt: |
||||
xor ecx, DWORD PTR 68[edi] |
||||
; |
||||
; Round 16 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 64[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 15 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 60[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 14 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 56[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 13 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 52[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 12 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 48[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 11 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 44[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 10 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 40[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 9 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 36[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 8 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 32[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 7 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 28[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 6 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 24[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 5 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 20[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 4 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 16[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 3 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 12[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
; |
||||
; Round 2 |
||||
ror ecx, 16 |
||||
mov esi, DWORD PTR 8[edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
ror ecx, 16 |
||||
xor edx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, ch |
||||
mov bl, cl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor edx, esi |
||||
; |
||||
; Round 1 |
||||
ror edx, 16 |
||||
mov esi, DWORD PTR 4[edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
ror edx, 16 |
||||
xor ecx, esi |
||||
mov esi, DWORD PTR 72[eax*4+edi] |
||||
mov ebp, DWORD PTR 1096[ebx*4+edi] |
||||
mov al, dh |
||||
mov bl, dl |
||||
add esi, ebp |
||||
mov eax, DWORD PTR 2120[eax*4+edi] |
||||
xor esi, eax |
||||
mov ebp, DWORD PTR 3144[ebx*4+edi] |
||||
add esi, ebp |
||||
xor eax, eax |
||||
xor ecx, esi |
||||
xor edx, DWORD PTR [edi] |
||||
mov eax, DWORD PTR 20[esp] |
||||
mov DWORD PTR [eax],edx |
||||
mov DWORD PTR 4[eax],ecx |
||||
pop edi |
||||
pop esi |
||||
pop ebx |
||||
pop ebp |
||||
ret |
||||
_BF_encrypt ENDP |
||||
_TEXT ENDS |
||||
END |
@ -1,249 +0,0 @@
|
||||
#!/usr/local/bin/perl |
||||
|
||||
package x86ms; |
||||
|
||||
$label="L000"; |
||||
|
||||
%lb=( 'eax', 'al', |
||||
'ebx', 'bl', |
||||
'ecx', 'cl', |
||||
'edx', 'dl', |
||||
'ax', 'al', |
||||
'bx', 'bl', |
||||
'cx', 'cl', |
||||
'dx', 'dl', |
||||
); |
||||
|
||||
%hb=( 'eax', 'ah', |
||||
'ebx', 'bh', |
||||
'ecx', 'ch', |
||||
'edx', 'dh', |
||||
'ax', 'ah', |
||||
'bx', 'bh', |
||||
'cx', 'ch', |
||||
'dx', 'dh', |
||||
); |
||||
|
||||
sub main'LB |
||||
{ |
||||
(defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte'\n"; |
||||
return($lb{$_[0]}); |
||||
} |
||||
|
||||
sub main'HB |
||||
{ |
||||
(defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n"; |
||||
return($hb{$_[0]}); |
||||
} |
||||
|
||||
sub main'DWP |
||||
{ |
||||
local($addr,$reg1,$reg2,$idx)=@_; |
||||
local($t); |
||||
local($ret)="DWORD PTR "; |
||||
|
||||
$addr =~ s/^\s+//; |
||||
if ($addr =~ /^(.+)\+(.+)$/) |
||||
{ |
||||
$reg2=&conv($1); |
||||
$addr="_$2"; |
||||
} |
||||
elsif ($addr =~ /^[_a-zA-Z]/) |
||||
{ |
||||
$addr="_$addr"; |
||||
} |
||||
|
||||
$reg1="$regs{$reg1}" if defined($regs{$reg1}); |
||||
$reg2="$regs{$reg2}" if defined($regs{$reg2}); |
||||
$ret.=$addr if ($addr ne "") && ($addr ne 0); |
||||
if ($reg2 ne "") |
||||
{ |
||||
$t=""; |
||||
$t="*$idx" if ($idx != 0); |
||||
$ret.="[$reg2$t+$reg1]"; |
||||
} |
||||
else |
||||
{ |
||||
$ret.="[$reg1]" |
||||
} |
||||
return($ret); |
||||
} |
||||
|
||||
sub main'mov { &out2("mov",@_); } |
||||
sub main'movb { &out2("mov",@_); } |
||||
sub main'and { &out2("and",@_); } |
||||
sub main'or { &out2("or",@_); } |
||||
sub main'shl { &out2("shl",@_); } |
||||
sub main'shr { &out2("shr",@_); } |
||||
sub main'xor { &out2("xor",@_); } |
||||
sub main'add { &out2("add",@_); } |
||||
sub main'sub { &out2("sub",@_); } |
||||
sub main'rotl { &out2("rol",@_); } |
||||
sub main'rotr { &out2("ror",@_); } |
||||
sub main'exch { &out2("xchg",@_); } |
||||
sub main'cmp { &out2("cmp",@_); } |
||||
sub main'dec { &out1("dec",@_); } |
||||
sub main'jmp { &out1("jmp",@_); } |
||||
sub main'je { &out1("je",@_); } |
||||
sub main'jz { &out1("jz",@_); } |
||||
sub main'jnz { &out1("jnz",@_); } |
||||
sub main'push { &out1("push",@_); } |
||||
sub main'call { &out1("call",'_'.$_[0]); } |
||||
|
||||
|
||||
sub out2 |
||||
{ |
||||
local($name,$p1,$p2)=@_; |
||||
local($l,$t); |
||||
|
||||
print "\t$name\t"; |
||||
$t=&conv($p1).","; |
||||
$l=length($t); |
||||
print $t; |
||||
$l=4-($l+9)/8; |
||||
print "\t" x $l; |
||||
print &conv($p2); |
||||
print "\n"; |
||||
} |
||||
|
||||
sub out1 |
||||
{ |
||||
local($name,$p1)=@_; |
||||
local($l,$t); |
||||
|
||||
print "\t$name\t"; |
||||
print &conv($p1); |
||||
print "\n"; |
||||
} |
||||
|
||||
sub conv |
||||
{ |
||||
local($p)=@_; |
||||
|
||||
$p =~ s/0x([0-9A-Fa-f]+)/0$1h/; |
||||
return $p; |
||||
} |
||||
|
||||
sub main'file |
||||
{ |
||||
local($file)=@_; |
||||
|
||||
print <<"EOF"; |
||||
TITLE $file.asm |
||||
.386 |
||||
.model FLAT |
||||
EOF |
||||
} |
||||
|
||||
sub main'function_begin |
||||
{ |
||||
local($func,$num)=@_; |
||||
|
||||
$params=$num*4; |
||||
|
||||
print <<"EOF"; |
||||
_TEXT SEGMENT |
||||
PUBLIC _$func |
||||
EXTRN _des_SPtrans:DWORD |
||||
_$func PROC NEAR |
||||
push ebp |
||||
push ebx |
||||
push esi |
||||
push edi |
||||
EOF |
||||
$stack=20; |
||||
} |
||||
|
||||
sub main'function_end |
||||
{ |
||||
local($func)=@_; |
||||
|
||||
print <<"EOF"; |
||||
pop edi |
||||
pop esi |
||||
pop ebx |
||||
pop ebp |
||||
ret |
||||
_$func ENDP |
||||
_TEXT ENDS |
||||
EOF |
||||
$stack=0; |
||||
%label=(); |
||||
} |
||||
|
||||
sub main'function_end_A |
||||
{ |
||||
local($func)=@_; |
||||
|
||||
print <<"EOF"; |
||||
pop edi |
||||
pop esi |
||||
pop ebx |
||||
pop ebp |
||||
ret |
||||
EOF |
||||
} |
||||
|
||||
sub main'function_end_B |
||||
{ |
||||
local($func)=@_; |
||||
|
||||
print <<"EOF"; |
||||
_$func ENDP |
||||
_TEXT ENDS |
||||
EOF |
||||
$stack=0; |
||||
%label=(); |
||||
} |
||||
|
||||
sub main'file_end |
||||
{ |
||||
print "END\n" |
||||
} |
||||
|
||||
sub main'wparam |
||||
{ |
||||
local($num)=@_; |
||||
|
||||
return(&main'DWP($stack+$num*4,"esp","",0)); |
||||
} |
||||
|
||||
sub main'wtmp |
||||
{ |
||||
local($num)=@_; |
||||
|
||||
return(&main'DWP($stack+$params+$num*4,"esp","",0)); |
||||
} |
||||
|
||||
sub main'comment |
||||
{ |
||||
foreach (@_) |
||||
{ |
||||
print "\t; $_\n"; |
||||
} |
||||
} |
||||
|
||||
sub main'label |
||||
{ |
||||
if (!defined($label{$_[0]})) |
||||
{ |
||||
$label{$_[0]}="\$${label}${_[0]}"; |
||||
$label++; |
||||
} |
||||
return($label{$_[0]}); |
||||
} |
||||
|
||||
sub main'set_label |
||||
{ |
||||
if (!defined($label{$_[0]})) |
||||
{ |
||||
$label{$_[0]}="${label}${_[0]}"; |
||||
$label++; |
||||
} |
||||
print "$label{$_[0]}:\n"; |
||||
} |
||||
|
||||
sub main'file_end |
||||
{ |
||||
print "END\n"; |
||||
} |
@ -1,313 +0,0 @@
|
||||
#!/usr/local/bin/perl |
||||
|
||||
package x86ms; |
||||
|
||||
$label="L000"; |
||||
|
||||
$align=($main'aout)?"4":"16"; |
||||
$under=($main'aout)?"_":""; |
||||
$com_start=($main'sol)?"/":"#"; |
||||
|
||||
if ($main'cpp) |
||||
{ |
||||
$align="ALIGN"; |
||||
$under=""; |
||||
$com_start='/*'; |
||||
$com_end='*/'; |
||||
} |
||||
|
||||
%lb=( 'eax', '%al', |
||||
'ebx', '%bl', |
||||
'ecx', '%cl', |
||||
'edx', '%dl', |
||||
'ax', '%al', |
||||
'bx', '%bl', |
||||
'cx', '%cl', |
||||
'dx', '%dl', |
||||
); |
||||
|
||||
%hb=( 'eax', '%ah', |
||||
'ebx', '%bh', |
||||
'ecx', '%ch', |
||||
'edx', '%dh', |
||||
'ax', '%ah', |
||||
'bx', '%bh', |
||||
'cx', '%ch', |
||||
'dx', '%dh', |
||||
); |
||||
|
||||
%regs=( 'eax', '%eax', |
||||
'ebx', '%ebx', |
||||
'ecx', '%ecx', |
||||
'edx', '%edx', |
||||
'esi', '%esi', |
||||
'edi', '%edi', |
||||
'ebp', '%ebp', |
||||
'esp', '%esp', |
||||
); |
||||
|
||||
sub main'LB |
||||
{ |
||||
(defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte'\n"; |
||||
return($lb{$_[0]}); |
||||
} |
||||
|
||||
sub main'HB |
||||
{ |
||||
(defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n"; |
||||
return($hb{$_[0]}); |
||||
} |
||||
|
||||
sub main'DWP |
||||
{ |
||||
local($addr,$reg1,$reg2,$idx)=@_; |
||||
|
||||
|
||||
$ret=""; |
||||
|
||||
$addr =~ s/(^|[+ \t])([A-Za-z_]+)($|[+ \t])/$1$under$2$3/; |
||||
|
||||
$reg1="$regs{$reg1}" if defined($regs{$reg1}); |
||||
$reg2="$regs{$reg2}" if defined($regs{$reg2}); |
||||
$ret.=$addr if ($addr ne "") && ($addr ne 0); |
||||
if ($reg2 ne "") |
||||
{ |
||||
$ret.="($reg1,$reg2,$idx)"; |
||||
} |
||||
else |
||||
{ |
||||
$ret.="($reg1)" |
||||
} |
||||
return($ret); |
||||
} |
||||
|
||||
sub main'BP |
||||
{ |
||||
local($addr,$reg1,$reg2,$idx)=@_; |
||||
|
||||
|
||||
$ret=""; |
||||
|
||||
$addr =~ s/(^|[+ \t])([A-Za-z_]+)($|[+ \t])/$1$under$2$3/; |
||||
|
||||
$reg1="$regs{$reg1}" if defined($regs{$reg1}); |
||||
$reg2="$regs{$reg2}" if defined($regs{$reg2}); |
||||
$ret.=$addr if ($addr ne "") && ($addr ne 0); |
||||
if ($reg2 ne "") |
||||
{ |
||||
$ret.="($reg1,$reg2,$idx)"; |
||||
} |
||||
else |
||||
{ |
||||
$ret.="($reg1)" |
||||
} |
||||
return($ret); |
||||
} |
||||
|
||||
sub main'mov { &out2("movl",@_); } |
||||
sub main'movb { &out2("movb",@_); } |
||||
sub main'and { &out2("andl",@_); } |
||||
sub main'or { &out2("orl",@_); } |
||||
sub main'shl { &out2("sall",@_); } |
||||
sub main'shr { &out2("shrl",@_); } |
||||
sub main'xor { &out2("xorl",@_); } |
||||
sub main'add { &out2("addl",@_); } |
||||
sub main'sub { &out2("subl",@_); } |
||||
sub main'rotl { &out2("roll",@_); } |
||||
sub main'rotr { &out2("rorl",@_); } |
||||
sub main'exch { &out2("xchg",@_); } |
||||
sub main'cmp { &out2("cmpl",@_); } |
||||
sub main'jmp { &out1("jmp",@_); } |
||||
sub main'je { &out1("je",@_); } |
||||
sub main'jne { &out1("jne",@_); } |
||||
sub main'jnz { &out1("jnz",@_); } |
||||
sub main'jz { &out1("jz",@_); } |
||||
sub main'dec { &out1("decl",@_); } |
||||
sub main'push { &out1("pushl",@_); } |
||||
sub main'call { &out1("call",$under.$_[0]); } |
||||
|
||||
|
||||
sub out2 |
||||
{ |
||||
local($name,$p1,$p2)=@_; |
||||
local($l,$ll,$t); |
||||
|
||||
print "\t$name\t"; |
||||
$t=&conv($p2).","; |
||||
$l=length($t); |
||||
print $t; |
||||
$ll=4-($l+9)/8; |
||||
print "\t" x $ll; |
||||
print &conv($p1); |
||||
print "\n"; |
||||
} |
||||
|
||||
sub out1 |
||||
{ |
||||
local($name,$p1)=@_; |
||||
local($l,$t); |
||||
|
||||
print "\t$name\t"; |
||||
print &conv($p1); |
||||
print "\n"; |
||||
} |
||||
|
||||
sub conv |
||||
{ |
||||
local($p)=@_; |
||||
|
||||
# $p =~ s/0x([0-9A-Fa-f]+)/0$1h/; |
||||
|
||||
$p=$regs{$p} if (defined($regs{$p})); |
||||
|
||||
$p =~ s/^([0-9A-Fa-f]+)$/\$$1/; |
||||
$p =~ s/^(0x[0-9A-Fa-f]+)$/\$$1/; |
||||
return $p; |
||||
} |
||||
|
||||
sub main'file |
||||
{ |
||||
local($file)=@_; |
||||
|
||||
print <<"EOF"; |
||||
.file "$file.s" |
||||
.version "01.01" |
||||
gcc2_compiled.: |
||||
EOF |
||||
} |
||||
|
||||
sub main'function_begin |
||||
{ |
||||
local($func,$num)=@_; |
||||
|
||||
$params=$num*4; |
||||
|
||||
$func=$under.$func; |
||||
|
||||
print <<"EOF"; |
||||
.text |
||||
.align $align |
||||
.globl $func |
||||
EOF |
||||
if ($main'cpp) |
||||
{ printf("\tTYPE($func,\@function)\n"); } |
||||
else { printf("\t.type $func,\@function\n"); } |
||||
print <<"EOF"; |
||||
$func: |
||||
pushl %ebp |
||||
pushl %ebx |
||||
pushl %esi |
||||
pushl %edi |
||||
|
||||
EOF |
||||
$stack=20; |
||||
} |
||||
|
||||
sub main'function_end |
||||
{ |
||||
local($func)=@_; |
||||
|
||||
$func=$under.$func; |
||||
|
||||
print <<"EOF"; |
||||
popl %edi |
||||
popl %esi |
||||
popl %ebx |
||||
popl %ebp |
||||
ret |
||||
.${func}_end: |
||||
EOF |
||||
if ($main'cpp) |
||||
{ printf("\tSIZE($func,.${func}_end-$func)\n"); } |
||||
else { printf("\t.size\t$func,.${func}_end-$func\n"); } |
||||
print ".ident \"desasm.pl\"\n"; |
||||
$stack=0; |
||||
%label=(); |
||||
} |
||||
|
||||
sub main'function_end_A |
||||
{ |
||||
local($func)=@_; |
||||
|
||||
print <<"EOF"; |
||||
popl %edi |
||||
popl %esi |
||||
popl %ebx |
||||
popl %ebp |
||||
ret |
||||
EOF |
||||
} |
||||
|
||||
sub main'function_end_B |
||||
{ |
||||
local($func)=@_; |
||||
|
||||
$func=$under.$func; |
||||
|
||||
print <<"EOF"; |
||||
.${func}_end: |
||||
EOF |
||||
if ($main'cpp) |
||||
{ printf("\tSIZE($func,.${func}_end-$func)\n"); } |
||||
else { printf("\t.size\t$func,.${func}_end-$func\n"); } |
||||
print ".ident \"desasm.pl\"\n"; |
||||
$stack=0; |
||||
%label=(); |
||||
} |
||||
|
||||
sub main'wparam |
||||
{ |
||||
local($num)=@_; |
||||
|
||||
return(&main'DWP($stack+$num*4,"esp","",0)); |
||||
} |
||||
|
||||
sub main'wtmp_b |
||||
{ |
||||
local($num,$b)=@_; |
||||
|
||||
return(&main'BP(-(($num+1)*4)+$b,"esp","",0)); |
||||
} |
||||
|
||||
sub main'wtmp |
||||
{ |
||||
local($num)=@_; |
||||
|
||||
return(&main'DWP(-($num+1)*4,"esp","",0)); |
||||
} |
||||
|
||||
sub main'comment |
||||
{ |
||||
foreach (@_) |
||||
{ |
||||
if (/^\s*$/) |
||||
{ print "\n"; } |
||||
else |
||||
{ print "\t$com_start $_ $com_end\n"; } |
||||
} |
||||
} |
||||
|
||||
sub main'label |
||||
{ |
||||
if (!defined($label{$_[0]})) |
||||
{ |
||||
$label{$_[0]}=".${label}${_[0]}"; |
||||
$label++; |
||||
} |
||||
return($label{$_[0]}); |
||||
} |
||||
|
||||
sub main'set_label |
||||
{ |
||||
if (!defined($label{$_[0]})) |
||||
{ |
||||
$label{$_[0]}=".${label}${_[0]}"; |
||||
$label++; |
||||
} |
||||
print ".align $align\n"; |
||||
print "$label{$_[0]}:\n"; |
||||
} |
||||
|
||||
sub main'file_end |
||||
{ |
||||
} |
@ -1,143 +0,0 @@
|
||||
/* crypto/bf/bf_cbc.c */ |
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved. |
||||
* |
||||
* This package is an SSL implementation written |
||||
* by Eric Young (eay@mincom.oz.au). |
||||
* The implementation was written so as to conform with Netscapes SSL. |
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as |
||||
* the following conditions are aheared to. The following conditions |
||||
* apply to all code found in this distribution, be it the RC4, RSA, |
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation |
||||
* included with this distribution is covered by the same copyright terms |
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au). |
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in |
||||
* the code are not to be removed. |
||||
* If this package is used in a product, Eric Young should be given attribution |
||||
* as the author of the parts of the library used. |
||||
* This can be in the form of a textual message at program startup or |
||||
* in documentation (online or textual) provided with the package. |
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions |
||||
* are met: |
||||
* 1. Redistributions of source code must retain the copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* 2. Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* 3. All advertising materials mentioning features or use of this software |
||||
* must display the following acknowledgement: |
||||
* "This product includes cryptographic software written by |
||||
* Eric Young (eay@mincom.oz.au)" |
||||
* The word 'cryptographic' can be left out if the rouines from the library |
||||
* being used are not cryptographic related :-). |
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement: |
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)" |
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
* SUCH DAMAGE. |
||||
*
|
||||
* The licence and distribution terms for any publically available version or |
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
* copied and put under another distribution licence |
||||
* [including the GNU Public Licence.] |
||||
*/ |
||||
|
||||
#include "blowfish.h" |
||||
#include "bf_locl.h" |
||||
|
||||
void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, BF_KEY *ks, |
||||
unsigned char *iv, int encrypt) |
||||
{ |
||||
register BF_LONG tin0,tin1; |
||||
register BF_LONG tout0,tout1,xor0,xor1; |
||||
register long l=length; |
||||
BF_LONG tin[2]; |
||||
|
||||
if (encrypt != 0) |
||||
{ |
||||
n2l(iv,tout0); |
||||
n2l(iv,tout1); |
||||
iv-=8; |
||||
for (l-=8; l>=0; l-=8) |
||||
{ |
||||
n2l(in,tin0); |
||||
n2l(in,tin1); |
||||
tin0^=tout0; |
||||
tin1^=tout1; |
||||
tin[0]=tin0; |
||||
tin[1]=tin1; |
||||
BF_encrypt(tin,ks,BF_ENCRYPT); |
||||
tout0=tin[0]; |
||||
tout1=tin[1]; |
||||
l2n(tout0,out); |
||||
l2n(tout1,out); |
||||
} |
||||
if (l != -8) |
||||
{ |
||||
n2ln(in,tin0,tin1,l+8); |
||||
tin0^=tout0; |
||||
tin1^=tout1; |
||||
tin[0]=tin0; |
||||
tin[1]=tin1; |
||||
BF_encrypt(tin,ks,BF_ENCRYPT); |
||||
tout0=tin[0]; |
||||
tout1=tin[1]; |
||||
l2n(tout0,out); |
||||
l2n(tout1,out); |
||||
} |
||||
l2n(tout0,iv); |
||||
l2n(tout1,iv); |
||||
} |
||||
else |
||||
{ |
||||
n2l(iv,xor0); |
||||
n2l(iv,xor1); |
||||
iv-=8; |
||||
for (l-=8; l>=0; l-=8) |
||||
{ |
||||
n2l(in,tin0); |
||||
n2l(in,tin1); |
||||
tin[0]=tin0; |
||||
tin[1]=tin1; |
||||
BF_encrypt(tin,ks,BF_DECRYPT); |
||||
tout0=tin[0]^xor0; |
||||
tout1=tin[1]^xor1; |
||||
l2n(tout0,out); |
||||
l2n(tout1,out); |
||||
xor0=tin0; |
||||
xor1=tin1; |
||||
} |
||||
if (l != -8) |
||||
{ |
||||
n2l(in,tin0); |
||||
n2l(in,tin1); |
||||
tin[0]=tin0; |
||||
tin[1]=tin1; |
||||
BF_encrypt(tin,ks,BF_DECRYPT); |
||||
tout0=tin[0]^xor0; |
||||
tout1=tin[1]^xor1; |
||||
l2nn(tout0,tout1,out,l+8); |
||||
xor0=tin0; |
||||
xor1=tin1; |
||||
} |
||||
l2n(xor0,iv); |
||||
l2n(xor1,iv); |
||||
} |
||||
tin0=tin1=tout0=tout1=xor0=xor1=0; |
||||
tin[0]=tin[1]=0; |
||||
} |
||||
|
@ -1,122 +0,0 @@
|
||||
/* crypto/bf/bf_cfb64.c */ |
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved. |
||||
* |
||||
* This package is an SSL implementation written |
||||
* by Eric Young (eay@mincom.oz.au). |
||||
* The implementation was written so as to conform with Netscapes SSL. |
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as |
||||
* the following conditions are aheared to. The following conditions |
||||
* apply to all code found in this distribution, be it the RC4, RSA, |
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation |
||||
* included with this distribution is covered by the same copyright terms |
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au). |
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in |
||||
* the code are not to be removed. |
||||
* If this package is used in a product, Eric Young should be given attribution |
||||
* as the author of the parts of the library used. |
||||
* This can be in the form of a textual message at program startup or |
||||
* in documentation (online or textual) provided with the package. |
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions |
||||
* are met: |
||||
* 1. Redistributions of source code must retain the copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* 2. Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* 3. All advertising materials mentioning features or use of this software |
||||
* must display the following acknowledgement: |
||||
* "This product includes cryptographic software written by |
||||
* Eric Young (eay@mincom.oz.au)" |
||||
* The word 'cryptographic' can be left out if the rouines from the library |
||||
* being used are not cryptographic related :-). |
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement: |
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)" |
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
* SUCH DAMAGE. |
||||
*
|
||||
* The licence and distribution terms for any publically available version or |
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
* copied and put under another distribution licence |
||||
* [including the GNU Public Licence.] |
||||
*/ |
||||
|
||||
#include "blowfish.h" |
||||
#include "bf_locl.h" |
||||
|
||||
/* The input and output encrypted as though 64bit cfb mode is being
|
||||
* used. The extra state information to record how much of the |
||||
* 64bit block we have used is contained in *num; |
||||
*/ |
||||
|
||||
void BF_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, BF_KEY *schedule, |
||||
unsigned char *ivec, int *num, int encrypt) |
||||
{ |
||||
register BF_LONG v0,v1,t; |
||||
register int n= *num; |
||||
register long l=length; |
||||
BF_LONG ti[2]; |
||||
unsigned char *iv,c,cc; |
||||
|
||||
iv=(unsigned char *)ivec; |
||||
if (encrypt != 0) |
||||
{ |
||||
while (l-- != 0) |
||||
{ |
||||
if (n == 0) |
||||
{ |
||||
n2l(iv,v0); ti[0]=v0; |
||||
n2l(iv,v1); ti[1]=v1; |
||||
BF_encrypt((unsigned long *)ti,schedule,BF_ENCRYPT); |
||||
iv=(unsigned char *)ivec; |
||||
t=ti[0]; l2n(t,iv); |
||||
t=ti[1]; l2n(t,iv); |
||||
iv=(unsigned char *)ivec; |
||||
} |
||||
c= (unsigned char)(*(in++)^iv[n]); |
||||
*(out++)=c; |
||||
iv[n]=c; |
||||
n=(n+1)&0x07; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
while (l-- != 0) |
||||
{ |
||||
if (n == 0) |
||||
{ |
||||
n2l(iv,v0); ti[0]=v0; |
||||
n2l(iv,v1); ti[1]=v1; |
||||
BF_encrypt((unsigned long *)ti,schedule,BF_ENCRYPT); |
||||
iv=(unsigned char *)ivec; |
||||
t=ti[0]; l2n(t,iv); |
||||
t=ti[1]; l2n(t,iv); |
||||
iv=(unsigned char *)ivec; |
||||
} |
||||
cc= *(in++); |
||||
c=iv[n]; |
||||
iv[n]=cc; |
||||
*(out++)=(unsigned char)(c^cc); |
||||
n=(n+1)&0x07; |
||||
} |
||||
} |
||||
v0=v1=ti[0]=ti[1]=t=0; |
||||
c=cc=(unsigned char)0; |
||||
*num=n; |
||||
} |
||||
|
@ -1,91 +0,0 @@
|
||||
/* crypto/bf/bf_ecb.c */ |
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved. |
||||
* |
||||
* This package is an SSL implementation written |
||||
* by Eric Young (eay@mincom.oz.au). |
||||
* The implementation was written so as to conform with Netscapes SSL. |
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as |
||||
* the following conditions are aheared to. The following conditions |
||||
* apply to all code found in this distribution, be it the RC4, RSA, |
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation |
||||
* included with this distribution is covered by the same copyright terms |
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au). |
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in |
||||
* the code are not to be removed. |
||||
* If this package is used in a product, Eric Young should be given attribution |
||||
* as the author of the parts of the library used. |
||||
* This can be in the form of a textual message at program startup or |
||||
* in documentation (online or textual) provided with the package. |
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions |
||||
* are met: |
||||
* 1. Redistributions of source code must retain the copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* 2. Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* 3. All advertising materials mentioning features or use of this software |
||||
* must display the following acknowledgement: |
||||
* "This product includes cryptographic software written by |
||||
* Eric Young (eay@mincom.oz.au)" |
||||
* The word 'cryptographic' can be left out if the rouines from the library |
||||
* being used are not cryptographic related :-). |
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement: |
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)" |
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
* SUCH DAMAGE. |
||||
*
|
||||
* The licence and distribution terms for any publically available version or |
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
* copied and put under another distribution licence |
||||
* [including the GNU Public Licence.] |
||||
*/ |
||||
|
||||
#include "blowfish.h" |
||||
#include "bf_locl.h" |
||||
|
||||
/* Blowfish as implemented from 'Blowfish: Springer-Verlag paper'
|
||||
* (From LECTURE NOTES IN COIMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, |
||||
* CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) |
||||
*/ |
||||
|
||||
char *BF_version="BlowFish part of SSLeay 0.7.0 30-Jan-1997"; |
||||
|
||||
char *BF_options() |
||||
{ |
||||
#ifdef BF_PTR |
||||
return("blowfish(ptr)"); |
||||
#elif defined(BF_PTR2) |
||||
return("blowfish(ptr2)"); |
||||
#else |
||||
return("blowfish(idx)"); |
||||
#endif |
||||
} |
||||
|
||||
void BF_ecb_encrypt(unsigned char *in, unsigned char *out, BF_KEY *ks, int encrypt) |
||||
{ |
||||
BF_LONG l,d[2]; |
||||
|
||||
n2l(in,l); d[0]=l; |
||||
n2l(in,l); d[1]=l; |
||||
BF_encrypt(d,ks,encrypt); |
||||
l=d[0]; l2n(l,out); |
||||
l=d[1]; l2n(l,out); |
||||
l=d[0]=d[1]=0; |
||||
} |
||||
|
@ -1,137 +0,0 @@
|
||||
/* crypto/bf/bf_enc.c */ |
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved. |
||||
* |
||||
* This package is an SSL implementation written |
||||
* by Eric Young (eay@mincom.oz.au). |
||||
* The implementation was written so as to conform with Netscapes SSL. |
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as |
||||
* the following conditions are aheared to. The following conditions |
||||
* apply to all code found in this distribution, be it the RC4, RSA, |
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation |
||||
* included with this distribution is covered by the same copyright terms |
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au). |
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in |
||||
* the code are not to be removed. |
||||
* If this package is used in a product, Eric Young should be given attribution |
||||
* as the author of the parts of the library used. |
||||
* This can be in the form of a textual message at program startup or |
||||
* in documentation (online or textual) provided with the package. |
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions |
||||
* are met: |
||||
* 1. Redistributions of source code must retain the copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* 2. Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* 3. All advertising materials mentioning features or use of this software |
||||
* must display the following acknowledgement: |
||||
* "This product includes cryptographic software written by |
||||
* Eric Young (eay@mincom.oz.au)" |
||||
* The word 'cryptographic' can be left out if the rouines from the library |
||||
* being used are not cryptographic related :-). |
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement: |
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)" |
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
* SUCH DAMAGE. |
||||
*
|
||||
* The licence and distribution terms for any publically available version or |
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
* copied and put under another distribution licence |
||||
* [including the GNU Public Licence.] |
||||
*/ |
||||
|
||||
#include "blowfish.h" |
||||
#include "bf_locl.h" |
||||
|
||||
/* Blowfish as implemented from 'Blowfish: Springer-Verlag paper'
|
||||
* (From LECTURE NOTES IN COIMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, |
||||
* CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) |
||||
*/ |
||||
|
||||
#if (BF_ROUNDS != 16) && (BF_ROUNDS != 20) |
||||
If you set BF_ROUNDS to some value other than 16 or 20, you will have |
||||
to modify the code. |
||||
#endif |
||||
|
||||
void BF_encrypt(BF_LONG *data, BF_KEY *key, int encrypt) |
||||
{ |
||||
register BF_LONG l,r,*p,*s; |
||||
|
||||
p=key->P; |
||||
s= &(key->S[0]); |
||||
l=data[0]; |
||||
r=data[1]; |
||||
|
||||
if (encrypt != 0) |
||||
{ |
||||
l^=p[0]; |
||||
BF_ENC(r,l,s,p[ 1]); |
||||
BF_ENC(l,r,s,p[ 2]); |
||||
BF_ENC(r,l,s,p[ 3]); |
||||
BF_ENC(l,r,s,p[ 4]); |
||||
BF_ENC(r,l,s,p[ 5]); |
||||
BF_ENC(l,r,s,p[ 6]); |
||||
BF_ENC(r,l,s,p[ 7]); |
||||
BF_ENC(l,r,s,p[ 8]); |
||||
BF_ENC(r,l,s,p[ 9]); |
||||
BF_ENC(l,r,s,p[10]); |
||||
BF_ENC(r,l,s,p[11]); |
||||
BF_ENC(l,r,s,p[12]); |
||||
BF_ENC(r,l,s,p[13]); |
||||
BF_ENC(l,r,s,p[14]); |
||||
BF_ENC(r,l,s,p[15]); |
||||
BF_ENC(l,r,s,p[16]); |
||||
#if BF_ROUNDS == 20 |
||||
BF_ENC(r,l,s,p[17]); |
||||
BF_ENC(l,r,s,p[18]); |
||||
BF_ENC(r,l,s,p[19]); |
||||
BF_ENC(l,r,s,p[20]); |
||||
#endif |
||||
r^=p[BF_ROUNDS+1]; |
||||
} |
||||
else |
||||
{ |
||||
l^=p[BF_ROUNDS+1]; |
||||
#if BF_ROUNDS == 20 |
||||
BF_ENC(r,l,s,p[20]); |
||||
BF_ENC(l,r,s,p[19]); |
||||
BF_ENC(r,l,s,p[18]); |
||||
BF_ENC(l,r,s,p[17]); |
||||
#endif |
||||
BF_ENC(r,l,s,p[16]); |
||||
BF_ENC(l,r,s,p[15]); |
||||
BF_ENC(r,l,s,p[14]); |
||||
BF_ENC(l,r,s,p[13]); |
||||
BF_ENC(r,l,s,p[12]); |
||||
BF_ENC(l,r,s,p[11]); |
||||
BF_ENC(r,l,s,p[10]); |
||||
BF_ENC(l,r,s,p[ 9]); |
||||
BF_ENC(r,l,s,p[ 8]); |
||||
BF_ENC(l,r,s,p[ 7]); |
||||
BF_ENC(r,l,s,p[ 6]); |
||||
BF_ENC(l,r,s,p[ 5]); |
||||
BF_ENC(r,l,s,p[ 4]); |
||||
BF_ENC(l,r,s,p[ 3]); |
||||
BF_ENC(r,l,s,p[ 2]); |
||||
BF_ENC(l,r,s,p[ 1]); |
||||
r^=p[0]; |
||||
} |
||||
data[1]=l&0xffffffff; |
||||
data[0]=r&0xffffffff; |
||||
} |
@ -1,236 +0,0 @@
|
||||
/* crypto/bf/bf_local.h */ |
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved. |
||||
* |
||||
* This package is an SSL implementation written |
||||
* by Eric Young (eay@mincom.oz.au). |
||||
* The implementation was written so as to conform with Netscapes SSL. |
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as |
||||
* the following conditions are aheared to. The following conditions |
||||
* apply to all code found in this distribution, be it the RC4, RSA, |
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation |
||||
* included with this distribution is covered by the same copyright terms |
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au). |
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in |
||||
* the code are not to be removed. |
||||
* If this package is used in a product, Eric Young should be given attribution |
||||
* as the author of the parts of the library used. |
||||
* This can be in the form of a textual message at program startup or |
||||
* in documentation (online or textual) provided with the package. |
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions |
||||
* are met: |
||||
* 1. Redistributions of source code must retain the copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* 2. Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* 3. All advertising materials mentioning features or use of this software |
||||
* must display the following acknowledgement: |
||||
* "This product includes cryptographic software written by |
||||
* Eric Young (eay@mincom.oz.au)" |
||||
* The word 'cryptographic' can be left out if the rouines from the library |
||||
* being used are not cryptographic related :-). |
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement: |
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)" |
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
* SUCH DAMAGE. |
||||
*
|
||||
* The licence and distribution terms for any publically available version or |
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
* copied and put under another distribution licence |
||||
* [including the GNU Public Licence.] |
||||
*/ |
||||
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
||||
* |
||||
* Always modify bf_locl.org since bf_locl.h is automatically generated from |
||||
* it during SSLeay configuration. |
||||
* |
||||
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
||||
*/ |
||||
|
||||
/*
|
||||
Notwithstanding the above warning, bf_locl.h is *not* regenerated |
||||
in this stand-alone implementation. The following auto-configuration |
||||
based on compiler CPU identification was added by John Walker to |
||||
avoid having to modify the Makefile to choose the best optimisation |
||||
for an individual platform. |
||||
*/ |
||||
|
||||
#ifdef sparc |
||||
#define BF_PTR |
||||
#endif |
||||
#ifdef mips |
||||
#define BF_PTR |
||||
#endif |
||||
/* In addition, for best performance we should define BF_PTR2 for
|
||||
Pentium and below x86 machines, but not define it for Pentium |
||||
Pro and above. I don't know of any compiler-independent way |
||||
to distinguish these platforms, so I'm leaving the optimisation |
||||
as best for the newer platforms. The actual performance difference |
||||
for this application is trivial in any case. */ |
||||
|
||||
#undef c2l |
||||
#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ |
||||
l|=((unsigned long)(*((c)++)))<< 8L, \
|
||||
l|=((unsigned long)(*((c)++)))<<16L, \
|
||||
l|=((unsigned long)(*((c)++)))<<24L) |
||||
|
||||
/* NOTE - c is not incremented as per c2l */ |
||||
#undef c2ln |
||||
#define c2ln(c,l1,l2,n) { \ |
||||
c+=n; \
|
||||
l1=l2=0; \
|
||||
switch (n) { \
|
||||
case 8: l2 =((unsigned long)(*(--(c))))<<24L; \
|
||||
case 7: l2|=((unsigned long)(*(--(c))))<<16L; \
|
||||
case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \
|
||||
case 5: l2|=((unsigned long)(*(--(c)))); \
|
||||
case 4: l1 =((unsigned long)(*(--(c))))<<24L; \
|
||||
case 3: l1|=((unsigned long)(*(--(c))))<<16L; \
|
||||
case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \
|
||||
case 1: l1|=((unsigned long)(*(--(c)))); \
|
||||
} \
|
||||
} |
||||
|
||||
#undef l2c |
||||
#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ |
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>24L)&0xff)) |
||||
|
||||
/* NOTE - c is not incremented as per l2c */ |
||||
#undef l2cn |
||||
#define l2cn(l1,l2,c,n) { \ |
||||
c+=n; \
|
||||
switch (n) { \
|
||||
case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \
|
||||
case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \
|
||||
case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \
|
||||
case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \
|
||||
case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \
|
||||
case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \
|
||||
case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \
|
||||
case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \
|
||||
} \
|
||||
} |
||||
|
||||
/* NOTE - c is not incremented as per n2l */ |
||||
#define n2ln(c,l1,l2,n) { \ |
||||
c+=n; \
|
||||
l1=l2=0; \
|
||||
switch (n) { \
|
||||
case 8: l2 =((unsigned long)(*(--(c)))) ; \
|
||||
case 7: l2|=((unsigned long)(*(--(c))))<< 8; \
|
||||
case 6: l2|=((unsigned long)(*(--(c))))<<16; \
|
||||
case 5: l2|=((unsigned long)(*(--(c))))<<24; \
|
||||
case 4: l1 =((unsigned long)(*(--(c)))) ; \
|
||||
case 3: l1|=((unsigned long)(*(--(c))))<< 8; \
|
||||
case 2: l1|=((unsigned long)(*(--(c))))<<16; \
|
||||
case 1: l1|=((unsigned long)(*(--(c))))<<24; \
|
||||
} \
|
||||
} |
||||
|
||||
/* NOTE - c is not incremented as per l2n */ |
||||
#define l2nn(l1,l2,c,n) { \ |
||||
c+=n; \
|
||||
switch (n) { \
|
||||
case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \
|
||||
case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \
|
||||
case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \
|
||||
case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \
|
||||
case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \
|
||||
case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \
|
||||
case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \
|
||||
case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \
|
||||
} \
|
||||
} |
||||
|
||||
#undef n2l |
||||
#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ |
||||
l|=((unsigned long)(*((c)++)))<<16L, \
|
||||
l|=((unsigned long)(*((c)++)))<< 8L, \
|
||||
l|=((unsigned long)(*((c)++)))) |
||||
|
||||
#undef l2n |
||||
#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ |
||||
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l) )&0xff)) |
||||
|
||||
/* This is actually a big endian algorithm, the most significate byte
|
||||
* is used to lookup array 0 */ |
||||
|
||||
/* use BF_PTR2 for intel boxes,
|
||||
* BF_PTR for sparc and MIPS/SGI |
||||
* use nothing for Alpha and HP. |
||||
*/ |
||||
#if !defined(BF_PTR) && !defined(BF_PTR2) |
||||
#undef BF_PTR |
||||
#endif |
||||
|
||||
#define BF_M 0x3fc |
||||
#define BF_0 22L |
||||
#define BF_1 14L |
||||
#define BF_2 6L |
||||
#define BF_3 2L /* left shift */ |
||||
|
||||
#if defined(BF_PTR2) |
||||
|
||||
/* This is basically a special pentium verson */ |
||||
#define BF_ENC(LL,R,S,P) \ |
||||
{ \
|
||||
BF_LONG t,u,v; \
|
||||
u=R>>BF_0; \
|
||||
v=R>>BF_1; \
|
||||
u&=BF_M; \
|
||||
v&=BF_M; \
|
||||
t= *(BF_LONG *)((unsigned char *)&(S[ 0])+u); \
|
||||
u=R>>BF_2; \
|
||||
t+= *(BF_LONG *)((unsigned char *)&(S[256])+v); \
|
||||
v=R<<BF_3; \
|
||||
u&=BF_M; \
|
||||
v&=BF_M; \
|
||||
t^= *(BF_LONG *)((unsigned char *)&(S[512])+u); \
|
||||
LL^=P; \
|
||||
t+= *(BF_LONG *)((unsigned char *)&(S[768])+v); \
|
||||
LL^=t; \
|
||||
} |
||||
|
||||
#elif defined(BF_PTR) |
||||
|
||||
/* This is normally very good */ |
||||
|
||||
#define BF_ENC(LL,R,S,P) \ |
||||
LL^=P; \
|
||||
LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \
|
||||
*(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \
|
||||
*(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \
|
||||
*(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M))); |
||||
#else |
||||
|
||||
/* This will always work, even on 64 bit machines and strangly enough,
|
||||
* on the Alpha it is faster than the pointer versions (both 32 and 64 |
||||
* versions of BF_LONG) */ |
||||
|
||||
#define BF_ENC(LL,R,S,P) \ |
||||
LL^=P; \
|
||||
LL^=((( S[ (R>>24L) ] + \
|
||||
S[0x0100+((R>>16L)&0xff)])^ \
|
||||
S[0x0200+((R>> 8L)&0xff)])+ \
|
||||
S[0x0300+((R )&0xff)])&0xffffffff; |
||||
#endif |
@ -1,215 +0,0 @@
|
||||
/* crypto/bf/bf_local.h */ |
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au) |
||||
* All rights reserved. |
||||
* |
||||
* This package is an SSL implementation written |
||||
* by Eric Young (eay@mincom.oz.au). |
||||
* The implementation was written so as to conform with Netscapes SSL. |
||||
* |
||||
* This library is free for commercial and non-commercial use as long as |
||||
* the following conditions are aheared to. The following conditions |
||||
* apply to all code found in this distribution, be it the RC4, RSA, |
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation |
||||
* included with this distribution is covered by the same copyright terms |
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au). |
||||
* |
||||
* Copyright remains Eric Young's, and as such any Copyright notices in |
||||
* the code are not to be removed. |
||||
* If this package is used in a product, Eric Young should be given attribution |
||||
* as the author of the parts of the library used. |
||||
* This can be in the form of a textual message at program startup or |
||||
* in documentation (online or textual) provided with the package. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions |
||||
* are met: |
||||
* 1. Redistributions of source code must retain the copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* 2. Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* 3. All advertising materials mentioning features or use of this software |
||||
* must display the following acknowledgement: |
||||
* "This product includes cryptographic software written by |
||||
* Eric Young (eay@mincom.oz.au)" |
||||
* The word 'cryptographic' can be left out if the rouines from the library |
||||
* being used are not cryptographic related :-). |
||||
* 4. If you include any Windows specific code (or a derivative thereof) from |
||||
* the apps directory (application code) you must include an acknowledgement: |
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)" |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
* SUCH DAMAGE. |
||||
* |
||||
* The licence and distribution terms for any publically available version or |
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
* copied and put under another distribution licence |
||||
* [including the GNU Public Licence.] |
||||
*/ |
||||
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
||||
* |
||||
* Always modify bf_locl.org since bf_locl.h is automatically generated from |
||||
* it during SSLeay configuration. |
||||
* |
||||
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
||||
*/ |
||||
|
||||
#undef c2l |
||||
#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ |
||||
l|=((unsigned long)(*((c)++)))<< 8L, \ |
||||
l|=((unsigned long)(*((c)++)))<<16L, \ |
||||
l|=((unsigned long)(*((c)++)))<<24L) |
||||
|
||||
/* NOTE - c is not incremented as per c2l */ |
||||
#undef c2ln |
||||
#define c2ln(c,l1,l2,n) { \ |
||||
c+=n; \ |
||||
l1=l2=0; \ |
||||
switch (n) { \ |
||||
case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ |
||||
case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ |
||||
case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ |
||||
case 5: l2|=((unsigned long)(*(--(c)))); \ |
||||
case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ |
||||
case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ |
||||
case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ |
||||
case 1: l1|=((unsigned long)(*(--(c)))); \ |
||||
} \ |
||||
} |
||||
|
||||
#undef l2c |
||||
#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ |
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ |
||||
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \ |
||||
*((c)++)=(unsigned char)(((l)>>24L)&0xff)) |
||||
|
||||
/* NOTE - c is not incremented as per l2c */ |
||||
#undef l2cn |
||||
#define l2cn(l1,l2,c,n) { \ |
||||
c+=n; \ |
||||
switch (n) { \ |
||||
case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ |
||||
case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ |
||||
case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ |
||||
case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ |
||||
case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ |
||||
case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ |
||||
case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ |
||||
case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ |
||||
} \ |
||||
} |
||||
|
||||
/* NOTE - c is not incremented as per n2l */ |
||||
#define n2ln(c,l1,l2,n) { \ |
||||
c+=n; \ |
||||
l1=l2=0; \ |
||||
switch (n) { \ |
||||
case 8: l2 =((unsigned long)(*(--(c)))) ; \ |
||||
case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ |
||||
case 6: l2|=((unsigned long)(*(--(c))))<<16; \ |
||||
case 5: l2|=((unsigned long)(*(--(c))))<<24; \ |
||||
case 4: l1 =((unsigned long)(*(--(c)))) ; \ |
||||
case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ |
||||
case 2: l1|=((unsigned long)(*(--(c))))<<16; \ |
||||
case 1: l1|=((unsigned long)(*(--(c))))<<24; \ |
||||
} \ |
||||
} |
||||
|
||||
/* NOTE - c is not incremented as per l2n */ |
||||
#define l2nn(l1,l2,c,n) { \ |
||||
c+=n; \ |
||||
switch (n) { \ |
||||
case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ |
||||
case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ |
||||
case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ |
||||
case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ |
||||
case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ |
||||
case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ |
||||
case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ |
||||
case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ |
||||
} \ |
||||
} |
||||
|
||||
#undef n2l |
||||
#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ |
||||
l|=((unsigned long)(*((c)++)))<<16L, \ |
||||
l|=((unsigned long)(*((c)++)))<< 8L, \ |
||||
l|=((unsigned long)(*((c)++)))) |
||||
|
||||
#undef l2n |
||||
#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ |
||||
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \ |
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ |
||||
*((c)++)=(unsigned char)(((l) )&0xff)) |
||||
|
||||
/* This is actually a big endian algorithm, the most significate byte |
||||
* is used to lookup array 0 */ |
||||
|
||||
/* use BF_PTR2 for intel boxes, |
||||
* BF_PTR for sparc and MIPS/SGI |
||||
* use nothing for Alpha and HP. |
||||
*/ |
||||
#if !defined(BF_PTR) && !defined(BF_PTR2) |
||||
#undef BF_PTR |
||||
#endif |
||||
|
||||
#define BF_M 0x3fc |
||||
#define BF_0 22L |
||||
#define BF_1 14L |
||||
#define BF_2 6L |
||||
#define BF_3 2L /* left shift */ |
||||
|
||||
#if defined(BF_PTR2) |
||||
|
||||
/* This is basically a special pentium verson */ |
||||
#define BF_ENC(LL,R,S,P) \ |
||||
{ \ |
||||
BF_LONG t,u,v; \ |
||||
u=R>>BF_0; \ |
||||
v=R>>BF_1; \ |
||||
u&=BF_M; \ |
||||
v&=BF_M; \ |
||||
t= *(BF_LONG *)((unsigned char *)&(S[ 0])+u); \ |
||||
u=R>>BF_2; \ |
||||
t+= *(BF_LONG *)((unsigned char *)&(S[256])+v); \ |
||||
v=R<<BF_3; \ |
||||
u&=BF_M; \ |
||||
v&=BF_M; \ |
||||
t^= *(BF_LONG *)((unsigned char *)&(S[512])+u); \ |
||||
LL^=P; \ |
||||
t+= *(BF_LONG *)((unsigned char *)&(S[768])+v); \ |
||||
LL^=t; \ |
||||
} |
||||
|
||||
#elif defined(BF_PTR) |
||||
|
||||
/* This is normally very good */ |
||||
|
||||
#define BF_ENC(LL,R,S,P) \ |
||||
LL^=P; \ |
||||
LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \ |
||||
*(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \ |
||||
*(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \ |
||||
*(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M))); |
||||
#else |
||||
|
||||
/* This will always work, even on 64 bit machines and strangly enough, |
||||
* on the Alpha it is faster than the pointer versions (both 32 and 64 |
||||
* versions of BF_LONG) */ |
||||
|
||||
#define BF_ENC(LL,R,S,P) \ |
||||
LL^=P; \ |
||||
LL^=((( S[ (R>>24L) ] + \ |
||||
S[0x0100+((R>>16L)&0xff)])^ \ |
||||
S[0x0200+((R>> 8L)&0xff)])+ \ |
||||
S[0x0300+((R )&0xff)])&0xffffffff; |
||||
#endif |
@ -1,110 +0,0 @@
|
||||
/* crypto/bf/bf_ofb64.c */ |
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved. |
||||
* |
||||
* This package is an SSL implementation written |
||||
* by Eric Young (eay@mincom.oz.au). |
||||
* The implementation was written so as to conform with Netscapes SSL. |
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as |
||||
* the following conditions are aheared to. The following conditions |
||||
* apply to all code found in this distribution, be it the RC4, RSA, |
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation |
||||
* included with this distribution is covered by the same copyright terms |
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au). |
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in |
||||
* the code are not to be removed. |
||||
* If this package is used in a product, Eric Young should be given attribution |
||||
* as the author of the parts of the library used. |
||||
* This can be in the form of a textual message at program startup or |
||||
* in documentation (online or textual) provided with the package. |
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions |
||||
* are met: |
||||
* 1. Redistributions of source code must retain the copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* 2. Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* 3. All advertising materials mentioning features or use of this software |
||||
* must display the following acknowledgement: |
||||
* "This product includes cryptographic software written by |
||||
* Eric Young (eay@mincom.oz.au)" |
||||
* The word 'cryptographic' can be left out if the rouines from the library |
||||
* being used are not cryptographic related :-). |
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement: |
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)" |
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
* SUCH DAMAGE. |
||||
*
|
||||
* The licence and distribution terms for any publically available version or |
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
* copied and put under another distribution licence |
||||
* [including the GNU Public Licence.] |
||||
*/ |
||||
|
||||
#include "blowfish.h" |
||||
#include "bf_locl.h" |
||||
|
||||
/* The input and output encrypted as though 64bit ofb mode is being
|
||||
* used. The extra state information to record how much of the |
||||
* 64bit block we have used is contained in *num; |
||||
*/ |
||||
void BF_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, BF_KEY *schedule, |
||||
unsigned char *ivec, int *num) |
||||
{ |
||||
register unsigned long v0,v1,t; |
||||
register int n= *num; |
||||
register long l=length; |
||||
unsigned char d[8]; |
||||
register unsigned char *dp; |
||||
unsigned long ti[2]; |
||||
unsigned char *iv; |
||||
int save=0; |
||||
|
||||
iv=(unsigned char *)ivec; |
||||
n2l(iv,v0); |
||||
n2l(iv,v1); |
||||
ti[0]=v0; |
||||
ti[1]=v1; |
||||
dp=(unsigned char *)d; |
||||
l2n(v0,dp); |
||||
l2n(v1,dp); |
||||
while (l-- != 0) |
||||
{ |
||||
if (n == 0) |
||||
{ |
||||
BF_encrypt((unsigned long *)ti,schedule,BF_ENCRYPT); |
||||
dp=(unsigned char *)d; |
||||
t=ti[0]; l2n(t,dp); |
||||
t=ti[1]; l2n(t,dp); |
||||
save++; |
||||
} |
||||
*(out++)= (unsigned char)(*(in++)^d[n]); |
||||
n=(n+1)&0x07; |
||||
} |
||||
if (save != 0) |
||||
{ |
||||
v0=ti[0]; |
||||
v1=ti[1]; |
||||
iv=(unsigned char *)ivec; |
||||
l2n(v0,iv); |
||||
l2n(v1,iv); |
||||
} |
||||
t=v0=v1=ti[0]=ti[1]=0; |
||||
*num=n; |
||||
} |
||||
|
@ -1,325 +0,0 @@
|
||||
/* crypto/bf/bf_pi.h */ |
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved. |
||||
* |
||||
* This package is an SSL implementation written |
||||
* by Eric Young (eay@mincom.oz.au). |
||||
* The implementation was written so as to conform with Netscapes SSL. |
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as |
||||
* the following conditions are aheared to. The following conditions |
||||
* apply to all code found in this distribution, be it the RC4, RSA, |
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation |
||||
* included with this distribution is covered by the same copyright terms |
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au). |
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in |
||||
* the code are not to be removed. |
||||
* If this package is used in a product, Eric Young should be given attribution |
||||
* as the author of the parts of the library used. |
||||
* This can be in the form of a textual message at program startup or |
||||
* in documentation (online or textual) provided with the package. |
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions |
||||
* are met: |
||||
* 1. Redistributions of source code must retain the copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* 2. Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* 3. All advertising materials mentioning features or use of this software |
||||
* must display the following acknowledgement: |
||||
* "This product includes cryptographic software written by |
||||
* Eric Young (eay@mincom.oz.au)" |
||||
* The word 'cryptographic' can be left out if the rouines from the library |
||||
* being used are not cryptographic related :-). |
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement: |
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)" |
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
* SUCH DAMAGE. |
||||
*
|
||||
* The licence and distribution terms for any publically available version or |
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
* copied and put under another distribution licence |
||||
* [including the GNU Public Licence.] |
||||
*/ |
||||
|
||||
static BF_KEY bf_init= { |
||||
{ |
||||
0x243f6a88UL, 0x85a308d3UL, 0x13198a2eUL, 0x03707344UL, |
||||
0xa4093822UL, 0x299f31d0UL, 0x082efa98UL, 0xec4e6c89UL, |
||||
0x452821e6UL, 0x38d01377UL, 0xbe5466cfUL, 0x34e90c6cUL, |
||||
0xc0ac29b7UL, 0xc97c50ddUL, 0x3f84d5b5UL, 0xb5470917UL, |
||||
0x9216d5d9UL, 0x8979fb1bUL |
||||
},{ |
||||
0xd1310ba6UL, 0x98dfb5acUL, 0x2ffd72dbUL, 0xd01adfb7UL,
|
||||
0xb8e1afedUL, 0x6a267e96UL, 0xba7c9045UL, 0xf12c7f99UL,
|
||||
0x24a19947UL, 0xb3916cf7UL, 0x0801f2e2UL, 0x858efc16UL,
|
||||
0x636920d8UL, 0x71574e69UL, 0xa458fea3UL, 0xf4933d7eUL,
|
||||
0x0d95748fUL, 0x728eb658UL, 0x718bcd58UL, 0x82154aeeUL,
|
||||
0x7b54a41dUL, 0xc25a59b5UL, 0x9c30d539UL, 0x2af26013UL,
|
||||
0xc5d1b023UL, 0x286085f0UL, 0xca417918UL, 0xb8db38efUL,
|
||||
0x8e79dcb0UL, 0x603a180eUL, 0x6c9e0e8bUL, 0xb01e8a3eUL,
|
||||
0xd71577c1UL, 0xbd314b27UL, 0x78af2fdaUL, 0x55605c60UL,
|
||||
0xe65525f3UL, 0xaa55ab94UL, 0x57489862UL, 0x63e81440UL,
|
||||
0x55ca396aUL, 0x2aab10b6UL, 0xb4cc5c34UL, 0x1141e8ceUL,
|
||||
0xa15486afUL, 0x7c72e993UL, 0xb3ee1411UL, 0x636fbc2aUL,
|
||||
0x2ba9c55dUL, 0x741831f6UL, 0xce5c3e16UL, 0x9b87931eUL,
|
||||
0xafd6ba33UL, 0x6c24cf5cUL, 0x7a325381UL, 0x28958677UL,
|
||||
0x3b8f4898UL, 0x6b4bb9afUL, 0xc4bfe81bUL, 0x66282193UL,
|
||||
0x61d809ccUL, 0xfb21a991UL, 0x487cac60UL, 0x5dec8032UL,
|
||||
0xef845d5dUL, 0xe98575b1UL, 0xdc262302UL, 0xeb651b88UL,
|
||||
0x23893e81UL, 0xd396acc5UL, 0x0f6d6ff3UL, 0x83f44239UL,
|
||||
0x2e0b4482UL, 0xa4842004UL, 0x69c8f04aUL, 0x9e1f9b5eUL,
|
||||
0x21c66842UL, 0xf6e96c9aUL, 0x670c9c61UL, 0xabd388f0UL,
|
||||
0x6a51a0d2UL, 0xd8542f68UL, 0x960fa728UL, 0xab5133a3UL,
|
||||
0x6eef0b6cUL, 0x137a3be4UL, 0xba3bf050UL, 0x7efb2a98UL,
|
||||
0xa1f1651dUL, 0x39af0176UL, 0x66ca593eUL, 0x82430e88UL,
|
||||
0x8cee8619UL, 0x456f9fb4UL, 0x7d84a5c3UL, 0x3b8b5ebeUL,
|
||||
0xe06f75d8UL, 0x85c12073UL, 0x401a449fUL, 0x56c16aa6UL,
|
||||
0x4ed3aa62UL, 0x363f7706UL, 0x1bfedf72UL, 0x429b023dUL,
|
||||
0x37d0d724UL, 0xd00a1248UL, 0xdb0fead3UL, 0x49f1c09bUL,
|
||||
0x075372c9UL, 0x80991b7bUL, 0x25d479d8UL, 0xf6e8def7UL,
|
||||
0xe3fe501aUL, 0xb6794c3bUL, 0x976ce0bdUL, 0x04c006baUL,
|
||||
0xc1a94fb6UL, 0x409f60c4UL, 0x5e5c9ec2UL, 0x196a2463UL,
|
||||
0x68fb6fafUL, 0x3e6c53b5UL, 0x1339b2ebUL, 0x3b52ec6fUL,
|
||||
0x6dfc511fUL, 0x9b30952cUL, 0xcc814544UL, 0xaf5ebd09UL,
|
||||
0xbee3d004UL, 0xde334afdUL, 0x660f2807UL, 0x192e4bb3UL,
|
||||
0xc0cba857UL, 0x45c8740fUL, 0xd20b5f39UL, 0xb9d3fbdbUL,
|
||||
0x5579c0bdUL, 0x1a60320aUL, 0xd6a100c6UL, 0x402c7279UL,
|
||||
0x679f25feUL, 0xfb1fa3ccUL, 0x8ea5e9f8UL, 0xdb3222f8UL,
|
||||
0x3c7516dfUL, 0xfd616b15UL, 0x2f501ec8UL, 0xad0552abUL,
|
||||
0x323db5faUL, 0xfd238760UL, 0x53317b48UL, 0x3e00df82UL,
|
||||
0x9e5c57bbUL, 0xca6f8ca0UL, 0x1a87562eUL, 0xdf1769dbUL,
|
||||
0xd542a8f6UL, 0x287effc3UL, 0xac6732c6UL, 0x8c4f5573UL,
|
||||
0x695b27b0UL, 0xbbca58c8UL, 0xe1ffa35dUL, 0xb8f011a0UL,
|
||||
0x10fa3d98UL, 0xfd2183b8UL, 0x4afcb56cUL, 0x2dd1d35bUL,
|
||||
0x9a53e479UL, 0xb6f84565UL, 0xd28e49bcUL, 0x4bfb9790UL,
|
||||
0xe1ddf2daUL, 0xa4cb7e33UL, 0x62fb1341UL, 0xcee4c6e8UL,
|
||||
0xef20cadaUL, 0x36774c01UL, 0xd07e9efeUL, 0x2bf11fb4UL,
|
||||
0x95dbda4dUL, 0xae909198UL, 0xeaad8e71UL, 0x6b93d5a0UL,
|
||||
0xd08ed1d0UL, 0xafc725e0UL, 0x8e3c5b2fUL, 0x8e7594b7UL,
|
||||
0x8ff6e2fbUL, 0xf2122b64UL, 0x8888b812UL, 0x900df01cUL,
|
||||
0x4fad5ea0UL, 0x688fc31cUL, 0xd1cff191UL, 0xb3a8c1adUL,
|
||||
0x2f2f2218UL, 0xbe0e1777UL, 0xea752dfeUL, 0x8b021fa1UL,
|
||||
0xe5a0cc0fUL, 0xb56f74e8UL, 0x18acf3d6UL, 0xce89e299UL,
|
||||
0xb4a84fe0UL, 0xfd13e0b7UL, 0x7cc43b81UL, 0xd2ada8d9UL,
|
||||
0x165fa266UL, 0x80957705UL, 0x93cc7314UL, 0x211a1477UL,
|
||||
0xe6ad2065UL, 0x77b5fa86UL, 0xc75442f5UL, 0xfb9d35cfUL,
|
||||
0xebcdaf0cUL, 0x7b3e89a0UL, 0xd6411bd3UL, 0xae1e7e49UL,
|
||||
0x00250e2dUL, 0x2071b35eUL, 0x226800bbUL, 0x57b8e0afUL,
|
||||
0x2464369bUL, 0xf009b91eUL, 0x5563911dUL, 0x59dfa6aaUL,
|
||||
0x78c14389UL, 0xd95a537fUL, 0x207d5ba2UL, 0x02e5b9c5UL,
|
||||
0x83260376UL, 0x6295cfa9UL, 0x11c81968UL, 0x4e734a41UL,
|
||||
0xb3472dcaUL, 0x7b14a94aUL, 0x1b510052UL, 0x9a532915UL,
|
||||
0xd60f573fUL, 0xbc9bc6e4UL, 0x2b60a476UL, 0x81e67400UL,
|
||||
0x08ba6fb5UL, 0x571be91fUL, 0xf296ec6bUL, 0x2a0dd915UL,
|
||||
0xb6636521UL, 0xe7b9f9b6UL, 0xff34052eUL, 0xc5855664UL,
|
||||
0x53b02d5dUL, 0xa99f8fa1UL, 0x08ba4799UL, 0x6e85076aUL,
|
||||
0x4b7a70e9UL, 0xb5b32944UL, 0xdb75092eUL, 0xc4192623UL,
|
||||
0xad6ea6b0UL, 0x49a7df7dUL, 0x9cee60b8UL, 0x8fedb266UL,
|
||||
0xecaa8c71UL, 0x699a17ffUL, 0x5664526cUL, 0xc2b19ee1UL,
|
||||
0x193602a5UL, 0x75094c29UL, 0xa0591340UL, 0xe4183a3eUL,
|
||||
0x3f54989aUL, 0x5b429d65UL, 0x6b8fe4d6UL, 0x99f73fd6UL,
|
||||
0xa1d29c07UL, 0xefe830f5UL, 0x4d2d38e6UL, 0xf0255dc1UL,
|
||||
0x4cdd2086UL, 0x8470eb26UL, 0x6382e9c6UL, 0x021ecc5eUL,
|
||||
0x09686b3fUL, 0x3ebaefc9UL, 0x3c971814UL, 0x6b6a70a1UL,
|
||||
0x687f3584UL, 0x52a0e286UL, 0xb79c5305UL, 0xaa500737UL,
|
||||
0x3e07841cUL, 0x7fdeae5cUL, 0x8e7d44ecUL, 0x5716f2b8UL,
|
||||
0xb03ada37UL, 0xf0500c0dUL, 0xf01c1f04UL, 0x0200b3ffUL,
|
||||
0xae0cf51aUL, 0x3cb574b2UL, 0x25837a58UL, 0xdc0921bdUL,
|
||||
0xd19113f9UL, 0x7ca92ff6UL, 0x94324773UL, 0x22f54701UL,
|
||||
0x3ae5e581UL, 0x37c2dadcUL, 0xc8b57634UL, 0x9af3dda7UL,
|
||||
0xa9446146UL, 0x0fd0030eUL, 0xecc8c73eUL, 0xa4751e41UL,
|
||||
0xe238cd99UL, 0x3bea0e2fUL, 0x3280bba1UL, 0x183eb331UL,
|
||||
0x4e548b38UL, 0x4f6db908UL, 0x6f420d03UL, 0xf60a04bfUL,
|
||||
0x2cb81290UL, 0x24977c79UL, 0x5679b072UL, 0xbcaf89afUL,
|
||||
0xde9a771fUL, 0xd9930810UL, 0xb38bae12UL, 0xdccf3f2eUL,
|
||||
0x5512721fUL, 0x2e6b7124UL, 0x501adde6UL, 0x9f84cd87UL,
|
||||
0x7a584718UL, 0x7408da17UL, 0xbc9f9abcUL, 0xe94b7d8cUL,
|
||||
0xec7aec3aUL, 0xdb851dfaUL, 0x63094366UL, 0xc464c3d2UL,
|
||||
0xef1c1847UL, 0x3215d908UL, 0xdd433b37UL, 0x24c2ba16UL,
|
||||
0x12a14d43UL, 0x2a65c451UL, 0x50940002UL, 0x133ae4ddUL,
|
||||
0x71dff89eUL, 0x10314e55UL, 0x81ac77d6UL, 0x5f11199bUL,
|
||||
0x043556f1UL, 0xd7a3c76bUL, 0x3c11183bUL, 0x5924a509UL,
|
||||
0xf28fe6edUL, 0x97f1fbfaUL, 0x9ebabf2cUL, 0x1e153c6eUL,
|
||||
0x86e34570UL, 0xeae96fb1UL, 0x860e5e0aUL, 0x5a3e2ab3UL,
|
||||
0x771fe71cUL, 0x4e3d06faUL, 0x2965dcb9UL, 0x99e71d0fUL,
|
||||
0x803e89d6UL, 0x5266c825UL, 0x2e4cc978UL, 0x9c10b36aUL,
|
||||
0xc6150ebaUL, 0x94e2ea78UL, 0xa5fc3c53UL, 0x1e0a2df4UL,
|
||||
0xf2f74ea7UL, 0x361d2b3dUL, 0x1939260fUL, 0x19c27960UL,
|
||||
0x5223a708UL, 0xf71312b6UL, 0xebadfe6eUL, 0xeac31f66UL,
|
||||
0xe3bc4595UL, 0xa67bc883UL, 0xb17f37d1UL, 0x018cff28UL,
|
||||
0xc332ddefUL, 0xbe6c5aa5UL, 0x65582185UL, 0x68ab9802UL,
|
||||
0xeecea50fUL, 0xdb2f953bUL, 0x2aef7dadUL, 0x5b6e2f84UL,
|
||||
0x1521b628UL, 0x29076170UL, 0xecdd4775UL, 0x619f1510UL,
|
||||
0x13cca830UL, 0xeb61bd96UL, 0x0334fe1eUL, 0xaa0363cfUL,
|
||||
0xb5735c90UL, 0x4c70a239UL, 0xd59e9e0bUL, 0xcbaade14UL,
|
||||
0xeecc86bcUL, 0x60622ca7UL, 0x9cab5cabUL, 0xb2f3846eUL,
|
||||
0x648b1eafUL, 0x19bdf0caUL, 0xa02369b9UL, 0x655abb50UL,
|
||||
0x40685a32UL, 0x3c2ab4b3UL, 0x319ee9d5UL, 0xc021b8f7UL,
|
||||
0x9b540b19UL, 0x875fa099UL, 0x95f7997eUL, 0x623d7da8UL,
|
||||
0xf837889aUL, 0x97e32d77UL, 0x11ed935fUL, 0x16681281UL,
|
||||
0x0e358829UL, 0xc7e61fd6UL, 0x96dedfa1UL, 0x7858ba99UL,
|
||||
0x57f584a5UL, 0x1b227263UL, 0x9b83c3ffUL, 0x1ac24696UL,
|
||||
0xcdb30aebUL, 0x532e3054UL, 0x8fd948e4UL, 0x6dbc3128UL,
|
||||
0x58ebf2efUL, 0x34c6ffeaUL, 0xfe28ed61UL, 0xee7c3c73UL,
|
||||
0x5d4a14d9UL, 0xe864b7e3UL, 0x42105d14UL, 0x203e13e0UL,
|
||||
0x45eee2b6UL, 0xa3aaabeaUL, 0xdb6c4f15UL, 0xfacb4fd0UL,
|
||||
0xc742f442UL, 0xef6abbb5UL, 0x654f3b1dUL, 0x41cd2105UL,
|
||||
0xd81e799eUL, 0x86854dc7UL, 0xe44b476aUL, 0x3d816250UL,
|
||||
0xcf62a1f2UL, 0x5b8d2646UL, 0xfc8883a0UL, 0xc1c7b6a3UL,
|
||||
0x7f1524c3UL, 0x69cb7492UL, 0x47848a0bUL, 0x5692b285UL,
|
||||
0x095bbf00UL, 0xad19489dUL, 0x1462b174UL, 0x23820e00UL,
|
||||
0x58428d2aUL, 0x0c55f5eaUL, 0x1dadf43eUL, 0x233f7061UL,
|
||||
0x3372f092UL, 0x8d937e41UL, 0xd65fecf1UL, 0x6c223bdbUL,
|
||||
0x7cde3759UL, 0xcbee7460UL, 0x4085f2a7UL, 0xce77326eUL,
|
||||
0xa6078084UL, 0x19f8509eUL, 0xe8efd855UL, 0x61d99735UL,
|
||||
0xa969a7aaUL, 0xc50c06c2UL, 0x5a04abfcUL, 0x800bcadcUL,
|
||||
0x9e447a2eUL, 0xc3453484UL, 0xfdd56705UL, 0x0e1e9ec9UL,
|
||||
0xdb73dbd3UL, 0x105588cdUL, 0x675fda79UL, 0xe3674340UL,
|
||||
0xc5c43465UL, 0x713e38d8UL, 0x3d28f89eUL, 0xf16dff20UL,
|
||||
0x153e21e7UL, 0x8fb03d4aUL, 0xe6e39f2bUL, 0xdb83adf7UL,
|
||||
0xe93d5a68UL, 0x948140f7UL, 0xf64c261cUL, 0x94692934UL,
|
||||
0x411520f7UL, 0x7602d4f7UL, 0xbcf46b2eUL, 0xd4a20068UL,
|
||||
0xd4082471UL, 0x3320f46aUL, 0x43b7d4b7UL, 0x500061afUL,
|
||||
0x1e39f62eUL, 0x97244546UL, 0x14214f74UL, 0xbf8b8840UL,
|
||||
0x4d95fc1dUL, 0x96b591afUL, 0x70f4ddd3UL, 0x66a02f45UL,
|
||||
0xbfbc09ecUL, 0x03bd9785UL, 0x7fac6dd0UL, 0x31cb8504UL,
|
||||
0x96eb27b3UL, 0x55fd3941UL, 0xda2547e6UL, 0xabca0a9aUL,
|
||||
0x28507825UL, 0x530429f4UL, 0x0a2c86daUL, 0xe9b66dfbUL,
|
||||
0x68dc1462UL, 0xd7486900UL, 0x680ec0a4UL, 0x27a18deeUL,
|
||||
0x4f3ffea2UL, 0xe887ad8cUL, 0xb58ce006UL, 0x7af4d6b6UL,
|
||||
0xaace1e7cUL, 0xd3375fecUL, 0xce78a399UL, 0x406b2a42UL,
|
||||
0x20fe9e35UL, 0xd9f385b9UL, 0xee39d7abUL, 0x3b124e8bUL,
|
||||
0x1dc9faf7UL, 0x4b6d1856UL, 0x26a36631UL, 0xeae397b2UL,
|
||||
0x3a6efa74UL, 0xdd5b4332UL, 0x6841e7f7UL, 0xca7820fbUL,
|
||||
0xfb0af54eUL, 0xd8feb397UL, 0x454056acUL, 0xba489527UL,
|
||||
0x55533a3aUL, 0x20838d87UL, 0xfe6ba9b7UL, 0xd096954bUL,
|
||||
0x55a867bcUL, 0xa1159a58UL, 0xcca92963UL, 0x99e1db33UL,
|
||||
0xa62a4a56UL, 0x3f3125f9UL, 0x5ef47e1cUL, 0x9029317cUL,
|
||||
0xfdf8e802UL, 0x04272f70UL, 0x80bb155cUL, 0x05282ce3UL,
|
||||
0x95c11548UL, 0xe4c66d22UL, 0x48c1133fUL, 0xc70f86dcUL,
|
||||
0x07f9c9eeUL, 0x41041f0fUL, 0x404779a4UL, 0x5d886e17UL,
|
||||
0x325f51ebUL, 0xd59bc0d1UL, 0xf2bcc18fUL, 0x41113564UL,
|
||||
0x257b7834UL, 0x602a9c60UL, 0xdff8e8a3UL, 0x1f636c1bUL,
|
||||
0x0e12b4c2UL, 0x02e1329eUL, 0xaf664fd1UL, 0xcad18115UL,
|
||||
0x6b2395e0UL, 0x333e92e1UL, 0x3b240b62UL, 0xeebeb922UL,
|
||||
0x85b2a20eUL, 0xe6ba0d99UL, 0xde720c8cUL, 0x2da2f728UL,
|
||||
0xd0127845UL, 0x95b794fdUL, 0x647d0862UL, 0xe7ccf5f0UL,
|
||||
0x5449a36fUL, 0x877d48faUL, 0xc39dfd27UL, 0xf33e8d1eUL,
|
||||
0x0a476341UL, 0x992eff74UL, 0x3a6f6eabUL, 0xf4f8fd37UL,
|
||||
0xa812dc60UL, 0xa1ebddf8UL, 0x991be14cUL, 0xdb6e6b0dUL,
|
||||
0xc67b5510UL, 0x6d672c37UL, 0x2765d43bUL, 0xdcd0e804UL,
|
||||
0xf1290dc7UL, 0xcc00ffa3UL, 0xb5390f92UL, 0x690fed0bUL,
|
||||
0x667b9ffbUL, 0xcedb7d9cUL, 0xa091cf0bUL, 0xd9155ea3UL,
|
||||
0xbb132f88UL, 0x515bad24UL, 0x7b9479bfUL, 0x763bd6ebUL,
|
||||
0x37392eb3UL, 0xcc115979UL, 0x8026e297UL, 0xf42e312dUL,
|
||||
0x6842ada7UL, 0xc66a2b3bUL, 0x12754cccUL, 0x782ef11cUL,
|
||||
0x6a124237UL, 0xb79251e7UL, 0x06a1bbe6UL, 0x4bfb6350UL,
|
||||
0x1a6b1018UL, 0x11caedfaUL, 0x3d25bdd8UL, 0xe2e1c3c9UL,
|
||||
0x44421659UL, 0x0a121386UL, 0xd90cec6eUL, 0xd5abea2aUL,
|
||||
0x64af674eUL, 0xda86a85fUL, 0xbebfe988UL, 0x64e4c3feUL,
|
||||
0x9dbc8057UL, 0xf0f7c086UL, 0x60787bf8UL, 0x6003604dUL,
|
||||
0xd1fd8346UL, 0xf6381fb0UL, 0x7745ae04UL, 0xd736fcccUL,
|
||||
0x83426b33UL, 0xf01eab71UL, 0xb0804187UL, 0x3c005e5fUL,
|
||||
0x77a057beUL, 0xbde8ae24UL, 0x55464299UL, 0xbf582e61UL,
|
||||
0x4e58f48fUL, 0xf2ddfda2UL, 0xf474ef38UL, 0x8789bdc2UL,
|
||||
0x5366f9c3UL, 0xc8b38e74UL, 0xb475f255UL, 0x46fcd9b9UL,
|
||||
0x7aeb2661UL, 0x8b1ddf84UL, 0x846a0e79UL, 0x915f95e2UL,
|
||||
0x466e598eUL, 0x20b45770UL, 0x8cd55591UL, 0xc902de4cUL,
|
||||
0xb90bace1UL, 0xbb8205d0UL, 0x11a86248UL, 0x7574a99eUL,
|
||||
0xb77f19b6UL, 0xe0a9dc09UL, 0x662d09a1UL, 0xc4324633UL,
|
||||
0xe85a1f02UL, 0x09f0be8cUL, 0x4a99a025UL, 0x1d6efe10UL,
|
||||
0x1ab93d1dUL, 0x0ba5a4dfUL, 0xa186f20fUL, 0x2868f169UL,
|
||||
0xdcb7da83UL, 0x573906feUL, 0xa1e2ce9bUL, 0x4fcd7f52UL,
|
||||
0x50115e01UL, 0xa70683faUL, 0xa002b5c4UL, 0x0de6d027UL,
|
||||
0x9af88c27UL, 0x773f8641UL, 0xc3604c06UL, 0x61a806b5UL,
|
||||
0xf0177a28UL, 0xc0f586e0UL, 0x006058aaUL, 0x30dc7d62UL,
|
||||
0x11e69ed7UL, 0x2338ea63UL, 0x53c2dd94UL, 0xc2c21634UL,
|
||||
0xbbcbee56UL, 0x90bcb6deUL, 0xebfc7da1UL, 0xce591d76UL,
|
||||
0x6f05e409UL, 0x4b7c0188UL, 0x39720a3dUL, 0x7c927c24UL,
|
||||
0x86e3725fUL, 0x724d9db9UL, 0x1ac15bb4UL, 0xd39eb8fcUL,
|
||||
0xed545578UL, 0x08fca5b5UL, 0xd83d7cd3UL, 0x4dad0fc4UL,
|
||||
0x1e50ef5eUL, 0xb161e6f8UL, 0xa28514d9UL, 0x6c51133cUL,
|
||||
0x6fd5c7e7UL, 0x56e14ec4UL, 0x362abfceUL, 0xddc6c837UL,
|
||||
0xd79a3234UL, 0x92638212UL, 0x670efa8eUL, 0x406000e0UL,
|
||||
0x3a39ce37UL, 0xd3faf5cfUL, 0xabc27737UL, 0x5ac52d1bUL,
|
||||
0x5cb0679eUL, 0x4fa33742UL, 0xd3822740UL, 0x99bc9bbeUL,
|
||||
0xd5118e9dUL, 0xbf0f7315UL, 0xd62d1c7eUL, 0xc700c47bUL,
|
||||
0xb78c1b6bUL, 0x21a19045UL, 0xb26eb1beUL, 0x6a366eb4UL,
|
||||
0x5748ab2fUL, 0xbc946e79UL, 0xc6a376d2UL, 0x6549c2c8UL,
|
||||
0x530ff8eeUL, 0x468dde7dUL, 0xd5730a1dUL, 0x4cd04dc6UL,
|
||||
0x2939bbdbUL, 0xa9ba4650UL, 0xac9526e8UL, 0xbe5ee304UL,
|
||||
0xa1fad5f0UL, 0x6a2d519aUL, 0x63ef8ce2UL, 0x9a86ee22UL,
|
||||
0xc089c2b8UL, 0x43242ef6UL, 0xa51e03aaUL, 0x9cf2d0a4UL,
|
||||
0x83c061baUL, 0x9be96a4dUL, 0x8fe51550UL, 0xba645bd6UL,
|
||||
0x2826a2f9UL, 0xa73a3ae1UL, 0x4ba99586UL, 0xef5562e9UL,
|
||||
0xc72fefd3UL, 0xf752f7daUL, 0x3f046f69UL, 0x77fa0a59UL,
|
||||
0x80e4a915UL, 0x87b08601UL, 0x9b09e6adUL, 0x3b3ee593UL,
|
||||
0xe990fd5aUL, 0x9e34d797UL, 0x2cf0b7d9UL, 0x022b8b51UL,
|
||||
0x96d5ac3aUL, 0x017da67dUL, 0xd1cf3ed6UL, 0x7c7d2d28UL,
|
||||
0x1f9f25cfUL, 0xadf2b89bUL, 0x5ad6b472UL, 0x5a88f54cUL,
|
||||
0xe029ac71UL, 0xe019a5e6UL, 0x47b0acfdUL, 0xed93fa9bUL,
|
||||
0xe8d3c48dUL, 0x283b57ccUL, 0xf8d56629UL, 0x79132e28UL,
|
||||
0x785f0191UL, 0xed756055UL, 0xf7960e44UL, 0xe3d35e8cUL,
|
||||
0x15056dd4UL, 0x88f46dbaUL, 0x03a16125UL, 0x0564f0bdUL,
|
||||
0xc3eb9e15UL, 0x3c9057a2UL, 0x97271aecUL, 0xa93a072aUL,
|
||||
0x1b3f6d9bUL, 0x1e6321f5UL, 0xf59c66fbUL, 0x26dcf319UL,
|
||||
0x7533d928UL, 0xb155fdf5UL, 0x03563482UL, 0x8aba3cbbUL,
|
||||
0x28517711UL, 0xc20ad9f8UL, 0xabcc5167UL, 0xccad925fUL,
|
||||
0x4de81751UL, 0x3830dc8eUL, 0x379d5862UL, 0x9320f991UL,
|
||||
0xea7a90c2UL, 0xfb3e7bceUL, 0x5121ce64UL, 0x774fbe32UL,
|
||||
0xa8b6e37eUL, 0xc3293d46UL, 0x48de5369UL, 0x6413e680UL,
|
||||
0xa2ae0810UL, 0xdd6db224UL, 0x69852dfdUL, 0x09072166UL,
|
||||
0xb39a460aUL, 0x6445c0ddUL, 0x586cdecfUL, 0x1c20c8aeUL,
|
||||
0x5bbef7ddUL, 0x1b588d40UL, 0xccd2017fUL, 0x6bb4e3bbUL,
|
||||
0xdda26a7eUL, 0x3a59ff45UL, 0x3e350a44UL, 0xbcb4cdd5UL,
|
||||
0x72eacea8UL, 0xfa6484bbUL, 0x8d6612aeUL, 0xbf3c6f47UL,
|
||||
0xd29be463UL, 0x542f5d9eUL, 0xaec2771bUL, 0xf64e6370UL,
|
||||
0x740e0d8dUL, 0xe75b1357UL, 0xf8721671UL, 0xaf537d5dUL,
|
||||
0x4040cb08UL, 0x4eb4e2ccUL, 0x34d2466aUL, 0x0115af84UL,
|
||||
0xe1b00428UL, 0x95983a1dUL, 0x06b89fb4UL, 0xce6ea048UL,
|
||||
0x6f3f3b82UL, 0x3520ab82UL, 0x011a1d4bUL, 0x277227f8UL,
|
||||
0x611560b1UL, 0xe7933fdcUL, 0xbb3a792bUL, 0x344525bdUL,
|
||||
0xa08839e1UL, 0x51ce794bUL, 0x2f32c9b7UL, 0xa01fbac9UL,
|
||||
0xe01cc87eUL, 0xbcc7d1f6UL, 0xcf0111c3UL, 0xa1e8aac7UL,
|
||||
0x1a908749UL, 0xd44fbd9aUL, 0xd0dadecbUL, 0xd50ada38UL,
|
||||
0x0339c32aUL, 0xc6913667UL, 0x8df9317cUL, 0xe0b12b4fUL,
|
||||
0xf79e59b7UL, 0x43f5bb3aUL, 0xf2d519ffUL, 0x27d9459cUL,
|
||||
0xbf97222cUL, 0x15e6fc2aUL, 0x0f91fc71UL, 0x9b941525UL,
|
||||
0xfae59361UL, 0xceb69cebUL, 0xc2a86459UL, 0x12baa8d1UL,
|
||||
0xb6c1075eUL, 0xe3056a0cUL, 0x10d25065UL, 0xcb03a442UL,
|
||||
0xe0ec6e0eUL, 0x1698db3bUL, 0x4c98a0beUL, 0x3278e964UL,
|
||||
0x9f1f9532UL, 0xe0d392dfUL, 0xd3a0342bUL, 0x8971f21eUL,
|
||||
0x1b0a7441UL, 0x4ba3348cUL, 0xc5be7120UL, 0xc37632d8UL,
|
||||
0xdf359f8dUL, 0x9b992f2eUL, 0xe60b6f47UL, 0x0fe3f11dUL,
|
||||
0xe54cda54UL, 0x1edad891UL, 0xce6279cfUL, 0xcd3e7e6fUL,
|
||||
0x1618b166UL, 0xfd2c1d05UL, 0x848fd2c5UL, 0xf6fb2299UL,
|
||||
0xf523f357UL, 0xa6327623UL, 0x93a83531UL, 0x56cccd02UL,
|
||||
0xacf08162UL, 0x5a75ebb5UL, 0x6e163697UL, 0x88d273ccUL,
|
||||
0xde966292UL, 0x81b949d0UL, 0x4c50901bUL, 0x71c65614UL,
|
||||
0xe6c6c7bdUL, 0x327a140aUL, 0x45e1d006UL, 0xc3f27b9aUL,
|
||||
0xc9aa53fdUL, 0x62a80f00UL, 0xbb25bfe2UL, 0x35bdd2f6UL,
|
||||
0x71126905UL, 0xb2040222UL, 0xb6cbcf7cUL, 0xcd769c2bUL,
|
||||
0x53113ec0UL, 0x1640e3d3UL, 0x38abbd60UL, 0x2547adf0UL,
|
||||
0xba38209cUL, 0xf746ce76UL, 0x77afa1c5UL, 0x20756060UL,
|
||||
0x85cbfe4eUL, 0x8ae88dd8UL, 0x7aaaf9b0UL, 0x4cf9aa7eUL,
|
||||
0x1948c25cUL, 0x02fb8a8cUL, 0x01c36ae4UL, 0xd6ebe1f9UL,
|
||||
0x90d4f869UL, 0xa65cdea0UL, 0x3f09252dUL, 0xc208e69fUL,
|
||||
0xb74e6132UL, 0xce77e25bUL, 0x578fdfe3UL, 0x3ac372e6UL,
|
||||
} |
||||
}; |
||||
|
@ -1,116 +0,0 @@
|
||||
/* crypto/bf/bf_skey.c */ |
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved. |
||||
* |
||||
* This package is an SSL implementation written |
||||
* by Eric Young (eay@mincom.oz.au). |
||||
* The implementation was written so as to conform with Netscapes SSL. |
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as |
||||
* the following conditions are aheared to. The following conditions |
||||
* apply to all code found in this distribution, be it the RC4, RSA, |
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation |
||||
* included with this distribution is covered by the same copyright terms |
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au). |
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in |
||||
* the code are not to be removed. |
||||
* If this package is used in a product, Eric Young should be given attribution |
||||
* as the author of the parts of the library used. |
||||
* This can be in the form of a textual message at program startup or |
||||
* in documentation (online or textual) provided with the package. |
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions |
||||
* are met: |
||||
* 1. Redistributions of source code must retain the copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* 2. Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* 3. All advertising materials mentioning features or use of this software |
||||
* must display the following acknowledgement: |
||||
* "This product includes cryptographic software written by |
||||
* Eric Young (eay@mincom.oz.au)" |
||||
* The word 'cryptographic' can be left out if the rouines from the library |
||||
* being used are not cryptographic related :-). |
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement: |
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)" |
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
* SUCH DAMAGE. |
||||
*
|
||||
* The licence and distribution terms for any publically available version or |
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
* copied and put under another distribution licence |
||||
* [including the GNU Public Licence.] |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
#include <string.h> |
||||
#include "blowfish.h" |
||||
#include "bf_locl.h" |
||||
#include "bf_pi.h" |
||||
|
||||
void BF_set_key(BF_KEY *key, int len, unsigned char *data) |
||||
{ |
||||
int i; |
||||
BF_LONG *p,ri,in[2]; |
||||
unsigned char *d,*end; |
||||
|
||||
|
||||
memcpy((char *)key,(char *)&bf_init,sizeof(BF_KEY)); |
||||
p=key->P; |
||||
|
||||
if (len > ((BF_ROUNDS+2)*4)) len=(BF_ROUNDS+2)*4; |
||||
|
||||
d=data; |
||||
end= &(data[len]); |
||||
for (i=0; i<(BF_ROUNDS+2); i++) |
||||
{ |
||||
ri= (BF_LONG)*(d++); |
||||
if (d >= end) d=data; |
||||
|
||||
ri<<=8; |
||||
ri|= *(d++); |
||||
if (d >= end) d=data; |
||||
|
||||
ri<<=8; |
||||
ri|= *(d++); |
||||
if (d >= end) d=data; |
||||
|
||||
ri<<=8; |
||||
ri|= *(d++); |
||||
if (d >= end) d=data; |
||||
|
||||
p[i]^=ri; |
||||
} |
||||
|
||||
in[0]=0L; |
||||
in[1]=0L; |
||||
for (i=0; i<(BF_ROUNDS+2); i+=2) |
||||
{ |
||||
BF_encrypt(in,key,BF_ENCRYPT); |
||||
p[i ]=in[0]; |
||||
p[i+1]=in[1]; |
||||
} |
||||
|
||||
p=key->S; |
||||
for (i=0; i<4*256; i+=2) |
||||
{ |
||||
BF_encrypt(in,key,BF_ENCRYPT); |
||||
p[i ]=in[0]; |
||||
p[i+1]=in[1]; |
||||
} |
||||
} |
||||
|
@ -1,149 +0,0 @@
|
||||
The Blowfish library. |
||||
|
||||
Blowfish is a block cipher that operates on 64bit (8 byte) quantities. It |
||||
uses variable size key, but 128bit (16 byte) key would normally be considered |
||||
good. It can be used in all the modes that DES can be used. This |
||||
library implements the ecb, cbc, cfb64, ofb64 modes. |
||||
|
||||
Blowfish is quite a bit faster that DES, and much faster than IDEA or |
||||
RC2. It is one of the faster block ciphers. |
||||
|
||||
For all calls that have an 'input' and 'output' variables, they can be the |
||||
same. |
||||
|
||||
This library requires the inclusion of 'blowfish.h'. |
||||
|
||||
All of the encryption functions take what is called an BF_KEY as an |
||||
argument. An BF_KEY is an expanded form of the Blowfish key. |
||||
For all modes of the Blowfish algorithm, the BF_KEY used for |
||||
decryption is the same one that was used for encryption. |
||||
|
||||
The define BF_ENCRYPT is passed to specify encryption for the functions |
||||
that require an encryption/decryption flag. BF_DECRYPT is passed to |
||||
specify decryption. |
||||
|
||||
Please note that any of the encryption modes specified in my DES library |
||||
could be used with Blowfish. I have only implemented ecb, cbc, cfb64 and |
||||
ofb64 for the following reasons. |
||||
- ecb is the basic Blowfish encryption. |
||||
- cbc is the normal 'chaining' form for block ciphers. |
||||
- cfb64 can be used to encrypt single characters, therefore input and output |
||||
do not need to be a multiple of 8. |
||||
- ofb64 is similar to cfb64 but is more like a stream cipher, not as |
||||
secure (not cipher feedback) but it does not have an encrypt/decrypt mode. |
||||
- If you want triple Blowfish, thats 384 bits of key and you must be totally |
||||
obsessed with security. Still, if you want it, it is simple enough to |
||||
copy the function from the DES library and change the des_encrypt to |
||||
BF_encrypt; an exercise left for the paranoid reader :-). |
||||
|
||||
The functions are as follows: |
||||
|
||||
void BF_set_key( |
||||
BF_KEY *ks; |
||||
int len; |
||||
unsigned char *key; |
||||
BF_set_key converts an 'len' byte key into a BF_KEY. |
||||
A 'ks' is an expanded form of the 'key' which is used to |
||||
perform actual encryption. It can be regenerated from the Blowfish key |
||||
so it only needs to be kept when encryption or decryption is about |
||||
to occur. Don't save or pass around BF_KEY's since they |
||||
are CPU architecture dependent, 'key's are not. Blowfish is an |
||||
interesting cipher in that it can be used with a variable length |
||||
key. 'len' is the length of 'key' to be used as the key. |
||||
A 'len' of 16 is recomended by me, but blowfish can use upto |
||||
72 bytes. As a warning, blowfish has a very very slow set_key |
||||
function, it actually runs BF_encrypt 521 times. |
||||
|
||||
void BF_encrypt( |
||||
unsigned long *data, |
||||
BF_KEY *key, |
||||
int encrypt); |
||||
This is the Blowfish encryption function that gets called by just about |
||||
every other Blowfish routine in the library. You should not use this |
||||
function except to implement 'modes' of Blowfish. |
||||
I say this because the |
||||
functions that call this routine do the conversion from 'char *' to |
||||
long, and this needs to be done to make sure 'non-aligned' memory |
||||
access do not occur. |
||||
Data is a pointer to 2 unsigned long's and key is the |
||||
BF_KEY to use. Encryption or decryption is indicated by 'encrypt'. |
||||
which can have the values BF_ENCRYPT or BF_DECRYPT. |
||||
|
||||
void BF_ecb_encrypt( |
||||
unsigned char *in, |
||||
unsigned char *out, |
||||
BF_KEY *key, |
||||
int encrypt); |
||||
This is the basic Electronic Code Book form of Blowfish (in DES this |
||||
mode is called Electronic Code Book so I'm going to use the term |
||||
for blowfish as well. |
||||
Input is encrypted into output using the key represented by |
||||
key. Depending on the encrypt, encryption or |
||||
decryption occurs. Input is 8 bytes long and output is 8 bytes. |
||||
|
||||
void BF_cbc_encrypt( |
||||
unsigned char *in, |
||||
unsigned char *out, |
||||
long length, |
||||
BF_KEY *ks, |
||||
unsigned char *ivec, |
||||
int encrypt); |
||||
This routine implements Blowfish in Cipher Block Chaining mode. |
||||
Input, which should be a multiple of 8 bytes is encrypted |
||||
(or decrypted) to output which will also be a multiple of 8 bytes. |
||||
The number of bytes is in length (and from what I've said above, |
||||
should be a multiple of 8). If length is not a multiple of 8, bad |
||||
things will probably happen. ivec is the initialisation vector. |
||||
This function updates iv after each call so that it can be passed to |
||||
the next call to BF_cbc_encrypt(). |
||||
|
||||
void BF_cfb64_encrypt( |
||||
unsigned char *in, |
||||
unsigned char *out, |
||||
long length, |
||||
BF_KEY *schedule, |
||||
unsigned char *ivec, |
||||
int *num, |
||||
int encrypt); |
||||
This is one of the more useful functions in this Blowfish library, it |
||||
implements CFB mode of Blowfish with 64bit feedback. |
||||
This allows you to encrypt an arbitrary number of bytes, |
||||
you do not require 8 byte padding. Each call to this |
||||
routine will encrypt the input bytes to output and then update ivec |
||||
and num. Num contains 'how far' we are though ivec. |
||||
'Encrypt' is used to indicate encryption or decryption. |
||||
CFB64 mode operates by using the cipher to generate a stream |
||||
of bytes which is used to encrypt the plain text. |
||||
The cipher text is then encrypted to generate the next 64 bits to |
||||
be xored (incrementally) with the next 64 bits of plain |
||||
text. As can be seen from this, to encrypt or decrypt, |
||||
the same 'cipher stream' needs to be generated but the way the next |
||||
block of data is gathered for encryption is different for |
||||
encryption and decryption. |
||||
|
||||
void BF_ofb64_encrypt( |
||||
unsigned char *in, |
||||
unsigned char *out, |
||||
long length, |
||||
BF_KEY *schedule, |
||||
unsigned char *ivec, |
||||
int *num); |
||||
This functions implements OFB mode of Blowfish with 64bit feedback. |
||||
This allows you to encrypt an arbitrary number of bytes, |
||||
you do not require 8 byte padding. Each call to this |
||||
routine will encrypt the input bytes to output and then update ivec |
||||
and num. Num contains 'how far' we are though ivec. |
||||
This is in effect a stream cipher, there is no encryption or |
||||
decryption mode. |
||||
|
||||
For reading passwords, I suggest using des_read_pw_string() from my DES library. |
||||
To generate a password from a text string, I suggest using MD5 (or MD2) to |
||||
produce a 16 byte message digest that can then be passed directly to |
||||
BF_set_key(). |
||||
|
||||
===== |
||||
For more information about the specific Blowfish modes in this library |
||||
(ecb, cbc, cfb and ofb), read the section entitled 'Modes of DES' from the |
||||
documentation on my DES library. What is said about DES is directly |
||||
applicable for Blowfish. |
||||
|
@ -1,114 +0,0 @@
|
||||
/* crypto/bf/blowfish.h */ |
||||
/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
|
||||
* All rights reserved. |
||||
* |
||||
* This package is an SSL implementation written |
||||
* by Eric Young (eay@mincom.oz.au). |
||||
* The implementation was written so as to conform with Netscapes SSL. |
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as |
||||
* the following conditions are aheared to. The following conditions |
||||
* apply to all code found in this distribution, be it the RC4, RSA, |
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation |
||||
* included with this distribution is covered by the same copyright terms |
||||
* except that the holder is Tim Hudson (tjh@mincom.oz.au). |
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in |
||||
* the code are not to be removed. |
||||
* If this package is used in a product, Eric Young should be given attribution |
||||
* as the author of the parts of the library used. |
||||
* This can be in the form of a textual message at program startup or |
||||
* in documentation (online or textual) provided with the package. |
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions |
||||
* are met: |
||||
* 1. Redistributions of source code must retain the copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* 2. Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* 3. All advertising materials mentioning features or use of this software |
||||
* must display the following acknowledgement: |
||||
* "This product includes cryptographic software written by |
||||
* Eric Young (eay@mincom.oz.au)" |
||||
* The word 'cryptographic' can be left out if the rouines from the library |
||||
* being used are not cryptographic related :-). |
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement: |
||||
* "This product includes software written by Tim Hudson (tjh@mincom.oz.au)" |
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
* SUCH DAMAGE. |
||||
*
|
||||
* The licence and distribution terms for any publically available version or |
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
* copied and put under another distribution licence |
||||
* [including the GNU Public Licence.] |
||||
*/ |
||||
|
||||
#ifndef HEADER_BLOWFISH_H |
||||
#define HEADER_BLOWFISH_H |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#define BF_ENCRYPT 1 |
||||
#define BF_DECRYPT 0 |
||||
|
||||
/* If you make this 'unsigned int' the pointer variants will work on
|
||||
* the Alpha, otherwise they will not. Strangly using the '8 byte' |
||||
* BF_LONG and the default 'non-pointer' inner loop is the best configuration |
||||
* for the Alpha */ |
||||
#define BF_LONG unsigned long |
||||
|
||||
#define BF_ROUNDS 16 |
||||
#define BF_BLOCK 8 |
||||
|
||||
typedef struct bf_key_st |
||||
{ |
||||
BF_LONG P[BF_ROUNDS+2]; |
||||
BF_LONG S[4*256]; |
||||
} BF_KEY; |
||||
|
||||
#ifndef NOPROTO |
||||
|
||||
void BF_set_key(BF_KEY *key, int len, unsigned char *data); |
||||
void BF_ecb_encrypt(unsigned char *in,unsigned char *out,BF_KEY *key, |
||||
int encrypt); |
||||
void BF_encrypt(BF_LONG *data,BF_KEY *key,int encrypt); |
||||
void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, |
||||
BF_KEY *ks, unsigned char *iv, int encrypt); |
||||
void BF_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, |
||||
BF_KEY *schedule, unsigned char *ivec, int *num, int encrypt); |
||||
void BF_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, |
||||
BF_KEY *schedule, unsigned char *ivec, int *num); |
||||
char *BF_options(void); |
||||
|
||||
#else |
||||
|
||||
void BF_set_key(); |
||||
void BF_ecb_encrypt(); |
||||
void BF_encrypt(); |
||||
void BF_cbc_encrypt(); |
||||
void BF_cfb64_encrypt(); |
||||
void BF_ofb64_encrypt(); |
||||
char *BF_options(); |
||||
|
||||
#endif |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif |
@ -1,194 +0,0 @@
|
||||
/*
|
||||
HawkVoice Direct Interface (HVDI) cross platform network voice library |
||||
Copyright (C) 2001 Phil Frisbie, Jr. (phil@hawksoft.com) |
||||
|
||||
This library is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU Library General Public |
||||
License as published by the Free Software Foundation; either |
||||
version 2 of the License, or (at your option) any later version. |
||||
|
||||
This library is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
Library General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU Library General Public |
||||
License along with this library; if not, write to the |
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
||||
Boston, MA 02111-1307, USA. |
||||
|
||||
Or go to http://www.gnu.org/copyleft/lgpl.html
|
||||
*/ |
||||
|
||||
#ifndef HVDI_H |
||||
#define HVDI_H |
||||
|
||||
#include "blowfish/blowfish.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
#define HVDI_MAJOR_VERSION 0 |
||||
#define HVDI_MINOR_VERSION 7 |
||||
#define HVDI_VERSION_STRING "HVDI 0.7 beta" |
||||
|
||||
/* This was copied from nl.h so that it did not need to be included */ |
||||
|
||||
#if defined WIN32 || defined WIN64 |
||||
#pragma warning (disable:4514) /* disable "unreferenced inline function has |
||||
been removed" warning */ |
||||
/* The default build for Windows is as a DLL. */ |
||||
/* If you want a static library, define WIN_STATIC_LIB. */ |
||||
#ifdef WIN_STATIC_LIB |
||||
#define NL_EXP |
||||
#else |
||||
#if defined __LCC__ |
||||
#define NL_EXP extern |
||||
#else |
||||
#define NL_EXP __declspec(dllexport) |
||||
#endif |
||||
#endif |
||||
#define NL_APIENTRY __stdcall |
||||
#define NL_CALLBACK __cdecl |
||||
#ifdef __GNUC__ |
||||
#define NL_INLINE extern __inline__ |
||||
#else |
||||
#define NL_INLINE __inline |
||||
#endif |
||||
#else |
||||
#define NL_EXP extern |
||||
#define NL_APIENTRY |
||||
#define NL_CALLBACK |
||||
#ifdef __GNUC__ |
||||
#define NL_INLINE extern __inline__ |
||||
#else |
||||
#define NL_INLINE inline /* assuming C99 compliant compiler */ |
||||
#endif /* __GNUC__ */ |
||||
#endif /* WIN32 || WIN64 */ |
||||
|
||||
#ifndef NL_INVALID |
||||
#define NL_INVALID (-1) |
||||
#define NL_FALSE (0) |
||||
#define NL_TRUE (1) |
||||
#endif |
||||
|
||||
|
||||
/* We will use HVDI or hvdi to prefix all HawkVoiceDI defines and functions */ |
||||
|
||||
/*
|
||||
The internal state of the codec. This is READ ONLY! You can read hvdi_dec_state->codec |
||||
if you want to know what type of codec is being used on the other side, but DO NOT |
||||
write to this structure!! I could have hidden these structures behind an index, but |
||||
this IS low level quick and dirty ;) |
||||
|
||||
hvdi_enc_state and hvdi_dec_state are defined separately to help the compiler spot |
||||
your mistakes ;) |
||||
*/ |
||||
typedef struct |
||||
{ |
||||
unsigned char codec; /* the codec used with the last packet */ |
||||
unsigned short sequence;/* the sequence number of the last packet */ |
||||
void *state; /* the codec state */ |
||||
} hvdi_enc_state; |
||||
|
||||
typedef struct |
||||
{ |
||||
unsigned char codec; /* the codec used with the last packet */ |
||||
unsigned short sequence;/* the sequence number of the last packet */ |
||||
void *state; /* the codec state */ |
||||
} hvdi_dec_state; |
||||
|
||||
typedef struct |
||||
{ |
||||
int rate; /* HVDI_VOX_FAST, HVDI_VOX_MEDIUM, or HVDI_VOX_SLOW */ |
||||
int noisethreshold; /* 0(always pass) to 1000(never pass), 300 is a good starting point */ |
||||
int samplecount; /* init to 0; used internally by hvdiVOX */ |
||||
} hvdi_vox; |
||||
|
||||
typedef struct |
||||
{ |
||||
unsigned long lcmrate; /* least common multiple of rates */ |
||||
unsigned long inskip, outskip; /* LCM increments for I & O rates */ |
||||
unsigned long total; |
||||
unsigned long intot, outtot; /* total samples in terms of LCM rate */ |
||||
long lastsamp; |
||||
} hvdi_rate; |
||||
|
||||
typedef struct |
||||
{ |
||||
unsigned int sample_max; |
||||
int counter; |
||||
float gain; |
||||
float peak; |
||||
int silence_counter; |
||||
} hvdi_agc; |
||||
|
||||
/* The basic codecs, from hawkvoice.h */ |
||||
#define HV_2_4K_CODEC 0x0001 /* LPC-10 2.4 Kbps codec */ |
||||
#define HV_4_8K_CODEC 0x0002 /* LPC 4.8 Kbps codec */ |
||||
#define HV_13_2K_CODEC 0x0004 /* GSM 13.2 Kbps codec */ |
||||
#define HV_32K_CODEC 0x0008 /* Intel/DVI ADPCM 32 Kbps codec */ |
||||
#define HV_64K_CODEC 0x0010 /* G.711 u-law 64 Kbps codec */ |
||||
#define HV_1_4K_CODEC 0x0011 /* OpenLPC 1.4 Kbps codec */ |
||||
#define HV_1_8K_CODEC 0x0012 /* OpenLPC 1.8 Kbps codec */ |
||||
|
||||
/* Alternate codec names */ |
||||
#define HV_LPC10_CODEC HV_2_4K_CODEC |
||||
#define HV_LPC_CODEC HV_4_8K_CODEC |
||||
#define HV_GSM_CODEC HV_13_2K_CODEC |
||||
#define HV_ADPCM_32_CODEC HV_32K_CODEC |
||||
#define HV_PCM_64_CODEC HV_64K_CODEC |
||||
#define HV_G_711_CODEC HV_64K_CODEC |
||||
#define HV_ULAW_CODEC HV_64K_CODEC |
||||
#define HV_LPC_1_4_CODEC HV_1_4K_CODEC |
||||
#define HV_LPC_1_8_CODEC HV_1_8K_CODEC |
||||
|
||||
/* VOX options */ |
||||
/* how many samples of silence to wait after voice stops */ |
||||
#define HVDI_VOX_FAST 4000 /* 1/2 second */ |
||||
#define HVDI_VOX_MEDIUM 8000 /* 1 second */ |
||||
#define HVDI_VOX_SLOW 12000 /* 1 1/2 seconds */ |
||||
|
||||
|
||||
/* HawkVoiceDI API */ |
||||
|
||||
NL_EXP hvdi_enc_state* NL_APIENTRY hvdiCreateEncoderState(void); |
||||
|
||||
NL_EXP hvdi_dec_state* NL_APIENTRY hvdiCreateDecoderState(void); |
||||
|
||||
NL_EXP void NL_APIENTRY hvdiFreeEncoderState(hvdi_enc_state *state); |
||||
|
||||
NL_EXP void NL_APIENTRY hvdiFreeDecoderState(hvdi_dec_state *state); |
||||
|
||||
NL_EXP int NL_APIENTRY hvdiSetCodec(unsigned char codec, hvdi_enc_state *state); |
||||
|
||||
NL_EXP BF_KEY* NL_APIENTRY hvdiMakeEncryptionKey(const char *string); |
||||
|
||||
NL_EXP int NL_APIENTRY hvdiIsVoicePacket(unsigned char *packet, int length); |
||||
|
||||
NL_EXP int NL_APIENTRY hvdiDecodePacket(unsigned char *packet, int paclen, short *buffer, |
||||
int buflen, BF_KEY *key, hvdi_dec_state *state); |
||||
|
||||
NL_EXP int NL_APIENTRY hvdiEncodePacket(short *buffer, int buflen, unsigned char *packet, |
||||
int paclen, BF_KEY *key, hvdi_enc_state *state); |
||||
|
||||
NL_EXP int NL_APIENTRY hvdiVOX(short *buffer, int buflen, hvdi_vox *vox); |
||||
|
||||
NL_EXP void NL_APIENTRY hvdiRateInit(hvdi_rate *rate, int inrate, int outrate); |
||||
|
||||
NL_EXP void NL_APIENTRY hvdiRateFlow(hvdi_rate *rate, short *inbuf, short *outbuf, int *inlen, int *outlen); |
||||
|
||||
NL_EXP void NL_APIENTRY hvdiAGCInit(hvdi_agc *agc, float level); |
||||
|
||||
NL_EXP void NL_APIENTRY hvdiAGC(hvdi_agc *agc, short *buffer, int len); |
||||
|
||||
NL_EXP void NL_APIENTRY hvdiMix(short *outbuf, short **inbuf, int number, int inlen); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif /* HVDI_H */ |
||||
|
@ -1,22 +0,0 @@
|
||||
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd |
||||
and Clark Cooper |
||||
Copyright (c) 2001, 2002 Expat maintainers. |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining |
||||
a copy of this software and associated documentation files (the |
||||
"Software"), to deal in the Software without restriction, including |
||||
without limitation the rights to use, copy, modify, merge, publish, |
||||
distribute, sublicense, and/or sell copies of the Software, and to |
||||
permit persons to whom the Software is furnished to do so, subject to |
||||
the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@ -1,124 +0,0 @@
|
||||
Release 1.95.7 Mon Oct 20 2003 |
||||
- Fixed enum XML_Status issue (reported on SourceForge many |
||||
times), so compilers that are properly picky will be happy. |
||||
- Introduced an XMLCALL macro to control the calling |
||||
convention used by the Expat API; this macro should be used |
||||
to annotate prototypes and definitions of callback |
||||
implementations in code compiled with a calling convention |
||||
other than the default convention for the host platform. |
||||
- Improved ability to build without the configure-generated |
||||
expat_config.h header. This is useful for applications |
||||
which embed Expat rather than linking in the library. |
||||
- Fixed a variety of bugs: see SF issues 458907, 609603, |
||||
676844, 679754, 692878, 692964, 695401, 699323, 699487, |
||||
820946. |
||||
- Improved hash table lookups. |
||||
- Added more regression tests and improved documentation. |
||||
|
||||
Release 1.95.6 Tue Jan 28 2003 |
||||
- Added XML_FreeContentModel(). |
||||
- Added XML_MemMalloc(), XML_MemRealloc(), XML_MemFree(). |
||||
- Fixed a variety of bugs: see SF issues 615606, 616863, |
||||
618199, 653180, 673791. |
||||
- Enhanced the regression test suite. |
||||
- Man page improvements: includes SF issue 632146. |
||||
|
||||
Release 1.95.5 Fri Sep 6 2002 |
||||
- Added XML_UseForeignDTD() for improved SAX2 support. |
||||
- Added XML_GetFeatureList(). |
||||
- Defined XML_Bool type and the values XML_TRUE and XML_FALSE. |
||||
- Use an incomplete struct instead of a void* for the parser |
||||
(may not retain). |
||||
- Fixed UTF-8 decoding bug that caused legal UTF-8 to be rejected. |
||||
- Finally fixed bug where default handler would report DTD |
||||
events that were already handled by another handler. |
||||
Initial patch contributed by Darryl Miles. |
||||
- Removed unnecessary DllMain() function that caused static |
||||
linking into a DLL to be difficult. |
||||
- Added VC++ projects for building static libraries. |
||||
- Reduced line-length for all source code and headers to be |
||||
no longer than 80 characters, to help with AS/400 support. |
||||
- Reduced memory copying during parsing (SF patch #600964). |
||||
- Fixed a variety of bugs: see SF issues 580793, 434664, |
||||
483514, 580503, 581069, 584041, 584183, 584832, 585537, |
||||
596555, 596678, 598352, 598944, 599715, 600479, 600971. |
||||
|
||||
Release 1.95.4 Fri Jul 12 2002 |
||||
- Added support for VMS, contributed by Craig Berry. See |
||||
vms/README.vms for more information. |
||||
- Added Mac OS (classic) support, with a makefile for MPW, |
||||
contributed by Thomas Wegner and Daryle Walker. |
||||
- Added Borland C++ Builder 5 / BCC 5.5 support, contributed |
||||
by Patrick McConnell (SF patch #538032). |
||||
- Fixed a variety of bugs: see SF issues 441449, 563184, |
||||
564342, 566334, 566901, 569461, 570263, 575168, 579196. |
||||
- Made skippedEntityHandler conform to SAX2 (see source comment) |
||||
- Re-implemented WFC: Entity Declared from XML 1.0 spec and |
||||
added a new error "entity declared in parameter entity": |
||||
see SF bug report 569461 and SF patch 578161 |
||||
- Re-implemented section 5.1 from XML 1.0 spec: |
||||
see SF bug report 570263 and SF patch 578161 |
||||
|
||||
Release 1.95.3 Mon Jun 3 2002 |
||||
- Added a project to the MSVC workspace to create a wchar_t |
||||
version of the library; the DLLs are named libexpatw.dll. |
||||
- Changed the name of the Windows DLLs from expat.dll to |
||||
libexpat.dll; this fixes SF bug #432456. |
||||
- Added the XML_ParserReset() API function. |
||||
- Fixed XML_SetReturnNSTriplet() to work for element names. |
||||
- Made the XML_UNICODE builds usable (thanks, Karl!). |
||||
- Allow xmlwf to read from standard input. |
||||
- Install a man page for xmlwf on Unix systems. |
||||
- Fixed many bugs; see SF bug reports 231864, 461380, 464837, |
||||
466885, 469226, 477667, 484419, 487840, 494749, 496505, |
||||
547350. Other bugs which we can't test as easily may also |
||||
have been fixed, especially in the area of build support. |
||||
|
||||
Release 1.95.2 Fri Jul 27 2001 |
||||
- More changes to make MSVC happy with the build; add a single |
||||
workspace to support both the library and xmlwf application. |
||||
- Added a Windows installer for Windows users; includes |
||||
xmlwf.exe. |
||||
- Added compile-time constants that can be used to determine the |
||||
Expat version |
||||
- Removed a lot of GNU-specific dependencies to aide portability |
||||
among the various Unix flavors. |
||||
- Fix the UTF-8 BOM bug. |
||||
- Cleaned up warning messages for several compilers. |
||||
- Added the -Wall, -Wstrict-prototypes options for GCC. |
||||
|
||||
Release 1.95.1 Sun Oct 22 15:11:36 EDT 2000 |
||||
- Changes to get expat to build under Microsoft compiler |
||||
- Removed all aborts and instead return an UNEXPECTED_STATE error. |
||||
- Fixed a bug where a stray '%' in an entity value would cause an |
||||
abort. |
||||
- Defined XML_SetEndNamespaceDeclHandler. Thanks to Darryl Miles for |
||||
finding this oversight. |
||||
- Changed default patterns in lib/Makefile.in to fit non-GNU makes |
||||
Thanks to robin@unrated.net for reporting and providing an |
||||
account to test on. |
||||
- The reference had the wrong label for XML_SetStartNamespaceDecl. |
||||
Reported by an anonymous user. |
||||
|
||||
Release 1.95.0 Fri Sep 29 2000 |
||||
- XML_ParserCreate_MM |
||||
Allows you to set a memory management suite to replace the |
||||
standard malloc,realloc, and free. |
||||
- XML_SetReturnNSTriplet |
||||
If you turn this feature on when namespace processing is in |
||||
effect, then qualified, prefixed element and attribute names |
||||
are returned as "uri|name|prefix" where '|' is whatever |
||||
separator character is used in namespace processing. |
||||
- Merged in features from perl-expat |
||||
o XML_SetElementDeclHandler |
||||
o XML_SetAttlistDeclHandler |
||||
o XML_SetXmlDeclHandler |
||||
o XML_SetEntityDeclHandler |
||||
o StartDoctypeDeclHandler takes 3 additional parameters: |
||||
sysid, pubid, has_internal_subset |
||||
o Many paired handler setters (like XML_SetElementHandler) |
||||
now have corresponding individual handler setters |
||||
o XML_GetInputContext for getting the input context of |
||||
the current parse position. |
||||
- Added reference material |
||||
- Packaged into a distribution that builds a sharable library |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,119 +0,0 @@
|
||||
|
||||
Expat, Release 1.95.7 |
||||
|
||||
This is Expat, a C library for parsing XML, written by James Clark. |
||||
Expat is a stream-oriented XML parser. This means that you register |
||||
handlers with the parser before starting the parse. These handlers |
||||
are called when the parser discovers the associated structures in the |
||||
document being parsed. A start tag is an example of the kind of |
||||
structures for which you may register handlers. |
||||
|
||||
Windows users should use the expat_win32bin package, which includes |
||||
both precompiled libraries and executalbes, and source code for |
||||
developers. |
||||
|
||||
Expat is free software. You may copy, distribute, and modify it under |
||||
the terms of the License contained in the file COPYING distributed |
||||
with this package. This license is the same as the MIT/X Consortium |
||||
license. |
||||
|
||||
Versions of Expat that have an odd minor version (the middle number in |
||||
the release above), are development releases and should be considered |
||||
as beta software. Releases with even minor version numbers are |
||||
intended to be production grade software. |
||||
|
||||
If you are building Expat from a check-out from the CVS repository, |
||||
you need to run a script that generates the configure script using the |
||||
GNU autoconf and libtool tools. To do this, you need to have |
||||
autoconf 2.52 or newer and libtool 1.4 or newer. Run the script like |
||||
this: |
||||
|
||||
./buildconf.sh |
||||
|
||||
Once this has been done, follow the same instructions as for building |
||||
from a source distribution. |
||||
|
||||
To build Expat from a source distribution, you first run the |
||||
configuration shell script in the top level distribution directory: |
||||
|
||||
./configure |
||||
|
||||
There are many options which you may provide to configure (which you |
||||
can discover by running configure with the --help option). But the |
||||
one of most interest is the one that sets the installation directory. |
||||
By default, the configure script will set things up to install |
||||
libexpat into /usr/local/lib, expat.h into /usr/local/include, and |
||||
xmlwf into /usr/local/bin. If, for example, you'd prefer to install |
||||
into /home/me/mystuff/lib, /home/me/mystuff/include, and |
||||
/home/me/mystuff/bin, you can tell configure about that with: |
||||
|
||||
./configure --prefix=/home/me/mystuff |
||||
|
||||
After running the configure script, the "make" command will build |
||||
things and "make install" will install things into their proper |
||||
location. Note that you need to have write permission into the |
||||
directories into which things will be installed. |
||||
|
||||
If you are interested in building Expat to provide document |
||||
information in UTF-16 rather than the default UTF-8, following these |
||||
instructions: |
||||
|
||||
1. For UTF-16 output as unsigned short (and version/error |
||||
strings as char), run: |
||||
|
||||
./configure CPPFLAGS=-DXML_UNICODE |
||||
|
||||
For UTF-16 output as wchar_t (incl. version/error strings), |
||||
run: |
||||
|
||||
./configure CFLAGS="-g -O2 -fshort-wchar" \ |
||||
CPPFLAGS=-DXML_UNICODE_WCHAR_T |
||||
|
||||
2. Edit the MakeFile, changing: |
||||
|
||||
LIBRARY = libexpat.la |
||||
|
||||
to: |
||||
|
||||
LIBRARY = libexpatw.la |
||||
|
||||
(Note the additional "w" in the library name.) |
||||
|
||||
3. Run "make buildlib" (which builds the library only). |
||||
|
||||
4. Run "make installlib" (which installs the library only). |
||||
|
||||
Note for Solaris users: The "ar" command is usually located in |
||||
"/usr/ccs/bin", which is not in the default PATH. You will need to |
||||
add this to your path for the "make" command, and probably also switch |
||||
to GNU make (the "make" found in /usr/ccs/bin does not seem to work |
||||
properly -- appearantly it does not understand .PHONY directives). If |
||||
you're using ksh or bash, use this command to build: |
||||
|
||||
PATH=/usr/ccs/bin:$PATH make |
||||
|
||||
The unit and regression tests for Expat require the "check" library on |
||||
Unix; more information is available at http://check.sourceforge.net/, |
||||
and downloadable packages are available from the library's project |
||||
page on SourceForge: http://sourceforge.net/projects/check/. You do |
||||
not need to install the check library to build and use Expat, only to |
||||
build and run Expat's test suite. |
||||
|
||||
When using Expat with a project using autoconf for configuration, you |
||||
can use the probing macro in conftools/expat.m4 to determine how to |
||||
include Expat. See the comments at the top of that file for more |
||||
information. |
||||
|
||||
A reference manual is available in the file doc/reference.html in this |
||||
distribution. |
||||
|
||||
The homepage for this project is http://www.libexpat.org/. There |
||||
are links there to connect you to the bug reports page. If you need |
||||
to report a bug when you don't have access to a browser, you may also |
||||
send a bug report by email to expat-bugs@mail.libexpat.org. |
||||
|
||||
Discussion related to the direction of future expat development takes |
||||
place on expat-discuss@mail.libexpat.org. Archives of this list and |
||||
other Expat-related lists may be found at: |
||||
|
||||
http://mail.libexpat.org/mailman-21/listinfo/ |
@ -1,58 +0,0 @@
|
||||
|
||||
Expat can be built on Windows in three ways: |
||||
using MS Visual C++ 6, Borland C++ Builder 5 or Cygwin. |
||||
|
||||
* Cygwin: |
||||
This follows the Unix build procedures. |
||||
|
||||
* C++ Builder 5: |
||||
Possible with make files in the BCB5 subdirectory. |
||||
Details can be found in the ReadMe file located there. |
||||
|
||||
* MS Visual C++ 6: |
||||
Based on workspace (.dsw) and project files (.dsp) |
||||
located in the lib subdirectory. |
||||
|
||||
* Special note about MS VC++ and runtime libraries: |
||||
|
||||
There are three possible configurations: using the |
||||
single threaded or multithreaded run-time library, |
||||
or using the multi-threaded run-time Dll. That is, |
||||
one can build three different Expat libraries depending |
||||
on the needs of the application. |
||||
|
||||
Dynamic Linking: |
||||
|
||||
By default the Expat Dlls are built to link with the |
||||
multi-threaded run-time Dll. The libraries are named |
||||
- libexpat(w).dll |
||||
- libexpat(w).lib (import library) |
||||
The "w" indicates the UTF-16 version of the library. |
||||
|
||||
One rarely uses other versions of the Dll, but they can |
||||
be built easily by specifying a different RTL linkage in |
||||
the IDE on the C/C++ tab under the category Code Generation. |
||||
|
||||
Static Linking: |
||||
|
||||
The libraries should be named like this: |
||||
Single-theaded: libexpat(w)ML.lib |
||||
Multi-threaded: libexpat(w)MT.lib |
||||
Multi-threaded Dll: libexpat(w)MD.lib |
||||
The suffixes conform to the compiler switch settings |
||||
/ML, /MT and /MD for MS VC++. |
||||
|
||||
By default, the expat-static and expatw-static projects are set up |
||||
to link dynamically against the multithreaded run-time library, |
||||
so they will build libexpatMT.lib or libexpatwMT.lib files. |
||||
|
||||
To build the other versions of the static library, |
||||
go to Project - Settings: |
||||
- specify a different RTL linkage on the C/C++ tab |
||||
under the category Code Generation. |
||||
- then, on the Library tab, change the output file name |
||||
accordingly, as described above |
||||
|
||||
An application linking to the static libraries must |
||||
have the global macro XML_STATIC defined. |
||||
|
@ -1,86 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00 |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expat", "lib\expat.vcproj", "{99ACAECA-2C32-4E24-B162-26687AB9C87B}" |
||||
ProjectSection(ProjectDependencies) = postProject |
||||
EndProjectSection |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expat_static", "lib\expat_static.vcproj", "{170D8E27-945D-47E2-9031-F893E22C058F}" |
||||
ProjectSection(ProjectDependencies) = postProject |
||||
EndProjectSection |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expatw", "lib\expatw.vcproj", "{4473BB4C-E512-45F8-A810-27A1688113DF}" |
||||
ProjectSection(ProjectDependencies) = postProject |
||||
EndProjectSection |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expatw_static", "lib\expatw_static.vcproj", "{716F7CB2-1E3A-4AB5-9E81-E5D61E972072}" |
||||
ProjectSection(ProjectDependencies) = postProject |
||||
EndProjectSection |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expatw_static_xbox", "lib\expatw_static_xbox.vcproj", "{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}" |
||||
ProjectSection(ProjectDependencies) = postProject |
||||
EndProjectSection |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfiguration) = preSolution |
||||
Debug = Debug |
||||
Profile = Profile |
||||
Profile_FastCap = Profile_FastCap |
||||
Release = Release |
||||
Release_LTCG = Release_LTCG |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfiguration) = postSolution |
||||
{99ACAECA-2C32-4E24-B162-26687AB9C87B}.Debug.ActiveCfg = Debug|Win32 |
||||
{99ACAECA-2C32-4E24-B162-26687AB9C87B}.Debug.Build.0 = Debug|Win32 |
||||
{99ACAECA-2C32-4E24-B162-26687AB9C87B}.Profile.ActiveCfg = Release|Win32 |
||||
{99ACAECA-2C32-4E24-B162-26687AB9C87B}.Profile.Build.0 = Release|Win32 |
||||
{99ACAECA-2C32-4E24-B162-26687AB9C87B}.Profile_FastCap.ActiveCfg = Release|Win32 |
||||
{99ACAECA-2C32-4E24-B162-26687AB9C87B}.Profile_FastCap.Build.0 = Release|Win32 |
||||
{99ACAECA-2C32-4E24-B162-26687AB9C87B}.Release.ActiveCfg = Release|Win32 |
||||
{99ACAECA-2C32-4E24-B162-26687AB9C87B}.Release.Build.0 = Release|Win32 |
||||
{99ACAECA-2C32-4E24-B162-26687AB9C87B}.Release_LTCG.ActiveCfg = Release|Win32 |
||||
{99ACAECA-2C32-4E24-B162-26687AB9C87B}.Release_LTCG.Build.0 = Release|Win32 |
||||
{170D8E27-945D-47E2-9031-F893E22C058F}.Debug.ActiveCfg = Debug|Win32 |
||||
{170D8E27-945D-47E2-9031-F893E22C058F}.Debug.Build.0 = Debug|Win32 |
||||
{170D8E27-945D-47E2-9031-F893E22C058F}.Profile.ActiveCfg = Release|Win32 |
||||
{170D8E27-945D-47E2-9031-F893E22C058F}.Profile.Build.0 = Release|Win32 |
||||
{170D8E27-945D-47E2-9031-F893E22C058F}.Profile_FastCap.ActiveCfg = Release|Win32 |
||||
{170D8E27-945D-47E2-9031-F893E22C058F}.Profile_FastCap.Build.0 = Release|Win32 |
||||
{170D8E27-945D-47E2-9031-F893E22C058F}.Release.ActiveCfg = Release|Win32 |
||||
{170D8E27-945D-47E2-9031-F893E22C058F}.Release.Build.0 = Release|Win32 |
||||
{170D8E27-945D-47E2-9031-F893E22C058F}.Release_LTCG.ActiveCfg = Release|Win32 |
||||
{170D8E27-945D-47E2-9031-F893E22C058F}.Release_LTCG.Build.0 = Release|Win32 |
||||
{4473BB4C-E512-45F8-A810-27A1688113DF}.Debug.ActiveCfg = Debug|Win32 |
||||
{4473BB4C-E512-45F8-A810-27A1688113DF}.Debug.Build.0 = Debug|Win32 |
||||
{4473BB4C-E512-45F8-A810-27A1688113DF}.Profile.ActiveCfg = Debug|Win32 |
||||
{4473BB4C-E512-45F8-A810-27A1688113DF}.Profile.Build.0 = Debug|Win32 |
||||
{4473BB4C-E512-45F8-A810-27A1688113DF}.Profile_FastCap.ActiveCfg = Debug|Win32 |
||||
{4473BB4C-E512-45F8-A810-27A1688113DF}.Profile_FastCap.Build.0 = Debug|Win32 |
||||
{4473BB4C-E512-45F8-A810-27A1688113DF}.Release.ActiveCfg = Release|Win32 |
||||
{4473BB4C-E512-45F8-A810-27A1688113DF}.Release.Build.0 = Release|Win32 |
||||
{4473BB4C-E512-45F8-A810-27A1688113DF}.Release_LTCG.ActiveCfg = Release|Win32 |
||||
{4473BB4C-E512-45F8-A810-27A1688113DF}.Release_LTCG.Build.0 = Release|Win32 |
||||
{716F7CB2-1E3A-4AB5-9E81-E5D61E972072}.Debug.ActiveCfg = Debug|Win32 |
||||
{716F7CB2-1E3A-4AB5-9E81-E5D61E972072}.Debug.Build.0 = Debug|Win32 |
||||
{716F7CB2-1E3A-4AB5-9E81-E5D61E972072}.Profile.ActiveCfg = Debug|Win32 |
||||
{716F7CB2-1E3A-4AB5-9E81-E5D61E972072}.Profile.Build.0 = Debug|Win32 |
||||
{716F7CB2-1E3A-4AB5-9E81-E5D61E972072}.Profile_FastCap.ActiveCfg = Debug|Win32 |
||||
{716F7CB2-1E3A-4AB5-9E81-E5D61E972072}.Profile_FastCap.Build.0 = Debug|Win32 |
||||
{716F7CB2-1E3A-4AB5-9E81-E5D61E972072}.Release.ActiveCfg = Release|Win32 |
||||
{716F7CB2-1E3A-4AB5-9E81-E5D61E972072}.Release.Build.0 = Release|Win32 |
||||
{716F7CB2-1E3A-4AB5-9E81-E5D61E972072}.Release_LTCG.ActiveCfg = Release|Win32 |
||||
{716F7CB2-1E3A-4AB5-9E81-E5D61E972072}.Release_LTCG.Build.0 = Release|Win32 |
||||
{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}.Debug.ActiveCfg = Debug|Xbox |
||||
{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}.Debug.Build.0 = Debug|Xbox |
||||
{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}.Profile.ActiveCfg = Profile|Xbox |
||||
{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}.Profile.Build.0 = Profile|Xbox |
||||
{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}.Profile_FastCap.ActiveCfg = Profile_FastCap|Xbox |
||||
{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}.Profile_FastCap.Build.0 = Profile_FastCap|Xbox |
||||
{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}.Release.ActiveCfg = Release|Xbox |
||||
{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}.Release.Build.0 = Release|Xbox |
||||
{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}.Release_LTCG.ActiveCfg = Release_LTCG|Xbox |
||||
{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}.Release_LTCG.Build.0 = Release_LTCG|Xbox |
||||
EndGlobalSection |
||||
GlobalSection(ExtensibilityGlobals) = postSolution |
||||
EndGlobalSection |
||||
GlobalSection(ExtensibilityAddIns) = postSolution |
||||
EndGlobalSection |
||||
EndGlobal |
@ -1,85 +0,0 @@
|
||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission. |
||||
*/ |
||||
|
||||
#define ASCII_A 0x41 |
||||
#define ASCII_B 0x42 |
||||
#define ASCII_C 0x43 |
||||
#define ASCII_D 0x44 |
||||
#define ASCII_E 0x45 |
||||
#define ASCII_F 0x46 |
||||
#define ASCII_G 0x47 |
||||
#define ASCII_H 0x48 |
||||
#define ASCII_I 0x49 |
||||
#define ASCII_J 0x4A |
||||
#define ASCII_K 0x4B |
||||
#define ASCII_L 0x4C |
||||
#define ASCII_M 0x4D |
||||
#define ASCII_N 0x4E |
||||
#define ASCII_O 0x4F |
||||
#define ASCII_P 0x50 |
||||
#define ASCII_Q 0x51 |
||||
#define ASCII_R 0x52 |
||||
#define ASCII_S 0x53 |
||||
#define ASCII_T 0x54 |
||||
#define ASCII_U 0x55 |
||||
#define ASCII_V 0x56 |
||||
#define ASCII_W 0x57 |
||||
#define ASCII_X 0x58 |
||||
#define ASCII_Y 0x59 |
||||
#define ASCII_Z 0x5A |
||||
|
||||
#define ASCII_a 0x61 |
||||
#define ASCII_b 0x62 |
||||
#define ASCII_c 0x63 |
||||
#define ASCII_d 0x64 |
||||
#define ASCII_e 0x65 |
||||
#define ASCII_f 0x66 |
||||
#define ASCII_g 0x67 |
||||
#define ASCII_h 0x68 |
||||
#define ASCII_i 0x69 |
||||
#define ASCII_j 0x6A |
||||
#define ASCII_k 0x6B |
||||
#define ASCII_l 0x6C |
||||
#define ASCII_m 0x6D |
||||
#define ASCII_n 0x6E |
||||
#define ASCII_o 0x6F |
||||
#define ASCII_p 0x70 |
||||
#define ASCII_q 0x71 |
||||
#define ASCII_r 0x72 |
||||
#define ASCII_s 0x73 |
||||
#define ASCII_t 0x74 |
||||
#define ASCII_u 0x75 |
||||
#define ASCII_v 0x76 |
||||
#define ASCII_w 0x77 |
||||
#define ASCII_x 0x78 |
||||
#define ASCII_y 0x79 |
||||
#define ASCII_z 0x7A |
||||
|
||||
#define ASCII_0 0x30 |
||||
#define ASCII_1 0x31 |
||||
#define ASCII_2 0x32 |
||||
#define ASCII_3 0x33 |
||||
#define ASCII_4 0x34 |
||||
#define ASCII_5 0x35 |
||||
#define ASCII_6 0x36 |
||||
#define ASCII_7 0x37 |
||||
#define ASCII_8 0x38 |
||||
#define ASCII_9 0x39 |
||||
|
||||
#define ASCII_TAB 0x09 |
||||
#define ASCII_SPACE 0x20 |
||||
#define ASCII_EXCL 0x21 |
||||
#define ASCII_QUOT 0x22 |
||||
#define ASCII_AMP 0x26 |
||||
#define ASCII_APOS 0x27 |
||||
#define ASCII_MINUS 0x2D |
||||
#define ASCII_PERIOD 0x2E |
||||
#define ASCII_COLON 0x3A |
||||
#define ASCII_SEMI 0x3B |
||||
#define ASCII_LT 0x3C |
||||
#define ASCII_EQUALS 0x3D |
||||
#define ASCII_GT 0x3E |
||||
#define ASCII_LSQB 0x5B |
||||
#define ASCII_RSQB 0x5D |
||||
#define ASCII_UNDERSCORE 0x5F |
@ -1,36 +0,0 @@
|
||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission. |
||||
*/ |
||||
|
||||
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, |
||||
/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, |
||||
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, |
||||
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, |
||||
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, |
||||
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, |
||||
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, |
||||
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, |
||||
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, |
||||
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, |
||||
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, |
||||
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, |
||||
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, |
||||
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, |
||||
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, |
||||
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, |
||||
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, |
||||
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, |
File diff suppressed because it is too large
Load Diff
@ -1,246 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?> |
||||
<VisualStudioProject |
||||
ProjectType="Visual C++" |
||||
Version="7.10" |
||||
Name="expat" |
||||
SccProjectName="" |
||||
SccLocalPath=""> |
||||
<Platforms> |
||||
<Platform |
||||
Name="Win32"/> |
||||
</Platforms> |
||||
<Configurations> |
||||
<Configuration |
||||
Name="Debug|Win32" |
||||
OutputDirectory=".\Debug" |
||||
IntermediateDirectory=".\Debug" |
||||
ConfigurationType="2" |
||||
UseOfMFC="0" |
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="_DEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_USRDLL" |
||||
BasicRuntimeChecks="3" |
||||
RuntimeLibrary="1" |
||||
PrecompiledHeaderFile=".\Debug/expat.pch" |
||||
AssemblerListingLocation=".\Debug/" |
||||
ObjectFile=".\Debug/" |
||||
ProgramDataBaseFileName=".\Debug/" |
||||
BrowseInformation="1" |
||||
WarningLevel="3" |
||||
SuppressStartupBanner="TRUE" |
||||
DebugInformationFormat="4"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLinkerTool" |
||||
OutputFile="Debug\libexpat.dll" |
||||
LinkIncremental="2" |
||||
SuppressStartupBanner="TRUE" |
||||
ModuleDefinitionFile=".\libexpat.def" |
||||
GenerateDebugInformation="TRUE" |
||||
ImportLibrary=".\Debug/libexpat.lib" |
||||
TargetMachine="1"/> |
||||
<Tool |
||||
Name="VCMIDLTool" |
||||
PreprocessorDefinitions="_DEBUG" |
||||
MkTypLibCompatible="TRUE" |
||||
SuppressStartupBanner="TRUE" |
||||
TargetEnvironment="1" |
||||
TypeLibraryName=".\Debug/expat.tlb" |
||||
HeaderFileName=""/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
<Tool |
||||
Name="VCResourceCompilerTool" |
||||
PreprocessorDefinitions="_DEBUG" |
||||
Culture="1033"/> |
||||
<Tool |
||||
Name="VCWebServiceProxyGeneratorTool"/> |
||||
<Tool |
||||
Name="VCXMLDataGeneratorTool"/> |
||||
<Tool |
||||
Name="VCWebDeploymentTool"/> |
||||
<Tool |
||||
Name="VCManagedWrapperGeneratorTool"/> |
||||
<Tool |
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> |
||||
</Configuration> |
||||
<Configuration |
||||
Name="Release|Win32" |
||||
OutputDirectory=".\Release" |
||||
IntermediateDirectory=".\Release" |
||||
ConfigurationType="2" |
||||
UseOfMFC="0" |
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
InlineFunctionExpansion="1" |
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;COMPILED_FROM_DSP" |
||||
StringPooling="TRUE" |
||||
RuntimeLibrary="0" |
||||
EnableFunctionLevelLinking="TRUE" |
||||
PrecompiledHeaderFile=".\Release/expat.pch" |
||||
AssemblerListingLocation=".\Release/" |
||||
ObjectFile=".\Release/" |
||||
ProgramDataBaseFileName=".\Release/" |
||||
WarningLevel="3" |
||||
SuppressStartupBanner="TRUE"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLinkerTool" |
||||
OutputFile="Release\libexpat.dll" |
||||
LinkIncremental="1" |
||||
SuppressStartupBanner="TRUE" |
||||
ModuleDefinitionFile=".\libexpat.def" |
||||
ImportLibrary=".\Release/libexpat.lib" |
||||
TargetMachine="1"/> |
||||
<Tool |
||||
Name="VCMIDLTool" |
||||
PreprocessorDefinitions="NDEBUG" |
||||
MkTypLibCompatible="TRUE" |
||||
SuppressStartupBanner="TRUE" |
||||
TargetEnvironment="1" |
||||
TypeLibraryName=".\Release/expat.tlb" |
||||
HeaderFileName=""/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
<Tool |
||||
Name="VCResourceCompilerTool" |
||||
PreprocessorDefinitions="NDEBUG" |
||||
Culture="1033"/> |
||||
<Tool |
||||
Name="VCWebServiceProxyGeneratorTool"/> |
||||
<Tool |
||||
Name="VCXMLDataGeneratorTool"/> |
||||
<Tool |
||||
Name="VCWebDeploymentTool"/> |
||||
<Tool |
||||
Name="VCManagedWrapperGeneratorTool"/> |
||||
<Tool |
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> |
||||
</Configuration> |
||||
</Configurations> |
||||
<References> |
||||
</References> |
||||
<Files> |
||||
<Filter |
||||
Name="Source Files" |
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> |
||||
<File |
||||
RelativePath="libexpat.def"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmlparse.c"> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="_DEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)" |
||||
ExceptionHandling="FALSE" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;COMPILED_FROM_DSP;$(NoInherit)"/> |
||||
</FileConfiguration> |
||||
</File> |
||||
<File |
||||
RelativePath="xmlrole.c"> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="_DEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;COMPILED_FROM_DSP;$(NoInherit)"/> |
||||
</FileConfiguration> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok.c"> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="_DEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;COMPILED_FROM_DSP;$(NoInherit)"/> |
||||
</FileConfiguration> |
||||
</File> |
||||
</Filter> |
||||
<Filter |
||||
Name="Header Files" |
||||
Filter="h;hpp;hxx;hm;inl"> |
||||
<File |
||||
RelativePath="ascii.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="asciitab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="expat.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="iasciitab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="latin1tab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="nametab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="utf8tab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmlrole.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok_impl.h"> |
||||
</File> |
||||
</Filter> |
||||
<Filter |
||||
Name="Resource Files" |
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> |
||||
</Filter> |
||||
</Files> |
||||
<Globals> |
||||
</Globals> |
||||
</VisualStudioProject> |
@ -1,213 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?> |
||||
<VisualStudioProject |
||||
ProjectType="Visual C++" |
||||
Version="7.10" |
||||
Name="expat_static" |
||||
SccProjectName="" |
||||
SccLocalPath=""> |
||||
<Platforms> |
||||
<Platform |
||||
Name="Win32"/> |
||||
</Platforms> |
||||
<Configurations> |
||||
<Configuration |
||||
Name="Debug|Win32" |
||||
OutputDirectory=".\Debug_static" |
||||
IntermediateDirectory=".\Debug_static" |
||||
ConfigurationType="4" |
||||
UseOfMFC="0" |
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;COMPILED_FROM_DSP;_LIB" |
||||
BasicRuntimeChecks="3" |
||||
RuntimeLibrary="1" |
||||
PrecompiledHeaderFile=".\Debug_static/expat_static.pch" |
||||
AssemblerListingLocation=".\Debug_static/" |
||||
ObjectFile=".\Debug_static/" |
||||
ProgramDataBaseFileName=".\Debug_static/" |
||||
BrowseInformation="1" |
||||
WarningLevel="3" |
||||
SuppressStartupBanner="TRUE" |
||||
DebugInformationFormat="4"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLibrarianTool" |
||||
OutputFile="Debug_static\libexpatMT.lib" |
||||
SuppressStartupBanner="TRUE"/> |
||||
<Tool |
||||
Name="VCMIDLTool"/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
<Tool |
||||
Name="VCResourceCompilerTool" |
||||
PreprocessorDefinitions="_DEBUG" |
||||
Culture="1033"/> |
||||
<Tool |
||||
Name="VCWebServiceProxyGeneratorTool"/> |
||||
<Tool |
||||
Name="VCXMLDataGeneratorTool"/> |
||||
<Tool |
||||
Name="VCManagedWrapperGeneratorTool"/> |
||||
<Tool |
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> |
||||
</Configuration> |
||||
<Configuration |
||||
Name="Release|Win32" |
||||
OutputDirectory=".\Release_static" |
||||
IntermediateDirectory=".\Release_static" |
||||
ConfigurationType="4" |
||||
UseOfMFC="0" |
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
InlineFunctionExpansion="1" |
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP" |
||||
StringPooling="TRUE" |
||||
RuntimeLibrary="0" |
||||
EnableFunctionLevelLinking="TRUE" |
||||
PrecompiledHeaderFile=".\Release_static/expat_static.pch" |
||||
AssemblerListingLocation=".\Release_static/" |
||||
ObjectFile=".\Release_static/" |
||||
ProgramDataBaseFileName=".\Release_static/" |
||||
WarningLevel="3" |
||||
SuppressStartupBanner="TRUE"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLibrarianTool" |
||||
OutputFile="Release_static\libexpatMT.lib" |
||||
SuppressStartupBanner="TRUE"/> |
||||
<Tool |
||||
Name="VCMIDLTool"/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
<Tool |
||||
Name="VCResourceCompilerTool" |
||||
PreprocessorDefinitions="NDEBUG" |
||||
Culture="1033"/> |
||||
<Tool |
||||
Name="VCWebServiceProxyGeneratorTool"/> |
||||
<Tool |
||||
Name="VCXMLDataGeneratorTool"/> |
||||
<Tool |
||||
Name="VCManagedWrapperGeneratorTool"/> |
||||
<Tool |
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> |
||||
</Configuration> |
||||
</Configurations> |
||||
<References> |
||||
</References> |
||||
<Files> |
||||
<Filter |
||||
Name="Source Files" |
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> |
||||
<File |
||||
RelativePath="xmlparse.c"> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions=""/> |
||||
</FileConfiguration> |
||||
</File> |
||||
<File |
||||
RelativePath="xmlrole.c"> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions=""/> |
||||
</FileConfiguration> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok.c"> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions=""/> |
||||
</FileConfiguration> |
||||
</File> |
||||
</Filter> |
||||
<Filter |
||||
Name="Header Files" |
||||
Filter="h;hpp;hxx;hm;inl"> |
||||
<File |
||||
RelativePath="ascii.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="asciitab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="expat.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="iasciitab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="latin1tab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="nametab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="utf8tab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmlrole.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok_impl.h"> |
||||
</File> |
||||
</Filter> |
||||
</Files> |
||||
<Globals> |
||||
</Globals> |
||||
</VisualStudioProject> |
@ -1,246 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?> |
||||
<VisualStudioProject |
||||
ProjectType="Visual C++" |
||||
Version="7.10" |
||||
Name="expatw" |
||||
SccProjectName="" |
||||
SccLocalPath=""> |
||||
<Platforms> |
||||
<Platform |
||||
Name="Win32"/> |
||||
</Platforms> |
||||
<Configurations> |
||||
<Configuration |
||||
Name="Release|Win32" |
||||
OutputDirectory=".\Release-w" |
||||
IntermediateDirectory=".\Release-w" |
||||
ConfigurationType="2" |
||||
UseOfMFC="0" |
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
InlineFunctionExpansion="1" |
||||
PreprocessorDefinitions="NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_USRDLL;XML_UNICODE_WCHAR_T" |
||||
StringPooling="TRUE" |
||||
RuntimeLibrary="0" |
||||
EnableFunctionLevelLinking="TRUE" |
||||
PrecompiledHeaderFile=".\Release-w/expatw.pch" |
||||
AssemblerListingLocation=".\Release-w/" |
||||
ObjectFile=".\Release-w/" |
||||
ProgramDataBaseFileName=".\Release-w/" |
||||
WarningLevel="3" |
||||
SuppressStartupBanner="TRUE"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLinkerTool" |
||||
OutputFile="Release-w\libexpatw.dll" |
||||
LinkIncremental="1" |
||||
SuppressStartupBanner="TRUE" |
||||
ModuleDefinitionFile=".\libexpatw.def" |
||||
ImportLibrary=".\Release-w/libexpatw.lib" |
||||
TargetMachine="1"/> |
||||
<Tool |
||||
Name="VCMIDLTool" |
||||
PreprocessorDefinitions="NDEBUG" |
||||
MkTypLibCompatible="TRUE" |
||||
SuppressStartupBanner="TRUE" |
||||
TargetEnvironment="1" |
||||
TypeLibraryName=".\Release-w/expatw.tlb" |
||||
HeaderFileName=""/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
<Tool |
||||
Name="VCResourceCompilerTool" |
||||
PreprocessorDefinitions="NDEBUG" |
||||
Culture="1033"/> |
||||
<Tool |
||||
Name="VCWebServiceProxyGeneratorTool"/> |
||||
<Tool |
||||
Name="VCXMLDataGeneratorTool"/> |
||||
<Tool |
||||
Name="VCWebDeploymentTool"/> |
||||
<Tool |
||||
Name="VCManagedWrapperGeneratorTool"/> |
||||
<Tool |
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> |
||||
</Configuration> |
||||
<Configuration |
||||
Name="Debug|Win32" |
||||
OutputDirectory=".\Debug-w" |
||||
IntermediateDirectory=".\Debug-w" |
||||
ConfigurationType="2" |
||||
UseOfMFC="0" |
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="_DEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_USRDLL;XML_UNICODE_WCHAR_T" |
||||
BasicRuntimeChecks="3" |
||||
RuntimeLibrary="1" |
||||
PrecompiledHeaderFile=".\Debug-w/expatw.pch" |
||||
AssemblerListingLocation=".\Debug-w/" |
||||
ObjectFile=".\Debug-w/" |
||||
ProgramDataBaseFileName=".\Debug-w/" |
||||
BrowseInformation="1" |
||||
WarningLevel="3" |
||||
SuppressStartupBanner="TRUE" |
||||
DebugInformationFormat="4"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLinkerTool" |
||||
OutputFile="Debug-w\libexpatw.dll" |
||||
LinkIncremental="2" |
||||
SuppressStartupBanner="TRUE" |
||||
ModuleDefinitionFile=".\libexpatw.def" |
||||
GenerateDebugInformation="TRUE" |
||||
ImportLibrary=".\Debug-w/libexpatw.lib" |
||||
TargetMachine="1"/> |
||||
<Tool |
||||
Name="VCMIDLTool" |
||||
PreprocessorDefinitions="_DEBUG" |
||||
MkTypLibCompatible="TRUE" |
||||
SuppressStartupBanner="TRUE" |
||||
TargetEnvironment="1" |
||||
TypeLibraryName=".\Debug-w/expatw.tlb" |
||||
HeaderFileName=""/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
<Tool |
||||
Name="VCResourceCompilerTool" |
||||
PreprocessorDefinitions="_DEBUG" |
||||
Culture="1033"/> |
||||
<Tool |
||||
Name="VCWebServiceProxyGeneratorTool"/> |
||||
<Tool |
||||
Name="VCXMLDataGeneratorTool"/> |
||||
<Tool |
||||
Name="VCWebDeploymentTool"/> |
||||
<Tool |
||||
Name="VCManagedWrapperGeneratorTool"/> |
||||
<Tool |
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> |
||||
</Configuration> |
||||
</Configurations> |
||||
<References> |
||||
</References> |
||||
<Files> |
||||
<Filter |
||||
Name="Source Files" |
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> |
||||
<File |
||||
RelativePath="libexpatw.def"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmlparse.c"> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions="NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;XML_UNICODE_WCHAR_T;$(NoInherit)"/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="_DEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;XML_UNICODE_WCHAR_T;$(NoInherit)" |
||||
ExceptionHandling="FALSE" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
</File> |
||||
<File |
||||
RelativePath="xmlrole.c"> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions="NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;XML_UNICODE_WCHAR_T;$(NoInherit)"/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="_DEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;XML_UNICODE_WCHAR_T;$(NoInherit)" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok.c"> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions="NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;XML_UNICODE_WCHAR_T;$(NoInherit)"/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="_DEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;XML_UNICODE_WCHAR_T;$(NoInherit)" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
</File> |
||||
</Filter> |
||||
<Filter |
||||
Name="Header Files" |
||||
Filter="h;hpp;hxx;hm;inl"> |
||||
<File |
||||
RelativePath="ascii.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="asciitab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="expat.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="iasciitab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="latin1tab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="nametab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="utf8tab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmlrole.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok_impl.h"> |
||||
</File> |
||||
</Filter> |
||||
<Filter |
||||
Name="Resource Files" |
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> |
||||
</Filter> |
||||
</Files> |
||||
<Globals> |
||||
</Globals> |
||||
</VisualStudioProject> |
@ -1,213 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?> |
||||
<VisualStudioProject |
||||
ProjectType="Visual C++" |
||||
Version="7.10" |
||||
Name="expatw_static" |
||||
SccProjectName="" |
||||
SccLocalPath=""> |
||||
<Platforms> |
||||
<Platform |
||||
Name="Win32"/> |
||||
</Platforms> |
||||
<Configurations> |
||||
<Configuration |
||||
Name="Release|Win32" |
||||
OutputDirectory=".\Release-w_static" |
||||
IntermediateDirectory=".\Release-w_static" |
||||
ConfigurationType="4" |
||||
UseOfMFC="0" |
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
InlineFunctionExpansion="1" |
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T" |
||||
StringPooling="TRUE" |
||||
RuntimeLibrary="0" |
||||
EnableFunctionLevelLinking="TRUE" |
||||
PrecompiledHeaderFile=".\Release-w_static/expatw_static.pch" |
||||
AssemblerListingLocation=".\Release-w_static/" |
||||
ObjectFile=".\Release-w_static/" |
||||
ProgramDataBaseFileName=".\Release-w_static/" |
||||
WarningLevel="3" |
||||
SuppressStartupBanner="TRUE"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLibrarianTool" |
||||
OutputFile="Release-w_static\libexpatwMT.lib" |
||||
SuppressStartupBanner="TRUE"/> |
||||
<Tool |
||||
Name="VCMIDLTool"/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
<Tool |
||||
Name="VCResourceCompilerTool" |
||||
PreprocessorDefinitions="NDEBUG" |
||||
Culture="1033"/> |
||||
<Tool |
||||
Name="VCWebServiceProxyGeneratorTool"/> |
||||
<Tool |
||||
Name="VCXMLDataGeneratorTool"/> |
||||
<Tool |
||||
Name="VCManagedWrapperGeneratorTool"/> |
||||
<Tool |
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> |
||||
</Configuration> |
||||
<Configuration |
||||
Name="Debug|Win32" |
||||
OutputDirectory=".\Debug-w_static" |
||||
IntermediateDirectory=".\Debug-w_static" |
||||
ConfigurationType="4" |
||||
UseOfMFC="0" |
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;COMPILED_FROM_DSP;_LIB" |
||||
BasicRuntimeChecks="3" |
||||
RuntimeLibrary="1" |
||||
PrecompiledHeaderFile=".\Debug-w_static/expatw_static.pch" |
||||
AssemblerListingLocation=".\Debug-w_static/" |
||||
ObjectFile=".\Debug-w_static/" |
||||
ProgramDataBaseFileName=".\Debug-w_static/" |
||||
BrowseInformation="1" |
||||
WarningLevel="3" |
||||
SuppressStartupBanner="TRUE" |
||||
DebugInformationFormat="4"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLibrarianTool" |
||||
OutputFile="Debug-w_static\libexpatwMT.lib" |
||||
SuppressStartupBanner="TRUE"/> |
||||
<Tool |
||||
Name="VCMIDLTool"/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
<Tool |
||||
Name="VCResourceCompilerTool" |
||||
PreprocessorDefinitions="_DEBUG" |
||||
Culture="1033"/> |
||||
<Tool |
||||
Name="VCWebServiceProxyGeneratorTool"/> |
||||
<Tool |
||||
Name="VCXMLDataGeneratorTool"/> |
||||
<Tool |
||||
Name="VCManagedWrapperGeneratorTool"/> |
||||
<Tool |
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> |
||||
</Configuration> |
||||
</Configurations> |
||||
<References> |
||||
</References> |
||||
<Files> |
||||
<Filter |
||||
Name="Source Files" |
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> |
||||
<File |
||||
RelativePath="xmlparse.c"> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions=""/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
</File> |
||||
<File |
||||
RelativePath="xmlrole.c"> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions=""/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok.c"> |
||||
<FileConfiguration |
||||
Name="Release|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="2" |
||||
PreprocessorDefinitions=""/> |
||||
</FileConfiguration> |
||||
<FileConfiguration |
||||
Name="Debug|Win32"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
PreprocessorDefinitions="" |
||||
BasicRuntimeChecks="3" |
||||
BrowseInformation="1"/> |
||||
</FileConfiguration> |
||||
</File> |
||||
</Filter> |
||||
<Filter |
||||
Name="Header Files" |
||||
Filter="h;hpp;hxx;hm;inl"> |
||||
<File |
||||
RelativePath="ascii.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="asciitab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="expat.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="iasciitab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="latin1tab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="nametab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="utf8tab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmlrole.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok.h"> |
||||
</File> |
||||
<File |
||||
RelativePath="xmltok_impl.h"> |
||||
</File> |
||||
</Filter> |
||||
</Files> |
||||
<Globals> |
||||
</Globals> |
||||
</VisualStudioProject> |
@ -1,239 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?> |
||||
<VisualStudioProject |
||||
ProjectType="Visual C++" |
||||
Version="7.10" |
||||
Name="expatw_static_xbox" |
||||
ProjectGUID="{8357A40B-7550-41E2-AFEE-AEFB1C3403FB}" |
||||
Keyword="XboxProj"> |
||||
<Platforms> |
||||
<Platform |
||||
Name="Xbox"/> |
||||
</Platforms> |
||||
<Configurations> |
||||
<Configuration |
||||
Name="Debug|Xbox" |
||||
OutputDirectory="Debug" |
||||
IntermediateDirectory="Debug" |
||||
ConfigurationType="4" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="0" |
||||
OptimizeForProcessor="2" |
||||
PreprocessorDefinitions="_DEBUG;_XBOX;_LIB" |
||||
MinimalRebuild="TRUE" |
||||
BasicRuntimeChecks="3" |
||||
RuntimeLibrary="1" |
||||
EnableEnhancedInstructionSet="1" |
||||
UsePrecompiledHeader="0" |
||||
PrecompiledHeaderFile="$(OutDir)/$(ProjectName).pch" |
||||
WarningLevel="3" |
||||
Detect64BitPortabilityProblems="FALSE" |
||||
DebugInformationFormat="4"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLibrarianTool" |
||||
OutputFile="$(OutDir)/$(ProjectName).lib"/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
</Configuration> |
||||
<Configuration |
||||
Name="Profile|Xbox" |
||||
OutputDirectory="Profile" |
||||
IntermediateDirectory="Profile" |
||||
ConfigurationType="4" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="3" |
||||
OmitFramePointers="TRUE" |
||||
OptimizeForProcessor="2" |
||||
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;_LIB" |
||||
StringPooling="TRUE" |
||||
RuntimeLibrary="0" |
||||
BufferSecurityCheck="TRUE" |
||||
EnableFunctionLevelLinking="TRUE" |
||||
EnableEnhancedInstructionSet="1" |
||||
UsePrecompiledHeader="0" |
||||
PrecompiledHeaderFile="$(OutDir)/$(ProjectName).pch" |
||||
WarningLevel="3" |
||||
Detect64BitPortabilityProblems="FALSE" |
||||
DebugInformationFormat="3"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLibrarianTool" |
||||
OutputFile="$(OutDir)/$(ProjectName).lib"/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
</Configuration> |
||||
<Configuration |
||||
Name="Profile_FastCap|Xbox" |
||||
OutputDirectory="Profile_FastCap" |
||||
IntermediateDirectory="Profile_FastCap" |
||||
ConfigurationType="4" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="3" |
||||
OmitFramePointers="TRUE" |
||||
OptimizeForProcessor="2" |
||||
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;FASTCAP;_LIB" |
||||
StringPooling="TRUE" |
||||
RuntimeLibrary="0" |
||||
BufferSecurityCheck="TRUE" |
||||
EnableFunctionLevelLinking="TRUE" |
||||
EnableEnhancedInstructionSet="1" |
||||
UsePrecompiledHeader="0" |
||||
PrecompiledHeaderFile="$(OutDir)/$(ProjectName).pch" |
||||
WarningLevel="3" |
||||
Detect64BitPortabilityProblems="FALSE" |
||||
DebugInformationFormat="3" |
||||
FastCAP="TRUE"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLibrarianTool" |
||||
OutputFile="$(OutDir)/$(ProjectName).lib"/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
</Configuration> |
||||
<Configuration |
||||
Name="Release|Xbox" |
||||
OutputDirectory="Release" |
||||
IntermediateDirectory="Release" |
||||
ConfigurationType="4" |
||||
CharacterSet="2"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="3" |
||||
OmitFramePointers="TRUE" |
||||
OptimizeForProcessor="2" |
||||
PreprocessorDefinitions="NDEBUG;_XBOX;_LIB,COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T" |
||||
StringPooling="TRUE" |
||||
RuntimeLibrary="0" |
||||
BufferSecurityCheck="TRUE" |
||||
EnableFunctionLevelLinking="TRUE" |
||||
EnableEnhancedInstructionSet="1" |
||||
UsePrecompiledHeader="0" |
||||
PrecompiledHeaderFile="$(OutDir)/$(ProjectName).pch" |
||||
WarningLevel="3" |
||||
Detect64BitPortabilityProblems="FALSE" |
||||
DebugInformationFormat="3"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLibrarianTool" |
||||
OutputFile="$(OutDir)/$(ProjectName).lib"/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
</Configuration> |
||||
<Configuration |
||||
Name="Release_LTCG|Xbox" |
||||
OutputDirectory="Release_LTCG" |
||||
IntermediateDirectory="Release_LTCG" |
||||
ConfigurationType="4" |
||||
CharacterSet="2" |
||||
WholeProgramOptimization="TRUE"> |
||||
<Tool |
||||
Name="VCCLCompilerTool" |
||||
Optimization="3" |
||||
OmitFramePointers="TRUE" |
||||
OptimizeForProcessor="2" |
||||
PreprocessorDefinitions="NDEBUG;_XBOX;LTCG;_LIB" |
||||
StringPooling="TRUE" |
||||
RuntimeLibrary="0" |
||||
BufferSecurityCheck="TRUE" |
||||
EnableFunctionLevelLinking="TRUE" |
||||
EnableEnhancedInstructionSet="1" |
||||
UsePrecompiledHeader="0" |
||||
PrecompiledHeaderFile="$(OutDir)/$(ProjectName).pch" |
||||
WarningLevel="3" |
||||
Detect64BitPortabilityProblems="FALSE" |
||||
DebugInformationFormat="3"/> |
||||
<Tool |
||||
Name="VCCustomBuildTool"/> |
||||
<Tool |
||||
Name="VCLibrarianTool" |
||||
OutputFile="$(OutDir)/$(ProjectName).lib"/> |
||||
<Tool |
||||
Name="VCPostBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreBuildEventTool"/> |
||||
<Tool |
||||
Name="VCPreLinkEventTool"/> |
||||
</Configuration> |
||||
</Configurations> |
||||
<References> |
||||
</References> |
||||
<Files> |
||||
<Filter |
||||
Name="Source Files" |
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" |
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> |
||||
<File |
||||
RelativePath=".\xmlparse.c"> |
||||
</File> |
||||
<File |
||||
RelativePath=".\xmlrole.c"> |
||||
</File> |
||||
<File |
||||
RelativePath=".\xmltok.c"> |
||||
</File> |
||||
</Filter> |
||||
<Filter |
||||
Name="Header Files" |
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd" |
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> |
||||
<File |
||||
RelativePath=".\ascii.h"> |
||||
</File> |
||||
<File |
||||
RelativePath=".\asciitab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath=".\expat.h"> |
||||
</File> |
||||
<File |
||||
RelativePath=".\iasciitab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath=".\latin1tab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath=".\nametab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath=".\utf8tab.h"> |
||||
</File> |
||||
<File |
||||
RelativePath=".\xmlrole.h"> |
||||
</File> |
||||
<File |
||||
RelativePath=".\xmltok.h"> |
||||
</File> |
||||
<File |
||||
RelativePath=".\xmltok_impl.h"> |
||||
</File> |
||||
</Filter> |
||||
</Files> |
||||
<Globals> |
||||
</Globals> |
||||
</VisualStudioProject> |
@ -1,37 +0,0 @@
|
||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission. |
||||
*/ |
||||
|
||||
/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ |
||||
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, |
||||
/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, |
||||
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, |
||||
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, |
||||
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, |
||||
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, |
||||
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, |
||||
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, |
||||
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, |
||||
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, |
||||
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, |
||||
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, |
||||
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, |
||||
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, |
||||
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, |
||||
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, |
||||
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, |
||||
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, |
@ -1,73 +0,0 @@
|
||||
/* internal.h
|
||||
|
||||
Internal definitions used by Expat. This is not needed to compile |
||||
client code. |
||||
|
||||
The following calling convention macros are defined for frequently |
||||
called functions: |
||||
|
||||
FASTCALL - Used for those internal functions that have a simple |
||||
body and a low number of arguments and local variables. |
||||
|
||||
PTRCALL - Used for functions called though function pointers. |
||||
|
||||
PTRFASTCALL - Like PTRCALL, but for low number of arguments. |
||||
|
||||
inline - Used for selected internal functions for which inlining |
||||
may improve performance on some platforms. |
||||
|
||||
Note: Use of these macros is based on judgement, not hard rules, |
||||
and therefore subject to change. |
||||
*/ |
||||
|
||||
#if defined(__GNUC__) && defined(__i386__) |
||||
/* We'll use this version by default only where we know it helps.
|
||||
|
||||
regparm() generates warnings on Solaris boxes. See SF bug #692878. |
||||
|
||||
Instability reported with egcs on a RedHat Linux 7.3. |
||||
Let's comment out: |
||||
#define FASTCALL __attribute__((stdcall, regparm(3))) |
||||
and let's try this: |
||||
*/ |
||||
#define FASTCALL __attribute__((regparm(3))) |
||||
#define PTRFASTCALL __attribute__((regparm(3))) |
||||
#endif |
||||
|
||||
/* Using __fastcall seems to have an unexpected negative effect under
|
||||
MS VC++, especially for function pointers, so we won't use it for |
||||
now on that platform. It may be reconsidered for a future release |
||||
if it can be made more effective. |
||||
Likely reason: __fastcall on Windows is like stdcall, therefore |
||||
the compiler cannot perform stack optimizations for call clusters. |
||||
*/ |
||||
|
||||
/* Make sure all of these are defined if they aren't already. */ |
||||
|
||||
#ifndef FASTCALL |
||||
#define FASTCALL |
||||
#endif |
||||
|
||||
#ifndef PTRCALL |
||||
#define PTRCALL |
||||
#endif |
||||
|
||||
#ifndef PTRFASTCALL |
||||
#define PTRFASTCALL |
||||
#endif |
||||
|
||||
#ifndef XML_MIN_SIZE |
||||
#if !defined(__cplusplus) && !defined(inline) |
||||
#ifdef __GNUC__ |
||||
#define inline __inline |
||||
#endif /* __GNUC__ */ |
||||
#endif |
||||
#endif /* XML_MIN_SIZE */ |
||||
|
||||
#ifdef __cplusplus |
||||
#define inline inline |
||||
#else |
||||
#ifndef inline |
||||
#define inline |
||||
#endif |
||||
#endif |
@ -1,36 +0,0 @@
|
||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission. |
||||
*/ |
||||
|
||||
/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, |
||||
/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, |
||||
/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, |
||||
/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, |
||||
/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, |
||||
/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, |
||||
/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
||||
/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, |
@ -1,69 +0,0 @@
|
||||
; DEF file for MS VC++ |
||||
LIBRARY LIBEXPAT |
||||
DESCRIPTION "Implements an XML parser." |
||||
EXPORTS |
||||
XML_DefaultCurrent @1 |
||||
XML_ErrorString @2 |
||||
XML_ExpatVersion @3 |
||||
XML_ExpatVersionInfo @4 |
||||
XML_ExternalEntityParserCreate @5 |
||||
XML_GetBase @6 |
||||
XML_GetBuffer @7 |
||||
XML_GetCurrentByteCount @8 |
||||
XML_GetCurrentByteIndex @9 |
||||
XML_GetCurrentColumnNumber @10 |
||||
XML_GetCurrentLineNumber @11 |
||||
XML_GetErrorCode @12 |
||||
XML_GetIdAttributeIndex @13 |
||||
XML_GetInputContext @14 |
||||
XML_GetSpecifiedAttributeCount @15 |
||||
XML_Parse @16 |
||||
XML_ParseBuffer @17 |
||||
XML_ParserCreate @18 |
||||
XML_ParserCreateNS @19 |
||||
XML_ParserCreate_MM @20 |
||||
XML_ParserFree @21 |
||||
XML_SetAttlistDeclHandler @22 |
||||
XML_SetBase @23 |
||||
XML_SetCdataSectionHandler @24 |
||||
XML_SetCharacterDataHandler @25 |
||||
XML_SetCommentHandler @26 |
||||
XML_SetDefaultHandler @27 |
||||
XML_SetDefaultHandlerExpand @28 |
||||
XML_SetDoctypeDeclHandler @29 |
||||
XML_SetElementDeclHandler @30 |
||||
XML_SetElementHandler @31 |
||||
XML_SetEncoding @32 |
||||
XML_SetEndCdataSectionHandler @33 |
||||
XML_SetEndDoctypeDeclHandler @34 |
||||
XML_SetEndElementHandler @35 |
||||
XML_SetEndNamespaceDeclHandler @36 |
||||
XML_SetEntityDeclHandler @37 |
||||
XML_SetExternalEntityRefHandler @38 |
||||
XML_SetExternalEntityRefHandlerArg @39 |
||||
XML_SetNamespaceDeclHandler @40 |
||||
XML_SetNotStandaloneHandler @41 |
||||
XML_SetNotationDeclHandler @42 |
||||
XML_SetParamEntityParsing @43 |
||||
XML_SetProcessingInstructionHandler @44 |
||||
XML_SetReturnNSTriplet @45 |
||||
XML_SetStartCdataSectionHandler @46 |
||||
XML_SetStartDoctypeDeclHandler @47 |
||||
XML_SetStartElementHandler @48 |
||||
XML_SetStartNamespaceDeclHandler @49 |
||||
XML_SetUnknownEncodingHandler @50 |
||||
XML_SetUnparsedEntityDeclHandler @51 |
||||
XML_SetUserData @52 |
||||
XML_SetXmlDeclHandler @53 |
||||
XML_UseParserAsHandlerArg @54 |
||||
; added with version 1.95.3 |
||||
XML_ParserReset @55 |
||||
XML_SetSkippedEntityHandler @56 |
||||
; added with version 1.95.5 |
||||
XML_GetFeatureList @57 |
||||
XML_UseForeignDTD @58 |
||||
; added with version 1.95.6 |
||||
XML_FreeContentModel @59 |
||||
XML_MemMalloc @60 |
||||
XML_MemRealloc @61 |
||||
XML_MemFree @62 |
@ -1,69 +0,0 @@
|
||||
; DEF file for MS VC++ |
||||
LIBRARY LIBEXPATW |
||||
DESCRIPTION "Implements an XML parser." |
||||
EXPORTS |
||||
XML_DefaultCurrent @1 |
||||
XML_ErrorString @2 |
||||
XML_ExpatVersion @3 |
||||
XML_ExpatVersionInfo @4 |
||||
XML_ExternalEntityParserCreate @5 |
||||
XML_GetBase @6 |
||||
XML_GetBuffer @7 |
||||
XML_GetCurrentByteCount @8 |
||||
XML_GetCurrentByteIndex @9 |
||||
XML_GetCurrentColumnNumber @10 |
||||
XML_GetCurrentLineNumber @11 |
||||
XML_GetErrorCode @12 |
||||
XML_GetIdAttributeIndex @13 |
||||
XML_GetInputContext @14 |
||||
XML_GetSpecifiedAttributeCount @15 |
||||
XML_Parse @16 |
||||
XML_ParseBuffer @17 |
||||
XML_ParserCreate @18 |
||||
XML_ParserCreateNS @19 |
||||
XML_ParserCreate_MM @20 |
||||
XML_ParserFree @21 |
||||
XML_SetAttlistDeclHandler @22 |
||||
XML_SetBase @23 |
||||
XML_SetCdataSectionHandler @24 |
||||
XML_SetCharacterDataHandler @25 |
||||
XML_SetCommentHandler @26 |
||||
XML_SetDefaultHandler @27 |
||||
XML_SetDefaultHandlerExpand @28 |
||||
XML_SetDoctypeDeclHandler @29 |
||||
XML_SetElementDeclHandler @30 |
||||
XML_SetElementHandler @31 |
||||
XML_SetEncoding @32 |
||||
XML_SetEndCdataSectionHandler @33 |
||||
XML_SetEndDoctypeDeclHandler @34 |
||||
XML_SetEndElementHandler @35 |
||||
XML_SetEndNamespaceDeclHandler @36 |
||||
XML_SetEntityDeclHandler @37 |
||||
XML_SetExternalEntityRefHandler @38 |
||||
XML_SetExternalEntityRefHandlerArg @39 |
||||
XML_SetNamespaceDeclHandler @40 |
||||
XML_SetNotStandaloneHandler @41 |
||||
XML_SetNotationDeclHandler @42 |
||||
XML_SetParamEntityParsing @43 |
||||
XML_SetProcessingInstructionHandler @44 |
||||
XML_SetReturnNSTriplet @45 |
||||
XML_SetStartCdataSectionHandler @46 |
||||
XML_SetStartDoctypeDeclHandler @47 |
||||
XML_SetStartElementHandler @48 |
||||
XML_SetStartNamespaceDeclHandler @49 |
||||
XML_SetUnknownEncodingHandler @50 |
||||
XML_SetUnparsedEntityDeclHandler @51 |
||||
XML_SetUserData @52 |
||||
XML_SetXmlDeclHandler @53 |
||||
XML_UseParserAsHandlerArg @54 |
||||
; added with version 1.95.3 |
||||
XML_ParserReset @55 |
||||
XML_SetSkippedEntityHandler @56 |
||||
; added with version 1.95.5 |
||||
XML_GetFeatureList @57 |
||||
XML_UseForeignDTD @58 |
||||
; added with version 1.95.6 |
||||
XML_FreeContentModel @59 |
||||
XML_MemMalloc @60 |
||||
XML_MemRealloc @61 |
||||
XML_MemFree @62 |
@ -1,104 +0,0 @@
|
||||
/*================================================================
|
||||
** Copyright 2000, Clark Cooper |
||||
** All rights reserved. |
||||
** |
||||
** This is free software. You are permitted to copy, distribute, or modify |
||||
** it under the terms of the MIT/X license (contained in the COPYING file |
||||
** with this distribution.) |
||||
** |
||||
*/ |
||||
|
||||
#ifndef MACCONFIG_H |
||||
#define MACCONFIG_H |
||||
|
||||
|
||||
/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ |
||||
#define BYTEORDER 4321 |
||||
|
||||
/* Define to 1 if you have the `bcopy' function. */ |
||||
#undef HAVE_BCOPY |
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
||||
#undef HAVE_DLFCN_H |
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */ |
||||
#undef HAVE_FCNTL_H |
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */ |
||||
#undef HAVE_GETPAGESIZE |
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
||||
#undef HAVE_INTTYPES_H |
||||
|
||||
/* Define to 1 if you have the `memmove' function. */ |
||||
#define HAVE_MEMMOVE |
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */ |
||||
#undef HAVE_MEMORY_H |
||||
|
||||
/* Define to 1 if you have a working `mmap' system call. */ |
||||
#undef HAVE_MMAP |
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
||||
#undef HAVE_STDINT_H |
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
||||
#define HAVE_STDLIB_H |
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
||||
#undef HAVE_STRINGS_H |
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
||||
#define HAVE_STRING_H |
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
||||
#undef HAVE_SYS_STAT_H |
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
||||
#undef HAVE_SYS_TYPES_H |
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
||||
#undef HAVE_UNISTD_H |
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
||||
#undef PACKAGE_BUGREPORT |
||||
|
||||
/* Define to the full name of this package. */ |
||||
#undef PACKAGE_NAME |
||||
|
||||
/* Define to the full name and version of this package. */ |
||||
#undef PACKAGE_STRING |
||||
|
||||
/* Define to the one symbol short name of this package. */ |
||||
#undef PACKAGE_TARNAME |
||||
|
||||
/* Define to the version of this package. */ |
||||
#undef PACKAGE_VERSION |
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
||||
#define STDC_HEADERS |
||||
|
||||
/* whether byteorder is bigendian */ |
||||
#define WORDS_BIGENDIAN |
||||
|
||||
/* Define to specify how much context to retain around the current parse
|
||||
point. */ |
||||
#undef XML_CONTEXT_BYTES |
||||
|
||||
/* Define to make parameter entity parsing functionality available. */ |
||||
#define XML_DTD |
||||
|
||||
/* Define to make XML Namespaces functionality available. */ |
||||
#define XML_NS |
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */ |
||||
#undef const |
||||
|
||||
/* Define to `long' if <sys/types.h> does not define. */ |
||||
#define off_t long |
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */ |
||||
#undef size_t |
||||
|
||||
|
||||
#endif /* ifndef MACCONFIG_H */ |
@ -1,150 +0,0 @@
|
||||
static const unsigned namingBitmap[] = { |
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, |
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, |
||||
0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, |
||||
0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, |
||||
0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, |
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, |
||||
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, |
||||
0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, |
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, |
||||
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, |
||||
0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, |
||||
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, |
||||
0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, |
||||
0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, |
||||
0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, |
||||
0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, |
||||
0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, |
||||
0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, |
||||
0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, |
||||
0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, |
||||
0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, |
||||
0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, |
||||
0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, |
||||
0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, |
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, |
||||
0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, |
||||
0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, |
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, |
||||
0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, |
||||
0x40000000, 0xF580C900, 0x00000007, 0x02010800, |
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, |
||||
0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, |
||||
0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, |
||||
0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, |
||||
0x00000000, 0x00004C40, 0x00000000, 0x00000000, |
||||
0x00000007, 0x00000000, 0x00000000, 0x00000000, |
||||
0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, |
||||
0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, |
||||
0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, |
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, |
||||
0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, |
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, |
||||
0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, |
||||
0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, |
||||
0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, |
||||
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, |
||||
0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, |
||||
0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, |
||||
0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, |
||||
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, |
||||
0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, |
||||
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, |
||||
0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, |
||||
0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, |
||||
0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, |
||||
0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, |
||||
0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, |
||||
0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, |
||||
0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, |
||||
0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, |
||||
0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, |
||||
0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, |
||||
0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, |
||||
0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, |
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, |
||||
0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, |
||||
0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, |
||||
0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, |
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, |
||||
0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, |
||||
0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, |
||||
}; |
||||
static const unsigned char nmstrtPages[] = { |
||||
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, |
||||
0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, |
||||
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, |
||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
}; |
||||
static const unsigned char namePages[] = { |
||||
0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, |
||||
0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, |
||||
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, |
||||
0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, |
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||
}; |
@ -1,37 +0,0 @@
|
||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission. |
||||
*/ |
||||
|
||||
|
||||
/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, |
||||
/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, |
||||
/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, |
||||
/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, |
||||
/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, |
||||
/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, |
||||
/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, |
||||
/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, |
||||
/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, |
||||
/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, |
||||
/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, |
||||
/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, |
||||
/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, |
||||
/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, |
||||
/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, |
||||
/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, |
@ -1,34 +0,0 @@
|
||||
/*================================================================
|
||||
** Copyright 2000, Clark Cooper |
||||
** All rights reserved. |
||||
** |
||||
** This is free software. You are permitted to copy, distribute, or modify |
||||
** it under the terms of the MIT/X license (contained in the COPYING file |
||||
** with this distribution.) |
||||
*/ |
||||
|
||||
#ifndef WINCONFIG_H |
||||
#define WINCONFIG_H |
||||
|
||||
#ifdef _XBOX |
||||
# include <xtl.h> |
||||
#else |
||||
# define WIN32_LEAN_AND_MEAN |
||||
# include <windows.h> |
||||
# undef WIN32_LEAN_AND_MEAN |
||||
#endif |
||||
|
||||
#include <memory.h> |
||||
#include <string.h> |
||||
|
||||
#define XML_NS 1 |
||||
#define XML_DTD 1 |
||||
#define XML_CONTEXT_BYTES 1024 |
||||
|
||||
/* we will assume all Windows platforms are little endian */ |
||||
#define BYTEORDER 1234 |
||||
|
||||
/* Windows has memmove() available. */ |
||||
#define HAVE_MEMMOVE |
||||
|
||||
#endif /* ndef WINCONFIG_H */ |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,114 +0,0 @@
|
||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission. |
||||
*/ |
||||
|
||||
#ifndef XmlRole_INCLUDED |
||||
#define XmlRole_INCLUDED 1 |
||||
|
||||
#ifdef __VMS |
||||
/* 0 1 2 3 0 1 2 3
|
||||
1234567890123456789012345678901 1234567890123456789012345678901 */ |
||||
#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt |
||||
#endif |
||||
|
||||
#include "xmltok.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
enum { |
||||
XML_ROLE_ERROR = -1, |
||||
XML_ROLE_NONE = 0, |
||||
XML_ROLE_XML_DECL, |
||||
XML_ROLE_INSTANCE_START, |
||||
XML_ROLE_DOCTYPE_NONE, |
||||
XML_ROLE_DOCTYPE_NAME, |
||||
XML_ROLE_DOCTYPE_SYSTEM_ID, |
||||
XML_ROLE_DOCTYPE_PUBLIC_ID, |
||||
XML_ROLE_DOCTYPE_INTERNAL_SUBSET, |
||||
XML_ROLE_DOCTYPE_CLOSE, |
||||
XML_ROLE_GENERAL_ENTITY_NAME, |
||||
XML_ROLE_PARAM_ENTITY_NAME, |
||||
XML_ROLE_ENTITY_NONE, |
||||
XML_ROLE_ENTITY_VALUE, |
||||
XML_ROLE_ENTITY_SYSTEM_ID, |
||||
XML_ROLE_ENTITY_PUBLIC_ID, |
||||
XML_ROLE_ENTITY_COMPLETE, |
||||
XML_ROLE_ENTITY_NOTATION_NAME, |
||||
XML_ROLE_NOTATION_NONE, |
||||
XML_ROLE_NOTATION_NAME, |
||||
XML_ROLE_NOTATION_SYSTEM_ID, |
||||
XML_ROLE_NOTATION_NO_SYSTEM_ID, |
||||
XML_ROLE_NOTATION_PUBLIC_ID, |
||||
XML_ROLE_ATTRIBUTE_NAME, |
||||
XML_ROLE_ATTRIBUTE_TYPE_CDATA, |
||||
XML_ROLE_ATTRIBUTE_TYPE_ID, |
||||
XML_ROLE_ATTRIBUTE_TYPE_IDREF, |
||||
XML_ROLE_ATTRIBUTE_TYPE_IDREFS, |
||||
XML_ROLE_ATTRIBUTE_TYPE_ENTITY, |
||||
XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, |
||||
XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, |
||||
XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, |
||||
XML_ROLE_ATTRIBUTE_ENUM_VALUE, |
||||
XML_ROLE_ATTRIBUTE_NOTATION_VALUE, |
||||
XML_ROLE_ATTLIST_NONE, |
||||
XML_ROLE_ATTLIST_ELEMENT_NAME, |
||||
XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, |
||||
XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, |
||||
XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, |
||||
XML_ROLE_FIXED_ATTRIBUTE_VALUE, |
||||
XML_ROLE_ELEMENT_NONE, |
||||
XML_ROLE_ELEMENT_NAME, |
||||
XML_ROLE_CONTENT_ANY, |
||||
XML_ROLE_CONTENT_EMPTY, |
||||
XML_ROLE_CONTENT_PCDATA, |
||||
XML_ROLE_GROUP_OPEN, |
||||
XML_ROLE_GROUP_CLOSE, |
||||
XML_ROLE_GROUP_CLOSE_REP, |
||||
XML_ROLE_GROUP_CLOSE_OPT, |
||||
XML_ROLE_GROUP_CLOSE_PLUS, |
||||
XML_ROLE_GROUP_CHOICE, |
||||
XML_ROLE_GROUP_SEQUENCE, |
||||
XML_ROLE_CONTENT_ELEMENT, |
||||
XML_ROLE_CONTENT_ELEMENT_REP, |
||||
XML_ROLE_CONTENT_ELEMENT_OPT, |
||||
XML_ROLE_CONTENT_ELEMENT_PLUS, |
||||
XML_ROLE_PI, |
||||
XML_ROLE_COMMENT, |
||||
#ifdef XML_DTD |
||||
XML_ROLE_TEXT_DECL, |
||||
XML_ROLE_IGNORE_SECT, |
||||
XML_ROLE_INNER_PARAM_ENTITY_REF, |
||||
#endif /* XML_DTD */ |
||||
XML_ROLE_PARAM_ENTITY_REF |
||||
}; |
||||
|
||||
typedef struct prolog_state { |
||||
int (PTRCALL *handler) (struct prolog_state *state, |
||||
int tok, |
||||
const char *ptr, |
||||
const char *end, |
||||
const ENCODING *enc); |
||||
unsigned level; |
||||
int role_none; |
||||
#ifdef XML_DTD |
||||
unsigned includeLevel; |
||||
int documentEntity; |
||||
int inEntityValue; |
||||
#endif /* XML_DTD */ |
||||
} PROLOG_STATE; |
||||
|
||||
void XmlPrologStateInit(PROLOG_STATE *); |
||||
#ifdef XML_DTD |
||||
void XmlPrologStateInitExternalEntity(PROLOG_STATE *); |
||||
#endif /* XML_DTD */ |
||||
|
||||
#define XmlTokenRole(state, tok, ptr, end, enc) \ |
||||
(((state)->handler)(state, tok, ptr, end, enc)) |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif /* not XmlRole_INCLUDED */ |
File diff suppressed because it is too large
Load Diff
@ -1,315 +0,0 @@
|
||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission. |
||||
*/ |
||||
|
||||
#ifndef XmlTok_INCLUDED |
||||
#define XmlTok_INCLUDED 1 |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/* The following token may be returned by XmlContentTok */ |
||||
#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be |
||||
start of illegal ]]> sequence */ |
||||
/* The following tokens may be returned by both XmlPrologTok and
|
||||
XmlContentTok. |
||||
*/ |
||||
#define XML_TOK_NONE -4 /* The string to be scanned is empty */ |
||||
#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; |
||||
might be part of CRLF sequence */ |
||||
#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ |
||||
#define XML_TOK_PARTIAL -1 /* only part of a token */ |
||||
#define XML_TOK_INVALID 0 |
||||
|
||||
/* The following tokens are returned by XmlContentTok; some are also
|
||||
returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok. |
||||
*/ |
||||
#define XML_TOK_START_TAG_WITH_ATTS 1 |
||||
#define XML_TOK_START_TAG_NO_ATTS 2 |
||||
#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */ |
||||
#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 |
||||
#define XML_TOK_END_TAG 5 |
||||
#define XML_TOK_DATA_CHARS 6 |
||||
#define XML_TOK_DATA_NEWLINE 7 |
||||
#define XML_TOK_CDATA_SECT_OPEN 8 |
||||
#define XML_TOK_ENTITY_REF 9 |
||||
#define XML_TOK_CHAR_REF 10 /* numeric character reference */ |
||||
|
||||
/* The following tokens may be returned by both XmlPrologTok and
|
||||
XmlContentTok. |
||||
*/ |
||||
#define XML_TOK_PI 11 /* processing instruction */ |
||||
#define XML_TOK_XML_DECL 12 /* XML decl or text decl */ |
||||
#define XML_TOK_COMMENT 13 |
||||
#define XML_TOK_BOM 14 /* Byte order mark */ |
||||
|
||||
/* The following tokens are returned only by XmlPrologTok */ |
||||
#define XML_TOK_PROLOG_S 15 |
||||
#define XML_TOK_DECL_OPEN 16 /* <!foo */ |
||||
#define XML_TOK_DECL_CLOSE 17 /* > */ |
||||
#define XML_TOK_NAME 18 |
||||
#define XML_TOK_NMTOKEN 19 |
||||
#define XML_TOK_POUND_NAME 20 /* #name */ |
||||
#define XML_TOK_OR 21 /* | */ |
||||
#define XML_TOK_PERCENT 22 |
||||
#define XML_TOK_OPEN_PAREN 23 |
||||
#define XML_TOK_CLOSE_PAREN 24 |
||||
#define XML_TOK_OPEN_BRACKET 25 |
||||
#define XML_TOK_CLOSE_BRACKET 26 |
||||
#define XML_TOK_LITERAL 27 |
||||
#define XML_TOK_PARAM_ENTITY_REF 28 |
||||
#define XML_TOK_INSTANCE_START 29 |
||||
|
||||
/* The following occur only in element type declarations */ |
||||
#define XML_TOK_NAME_QUESTION 30 /* name? */ |
||||
#define XML_TOK_NAME_ASTERISK 31 /* name* */ |
||||
#define XML_TOK_NAME_PLUS 32 /* name+ */ |
||||
#define XML_TOK_COND_SECT_OPEN 33 /* <![ */ |
||||
#define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */ |
||||
#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ |
||||
#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ |
||||
#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ |
||||
#define XML_TOK_COMMA 38 |
||||
|
||||
/* The following token is returned only by XmlAttributeValueTok */ |
||||
#define XML_TOK_ATTRIBUTE_VALUE_S 39 |
||||
|
||||
/* The following token is returned only by XmlCdataSectionTok */ |
||||
#define XML_TOK_CDATA_SECT_CLOSE 40 |
||||
|
||||
/* With namespace processing this is returned by XmlPrologTok for a
|
||||
name with a colon. |
||||
*/ |
||||
#define XML_TOK_PREFIXED_NAME 41 |
||||
|
||||
#ifdef XML_DTD |
||||
#define XML_TOK_IGNORE_SECT 42 |
||||
#endif /* XML_DTD */ |
||||
|
||||
#ifdef XML_DTD |
||||
#define XML_N_STATES 4 |
||||
#else /* not XML_DTD */ |
||||
#define XML_N_STATES 3 |
||||
#endif /* not XML_DTD */ |
||||
|
||||
#define XML_PROLOG_STATE 0 |
||||
#define XML_CONTENT_STATE 1 |
||||
#define XML_CDATA_SECTION_STATE 2 |
||||
#ifdef XML_DTD |
||||
#define XML_IGNORE_SECTION_STATE 3 |
||||
#endif /* XML_DTD */ |
||||
|
||||
#define XML_N_LITERAL_TYPES 2 |
||||
#define XML_ATTRIBUTE_VALUE_LITERAL 0 |
||||
#define XML_ENTITY_VALUE_LITERAL 1 |
||||
|
||||
/* The size of the buffer passed to XmlUtf8Encode must be at least this. */ |
||||
#define XML_UTF8_ENCODE_MAX 4 |
||||
/* The size of the buffer passed to XmlUtf16Encode must be at least this. */ |
||||
#define XML_UTF16_ENCODE_MAX 2 |
||||
|
||||
typedef struct position { |
||||
/* first line and first column are 0 not 1 */ |
||||
unsigned long lineNumber; |
||||
unsigned long columnNumber; |
||||
} POSITION; |
||||
|
||||
typedef struct { |
||||
const char *name; |
||||
const char *valuePtr; |
||||
const char *valueEnd; |
||||
char normalized; |
||||
} ATTRIBUTE; |
||||
|
||||
struct encoding; |
||||
typedef struct encoding ENCODING; |
||||
|
||||
typedef int (PTRCALL *SCANNER)(const ENCODING *, |
||||
const char *, |
||||
const char *, |
||||
const char **); |
||||
|
||||
struct encoding { |
||||
SCANNER scanners[XML_N_STATES]; |
||||
SCANNER literalScanners[XML_N_LITERAL_TYPES]; |
||||
int (PTRCALL *sameName)(const ENCODING *, |
||||
const char *, |
||||
const char *); |
||||
int (PTRCALL *nameMatchesAscii)(const ENCODING *, |
||||
const char *, |
||||
const char *, |
||||
const char *); |
||||
int (PTRFASTCALL *nameLength)(const ENCODING *, const char *); |
||||
const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *); |
||||
int (PTRCALL *getAtts)(const ENCODING *enc, |
||||
const char *ptr, |
||||
int attsMax, |
||||
ATTRIBUTE *atts); |
||||
int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); |
||||
int (PTRCALL *predefinedEntityName)(const ENCODING *, |
||||
const char *, |
||||
const char *); |
||||
void (PTRCALL *updatePosition)(const ENCODING *, |
||||
const char *ptr, |
||||
const char *end, |
||||
POSITION *); |
||||
int (PTRCALL *isPublicId)(const ENCODING *enc, |
||||
const char *ptr, |
||||
const char *end, |
||||
const char **badPtr); |
||||
void (PTRCALL *utf8Convert)(const ENCODING *enc, |
||||
const char **fromP, |
||||
const char *fromLim, |
||||
char **toP, |
||||
const char *toLim); |
||||
void (PTRCALL *utf16Convert)(const ENCODING *enc, |
||||
const char **fromP, |
||||
const char *fromLim, |
||||
unsigned short **toP, |
||||
const unsigned short *toLim); |
||||
int minBytesPerChar; |
||||
char isUtf8; |
||||
char isUtf16; |
||||
}; |
||||
|
||||
/* Scan the string starting at ptr until the end of the next complete
|
||||
token, but do not scan past eptr. Return an integer giving the |
||||
type of token. |
||||
|
||||
Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set. |
||||
|
||||
Return XML_TOK_PARTIAL when the string does not contain a complete |
||||
token; nextTokPtr will not be set. |
||||
|
||||
Return XML_TOK_INVALID when the string does not start a valid |
||||
token; nextTokPtr will be set to point to the character which made |
||||
the token invalid. |
||||
|
||||
Otherwise the string starts with a valid token; nextTokPtr will be |
||||
set to point to the character following the end of that token. |
||||
|
||||
Each data character counts as a single token, but adjacent data |
||||
characters may be returned together. Similarly for characters in |
||||
the prolog outside literals, comments and processing instructions. |
||||
*/ |
||||
|
||||
|
||||
#define XmlTok(enc, state, ptr, end, nextTokPtr) \ |
||||
(((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) |
||||
|
||||
#define XmlPrologTok(enc, ptr, end, nextTokPtr) \ |
||||
XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) |
||||
|
||||
#define XmlContentTok(enc, ptr, end, nextTokPtr) \ |
||||
XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) |
||||
|
||||
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ |
||||
XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) |
||||
|
||||
#ifdef XML_DTD |
||||
|
||||
#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ |
||||
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) |
||||
|
||||
#endif /* XML_DTD */ |
||||
|
||||
/* This is used for performing a 2nd-level tokenization on the content
|
||||
of a literal that has already been returned by XmlTok. |
||||
*/ |
||||
#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ |
||||
(((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) |
||||
|
||||
#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ |
||||
XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) |
||||
|
||||
#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ |
||||
XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) |
||||
|
||||
#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2)) |
||||
|
||||
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ |
||||
(((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) |
||||
|
||||
#define XmlNameLength(enc, ptr) \ |
||||
(((enc)->nameLength)(enc, ptr)) |
||||
|
||||
#define XmlSkipS(enc, ptr) \ |
||||
(((enc)->skipS)(enc, ptr)) |
||||
|
||||
#define XmlGetAttributes(enc, ptr, attsMax, atts) \ |
||||
(((enc)->getAtts)(enc, ptr, attsMax, atts)) |
||||
|
||||
#define XmlCharRefNumber(enc, ptr) \ |
||||
(((enc)->charRefNumber)(enc, ptr)) |
||||
|
||||
#define XmlPredefinedEntityName(enc, ptr, end) \ |
||||
(((enc)->predefinedEntityName)(enc, ptr, end)) |
||||
|
||||
#define XmlUpdatePosition(enc, ptr, end, pos) \ |
||||
(((enc)->updatePosition)(enc, ptr, end, pos)) |
||||
|
||||
#define XmlIsPublicId(enc, ptr, end, badPtr) \ |
||||
(((enc)->isPublicId)(enc, ptr, end, badPtr)) |
||||
|
||||
#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ |
||||
(((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) |
||||
|
||||
#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ |
||||
(((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) |
||||
|
||||
typedef struct { |
||||
ENCODING initEnc; |
||||
const ENCODING **encPtr; |
||||
} INIT_ENCODING; |
||||
|
||||
int XmlParseXmlDecl(int isGeneralTextEntity, |
||||
const ENCODING *enc, |
||||
const char *ptr, |
||||
const char *end, |
||||
const char **badPtr, |
||||
const char **versionPtr, |
||||
const char **versionEndPtr, |
||||
const char **encodingNamePtr, |
||||
const ENCODING **namedEncodingPtr, |
||||
int *standalonePtr); |
||||
|
||||
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); |
||||
const ENCODING *XmlGetUtf8InternalEncoding(void); |
||||
const ENCODING *XmlGetUtf16InternalEncoding(void); |
||||
int FASTCALL XmlUtf8Encode(int charNumber, char *buf); |
||||
int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf); |
||||
int XmlSizeOfUnknownEncoding(void); |
||||
|
||||
typedef int (*CONVERTER)(void *userData, const char *p); |
||||
|
||||
ENCODING * |
||||
XmlInitUnknownEncoding(void *mem, |
||||
int *table, |
||||
CONVERTER convert, |
||||
void *userData); |
||||
|
||||
int XmlParseXmlDeclNS(int isGeneralTextEntity, |
||||
const ENCODING *enc, |
||||
const char *ptr, |
||||
const char *end, |
||||
const char **badPtr, |
||||
const char **versionPtr, |
||||
const char **versionEndPtr, |
||||
const char **encodingNamePtr, |
||||
const ENCODING **namedEncodingPtr, |
||||
int *standalonePtr); |
||||
|
||||
int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); |
||||
const ENCODING *XmlGetUtf8InternalEncodingNS(void); |
||||
const ENCODING *XmlGetUtf16InternalEncodingNS(void); |
||||
ENCODING * |
||||
XmlInitUnknownEncodingNS(void *mem, |
||||
int *table, |
||||
CONVERTER convert, |
||||
void *userData); |
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif /* not XmlTok_INCLUDED */ |
File diff suppressed because it is too large
Load Diff
@ -1,46 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd |
||||
See the file COPYING for copying permission. |
||||
*/ |
||||
|
||||
enum { |
||||
BT_NONXML, |
||||
BT_MALFORM, |
||||
BT_LT, |
||||
BT_AMP, |
||||
BT_RSQB, |
||||
BT_LEAD2, |
||||
BT_LEAD3, |
||||
BT_LEAD4, |
||||
BT_TRAIL, |
||||
BT_CR, |
||||
BT_LF, |
||||
BT_GT, |
||||
BT_QUOT, |
||||
BT_APOS, |
||||
BT_EQUALS, |
||||
BT_QUEST, |
||||
BT_EXCL, |
||||
BT_SOL, |
||||
BT_SEMI, |
||||
BT_NUM, |
||||
BT_LSQB, |
||||
BT_S, |
||||
BT_NMSTRT, |
||||
BT_COLON, |
||||
BT_HEX, |
||||
BT_DIGIT, |
||||
BT_NAME, |
||||
BT_MINUS, |
||||
BT_OTHER, /* known not to be a name or name start character */ |
||||
BT_NONASCII, /* might be a name or name start character */ |
||||
BT_PERCNT, |
||||
BT_LPAR, |
||||
BT_RPAR, |
||||
BT_AST, |
||||
BT_PLUS, |
||||
BT_COMMA, |
||||
BT_VERBAR |
||||
}; |
||||
|
||||
#include <stddef.h> |
@ -1,106 +0,0 @@
|
||||
const ENCODING * |
||||
NS(XmlGetUtf8InternalEncoding)(void) |
||||
{ |
||||
return &ns(internal_utf8_encoding).enc; |
||||
} |
||||
|
||||
const ENCODING * |
||||
NS(XmlGetUtf16InternalEncoding)(void) |
||||
{ |
||||
#if BYTEORDER == 1234 |
||||
return &ns(internal_little2_encoding).enc; |
||||
#elif BYTEORDER == 4321 |
||||
return &ns(internal_big2_encoding).enc; |
||||
#else |
||||
const short n = 1; |
||||
return (*(const char *)&n |
||||
? &ns(internal_little2_encoding).enc |
||||
: &ns(internal_big2_encoding).enc); |
||||
#endif |
||||
} |
||||
|
||||
static const ENCODING *NS(encodings)[] = { |
||||
&ns(latin1_encoding).enc, |
||||
&ns(ascii_encoding).enc, |
||||
&ns(utf8_encoding).enc, |
||||
&ns(big2_encoding).enc, |
||||
&ns(big2_encoding).enc, |
||||
&ns(little2_encoding).enc, |
||||
&ns(utf8_encoding).enc /* NO_ENC */ |
||||
}; |
||||
|
||||
static int PTRCALL |
||||
NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, |
||||
const char **nextTokPtr) |
||||
{ |
||||
return initScan(NS(encodings), (const INIT_ENCODING *)enc, |
||||
XML_PROLOG_STATE, ptr, end, nextTokPtr); |
||||
} |
||||
|
||||
static int PTRCALL |
||||
NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, |
||||
const char **nextTokPtr) |
||||
{ |
||||
return initScan(NS(encodings), (const INIT_ENCODING *)enc, |
||||
XML_CONTENT_STATE, ptr, end, nextTokPtr); |
||||
} |
||||
|
||||
int |
||||
NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, |
||||
const char *name) |
||||
{ |
||||
int i = getEncodingIndex(name); |
||||
if (i == UNKNOWN_ENC) |
||||
return 0; |
||||
SET_INIT_ENC_INDEX(p, i); |
||||
p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog); |
||||
p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent); |
||||
p->initEnc.updatePosition = initUpdatePosition; |
||||
p->encPtr = encPtr; |
||||
*encPtr = &(p->initEnc); |
||||
return 1; |
||||
} |
||||
|
||||
static const ENCODING * |
||||
NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) |
||||
{ |
||||
#define ENCODING_MAX 128 |
||||
char buf[ENCODING_MAX]; |
||||
char *p = buf; |
||||
int i; |
||||
XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); |
||||
if (ptr != end) |
||||
return 0; |
||||
*p = 0; |
||||
if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2) |
||||
return enc; |
||||
i = getEncodingIndex(buf); |
||||
if (i == UNKNOWN_ENC) |
||||
return 0; |
||||
return NS(encodings)[i]; |
||||
} |
||||
|
||||
int |
||||
NS(XmlParseXmlDecl)(int isGeneralTextEntity, |
||||
const ENCODING *enc, |
||||
const char *ptr, |
||||
const char *end, |
||||
const char **badPtr, |
||||
const char **versionPtr, |
||||
const char **versionEndPtr, |
||||
const char **encodingName, |
||||
const ENCODING **encoding, |
||||
int *standalone) |
||||
{ |
||||
return doParseXmlDecl(NS(findEncoding), |
||||
isGeneralTextEntity, |
||||
enc, |
||||
ptr, |
||||
end, |
||||
badPtr, |
||||
versionPtr, |
||||
versionEndPtr, |
||||
encodingName, |
||||
encoding, |
||||
standalone); |
||||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,134 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
#
|
||||
# Automake Makefile for the JPEG library
|
||||
#
|
||||
# This file is written by Bob Friesenhahn, Guido Vollbeding
|
||||
#
|
||||
|
||||
# Sources to build library
|
||||
LIBSOURCES = jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c \
|
||||
jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \
|
||||
jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c \
|
||||
jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \
|
||||
jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \
|
||||
jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \
|
||||
jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \
|
||||
jquant2.c jutils.c jmemmgr.c @MEMORYMGR@.c
|
||||
|
||||
# System dependent sources
|
||||
SYSDEPSOURCES = jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
|
||||
|
||||
# Headers which are installed to support the library
|
||||
INSTINCLUDES = jerror.h jmorecfg.h jpeglib.h
|
||||
|
||||
# Headers which are not installed
|
||||
OTHERINCLUDES = cderror.h cdjpeg.h jdct.h jinclude.h jmemsys.h jpegint.h \
|
||||
jversion.h transupp.h
|
||||
|
||||
# Manual pages (Automake uses 'MANS' for itself)
|
||||
DISTMANS= cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1
|
||||
|
||||
# Other documentation files
|
||||
DOCS= README install.txt usage.txt wizard.txt example.c libjpeg.txt \
|
||||
structure.txt coderules.txt filelist.txt change.log
|
||||
|
||||
# Makefiles for various systems
|
||||
MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \
|
||||
makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \
|
||||
makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \
|
||||
makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \
|
||||
maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \
|
||||
makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.v10 \
|
||||
makeasln.v10 makejvcx.v10 makejfil.v10 makecvcx.v10 makecfil.v10 \
|
||||
makedvcx.v10 makedfil.v10 maketvcx.v10 maketfil.v10 makervcx.v10 \
|
||||
makerfil.v10 makewvcx.v10 makewfil.v10 makeproj.mac makcjpeg.st \
|
||||
makdjpeg.st makljpeg.st maktjpeg.st makefile.manx makefile.sas \
|
||||
makefile.mms makefile.vms makvms.opt
|
||||
|
||||
# Configuration files
|
||||
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
|
||||
jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
|
||||
jconfig.vms
|
||||
|
||||
# Support scripts for configure
|
||||
CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing
|
||||
|
||||
# Miscellaneous support files
|
||||
OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \
|
||||
libjpeg.map
|
||||
|
||||
# Test support files
|
||||
TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
|
||||
testimgp.jpg
|
||||
|
||||
# libtool libraries to build
|
||||
lib_LTLIBRARIES = libjpeg.la
|
||||
|
||||
# Library sources for libjpeg.la
|
||||
libjpeg_la_SOURCES = $(LIBSOURCES)
|
||||
|
||||
# LDFLAGS for libjpeg.la
|
||||
libjpeg_la_LDFLAGS = -no-undefined \
|
||||
-version-info $(JPEG_LIB_VERSION)
|
||||
|
||||
if HAVE_LD_VERSION_SCRIPT |
||||
libjpeg_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libjpeg.map
|
||||
endif |
||||
|
||||
# Executables to build
|
||||
bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom
|
||||
|
||||
# Executable sources & libs
|
||||
cjpeg_SOURCES = cjpeg.c rdppm.c rdgif.c rdtarga.c rdrle.c rdbmp.c \
|
||||
rdswitch.c cdjpeg.c
|
||||
cjpeg_LDADD = libjpeg.la
|
||||
djpeg_SOURCES = djpeg.c wrppm.c wrgif.c wrtarga.c wrrle.c wrbmp.c \
|
||||
rdcolmap.c cdjpeg.c
|
||||
djpeg_LDADD = libjpeg.la
|
||||
jpegtran_SOURCES = jpegtran.c rdswitch.c cdjpeg.c transupp.c
|
||||
jpegtran_LDADD = libjpeg.la
|
||||
rdjpgcom_SOURCES = rdjpgcom.c
|
||||
wrjpgcom_SOURCES = wrjpgcom.c
|
||||
|
||||
# Manual pages to install
|
||||
man_MANS = $(DISTMANS)
|
||||
|
||||
# Headers to install
|
||||
include_HEADERS = $(INSTINCLUDES)
|
||||
|
||||
# Other distributed headers
|
||||
noinst_HEADERS = $(OTHERINCLUDES)
|
||||
|
||||
# Other distributed files
|
||||
EXTRA_DIST = $(DOCS) $(DISTMANS) $(MKFILES) $(CONFIGFILES) $(SYSDEPSOURCES) \
|
||||
$(OTHERFILES) $(TESTFILES)
|
||||
|
||||
# Files to be cleaned
|
||||
CLEANFILES = testout.ppm testout.bmp testout.jpg testoutp.ppm testoutp.jpg \
|
||||
testoutt.jpg
|
||||
|
||||
# Install jconfig.h
|
||||
install-data-local: |
||||
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||
$(INSTALL_HEADER) jconfig.h $(DESTDIR)$(includedir)/jconfig.h
|
||||
|
||||
# Uninstall jconfig.h
|
||||
uninstall-local: |
||||
rm -f $(DESTDIR)$(includedir)/jconfig.h
|
||||
|
||||
# Run tests
|
||||
test: check-local |
||||
check-local: |
||||
rm -f testout*
|
||||
./djpeg -dct int -ppm -outfile testout.ppm $(srcdir)/testorig.jpg
|
||||
./djpeg -dct int -bmp -colors 256 -outfile testout.bmp $(srcdir)/testorig.jpg
|
||||
./cjpeg -dct int -outfile testout.jpg $(srcdir)/testimg.ppm
|
||||
./djpeg -dct int -ppm -outfile testoutp.ppm $(srcdir)/testprog.jpg
|
||||
./cjpeg -dct int -progressive -opt -outfile testoutp.jpg $(srcdir)/testimg.ppm
|
||||
./jpegtran -outfile testoutt.jpg $(srcdir)/testprog.jpg
|
||||
cmp $(srcdir)/testimg.ppm testout.ppm
|
||||
cmp $(srcdir)/testimg.bmp testout.bmp
|
||||
cmp $(srcdir)/testimg.jpg testout.jpg
|
||||
cmp $(srcdir)/testimg.ppm testoutp.ppm
|
||||
cmp $(srcdir)/testimgp.jpg testoutp.jpg
|
||||
cmp $(srcdir)/testorig.jpg testoutt.jpg
|
File diff suppressed because it is too large
Load Diff
@ -1,326 +0,0 @@
|
||||
The Independent JPEG Group's JPEG software |
||||
========================================== |
||||
|
||||
README for release 8c of 16-Jan-2011 |
||||
==================================== |
||||
|
||||
This distribution contains the eighth public release of the Independent JPEG |
||||
Group's free JPEG software. You are welcome to redistribute this software and |
||||
to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. |
||||
|
||||
This software is the work of Tom Lane, Guido Vollbeding, Philip Gladstone, |
||||
Bill Allombert, Jim Boucher, Lee Crocker, Bob Friesenhahn, Ben Jackson, |
||||
Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers, |
||||
and other members of the Independent JPEG Group. |
||||
|
||||
IJG is not affiliated with the official ISO JPEG standards committee. |
||||
|
||||
|
||||
DOCUMENTATION ROADMAP |
||||
===================== |
||||
|
||||
This file contains the following sections: |
||||
|
||||
OVERVIEW General description of JPEG and the IJG software. |
||||
LEGAL ISSUES Copyright, lack of warranty, terms of distribution. |
||||
REFERENCES Where to learn more about JPEG. |
||||
ARCHIVE LOCATIONS Where to find newer versions of this software. |
||||
ACKNOWLEDGMENTS Special thanks. |
||||
FILE FORMAT WARS Software *not* to get. |
||||
TO DO Plans for future IJG releases. |
||||
|
||||
Other documentation files in the distribution are: |
||||
|
||||
User documentation: |
||||
install.txt How to configure and install the IJG software. |
||||
usage.txt Usage instructions for cjpeg, djpeg, jpegtran, |
||||
rdjpgcom, and wrjpgcom. |
||||
*.1 Unix-style man pages for programs (same info as usage.txt). |
||||
wizard.txt Advanced usage instructions for JPEG wizards only. |
||||
change.log Version-to-version change highlights. |
||||
Programmer and internal documentation: |
||||
libjpeg.txt How to use the JPEG library in your own programs. |
||||
example.c Sample code for calling the JPEG library. |
||||
structure.txt Overview of the JPEG library's internal structure. |
||||
filelist.txt Road map of IJG files. |
||||
coderules.txt Coding style rules --- please read if you contribute code. |
||||
|
||||
Please read at least the files install.txt and usage.txt. Some information |
||||
can also be found in the JPEG FAQ (Frequently Asked Questions) article. See |
||||
ARCHIVE LOCATIONS below to find out where to obtain the FAQ article. |
||||
|
||||
If you want to understand how the JPEG code works, we suggest reading one or |
||||
more of the REFERENCES, then looking at the documentation files (in roughly |
||||
the order listed) before diving into the code. |
||||
|
||||
|
||||
OVERVIEW |
||||
======== |
||||
|
||||
This package contains C software to implement JPEG image encoding, decoding, |
||||
and transcoding. JPEG (pronounced "jay-peg") is a standardized compression |
||||
method for full-color and gray-scale images. |
||||
|
||||
This software implements JPEG baseline, extended-sequential, and progressive |
||||
compression processes. Provision is made for supporting all variants of these |
||||
processes, although some uncommon parameter settings aren't implemented yet. |
||||
We have made no provision for supporting the hierarchical or lossless |
||||
processes defined in the standard. |
||||
|
||||
We provide a set of library routines for reading and writing JPEG image files, |
||||
plus two sample applications "cjpeg" and "djpeg", which use the library to |
||||
perform conversion between JPEG and some other popular image file formats. |
||||
The library is intended to be reused in other applications. |
||||
|
||||
In order to support file conversion and viewing software, we have included |
||||
considerable functionality beyond the bare JPEG coding/decoding capability; |
||||
for example, the color quantization modules are not strictly part of JPEG |
||||
decoding, but they are essential for output to colormapped file formats or |
||||
colormapped displays. These extra functions can be compiled out of the |
||||
library if not required for a particular application. |
||||
|
||||
We have also included "jpegtran", a utility for lossless transcoding between |
||||
different JPEG processes, and "rdjpgcom" and "wrjpgcom", two simple |
||||
applications for inserting and extracting textual comments in JFIF files. |
||||
|
||||
The emphasis in designing this software has been on achieving portability and |
||||
flexibility, while also making it fast enough to be useful. In particular, |
||||
the software is not intended to be read as a tutorial on JPEG. (See the |
||||
REFERENCES section for introductory material.) Rather, it is intended to |
||||
be reliable, portable, industrial-strength code. We do not claim to have |
||||
achieved that goal in every aspect of the software, but we strive for it. |
||||
|
||||
We welcome the use of this software as a component of commercial products. |
||||
No royalty is required, but we do ask for an acknowledgement in product |
||||
documentation, as described under LEGAL ISSUES. |
||||
|
||||
|
||||
LEGAL ISSUES |
||||
============ |
||||
|
||||
In plain English: |
||||
|
||||
1. We don't promise that this software works. (But if you find any bugs, |
||||
please let us know!) |
||||
2. You can use this software for whatever you want. You don't have to pay us. |
||||
3. You may not pretend that you wrote this software. If you use it in a |
||||
program, you must acknowledge somewhere in your documentation that |
||||
you've used the IJG code. |
||||
|
||||
In legalese: |
||||
|
||||
The authors make NO WARRANTY or representation, either express or implied, |
||||
with respect to this software, its quality, accuracy, merchantability, or |
||||
fitness for a particular purpose. This software is provided "AS IS", and you, |
||||
its user, assume the entire risk as to its quality and accuracy. |
||||
|
||||
This software is copyright (C) 1991-2011, Thomas G. Lane, Guido Vollbeding. |
||||
All Rights Reserved except as specified below. |
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this |
||||
software (or portions thereof) for any purpose, without fee, subject to these |
||||
conditions: |
||||
(1) If any part of the source code for this software is distributed, then this |
||||
README file must be included, with this copyright and no-warranty notice |
||||
unaltered; and any additions, deletions, or changes to the original files |
||||
must be clearly indicated in accompanying documentation. |
||||
(2) If only executable code is distributed, then the accompanying |
||||
documentation must state that "this software is based in part on the work of |
||||
the Independent JPEG Group". |
||||
(3) Permission for use of this software is granted only if the user accepts |
||||
full responsibility for any undesirable consequences; the authors accept |
||||
NO LIABILITY for damages of any kind. |
||||
|
||||
These conditions apply to any software derived from or based on the IJG code, |
||||
not just to the unmodified library. If you use our work, you ought to |
||||
acknowledge us. |
||||
|
||||
Permission is NOT granted for the use of any IJG author's name or company name |
||||
in advertising or publicity relating to this software or products derived from |
||||
it. This software may be referred to only as "the Independent JPEG Group's |
||||
software". |
||||
|
||||
We specifically permit and encourage the use of this software as the basis of |
||||
commercial products, provided that all warranty or liability claims are |
||||
assumed by the product vendor. |
||||
|
||||
|
||||
ansi2knr.c is included in this distribution by permission of L. Peter Deutsch, |
||||
sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA. |
||||
ansi2knr.c is NOT covered by the above copyright and conditions, but instead |
||||
by the usual distribution terms of the Free Software Foundation; principally, |
||||
that you must include source code if you redistribute it. (See the file |
||||
ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part |
||||
of any program generated from the IJG code, this does not limit you more than |
||||
the foregoing paragraphs do. |
||||
|
||||
The Unix configuration script "configure" was produced with GNU Autoconf. |
||||
It is copyright by the Free Software Foundation but is freely distributable. |
||||
The same holds for its supporting scripts (config.guess, config.sub, |
||||
ltmain.sh). Another support script, install-sh, is copyright by X Consortium |
||||
but is also freely distributable. |
||||
|
||||
The IJG distribution formerly included code to read and write GIF files. |
||||
To avoid entanglement with the Unisys LZW patent, GIF reading support has |
||||
been removed altogether, and the GIF writer has been simplified to produce |
||||
"uncompressed GIFs". This technique does not use the LZW algorithm; the |
||||
resulting GIF files are larger than usual, but are readable by all standard |
||||
GIF decoders. |
||||
|
||||
We are required to state that |
||||
"The Graphics Interchange Format(c) is the Copyright property of |
||||
CompuServe Incorporated. GIF(sm) is a Service Mark property of |
||||
CompuServe Incorporated." |
||||
|
||||
|
||||
REFERENCES |
||||
========== |
||||
|
||||
We recommend reading one or more of these references before trying to |
||||
understand the innards of the JPEG software. |
||||
|
||||
The best short technical introduction to the JPEG compression algorithm is |
||||
Wallace, Gregory K. "The JPEG Still Picture Compression Standard", |
||||
Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. |
||||
(Adjacent articles in that issue discuss MPEG motion picture compression, |
||||
applications of JPEG, and related topics.) If you don't have the CACM issue |
||||
handy, a PostScript file containing a revised version of Wallace's article is |
||||
available at http://www.ijg.org/files/wallace.ps.gz. The file (actually |
||||
a preprint for an article that appeared in IEEE Trans. Consumer Electronics) |
||||
omits the sample images that appeared in CACM, but it includes corrections |
||||
and some added material. Note: the Wallace article is copyright ACM and IEEE, |
||||
and it may not be used for commercial purposes. |
||||
|
||||
A somewhat less technical, more leisurely introduction to JPEG can be found in |
||||
"The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by |
||||
M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides |
||||
good explanations and example C code for a multitude of compression methods |
||||
including JPEG. It is an excellent source if you are comfortable reading C |
||||
code but don't know much about data compression in general. The book's JPEG |
||||
sample code is far from industrial-strength, but when you are ready to look |
||||
at a full implementation, you've got one here... |
||||
|
||||
The best currently available description of JPEG is the textbook "JPEG Still |
||||
Image Data Compression Standard" by William B. Pennebaker and Joan L. |
||||
Mitchell, published by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. |
||||
Price US$59.95, 638 pp. The book includes the complete text of the ISO JPEG |
||||
standards (DIS 10918-1 and draft DIS 10918-2). |
||||
Although this is by far the most detailed and comprehensive exposition of |
||||
JPEG publicly available, we point out that it is still missing an explanation |
||||
of the most essential properties and algorithms of the underlying DCT |
||||
technology. |
||||
If you think that you know about DCT-based JPEG after reading this book, |
||||
then you are in delusion. The real fundamentals and corresponding potential |
||||
of DCT-based JPEG are not publicly known so far, and that is the reason for |
||||
all the mistaken developments taking place in the image coding domain. |
||||
|
||||
The original JPEG standard is divided into two parts, Part 1 being the actual |
||||
specification, while Part 2 covers compliance testing methods. Part 1 is |
||||
titled "Digital Compression and Coding of Continuous-tone Still Images, |
||||
Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS |
||||
10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of |
||||
Continuous-tone Still Images, Part 2: Compliance testing" and has document |
||||
numbers ISO/IEC IS 10918-2, ITU-T T.83. |
||||
IJG JPEG 8 introduces an implementation of the JPEG SmartScale extension |
||||
which is specified in a contributed document at ITU and ISO with title "ITU-T |
||||
JPEG-Plus Proposal for Extending ITU-T T.81 for Advanced Image Coding", April |
||||
2006, Geneva, Switzerland. The latest version of the document is Revision 3. |
||||
|
||||
The JPEG standard does not specify all details of an interchangeable file |
||||
format. For the omitted details we follow the "JFIF" conventions, revision |
||||
1.02. JFIF 1.02 has been adopted as an Ecma International Technical Report |
||||
and thus received a formal publication status. It is available as a free |
||||
download in PDF format from |
||||
http://www.ecma-international.org/publications/techreports/E-TR-098.htm. |
||||
A PostScript version of the JFIF document is available at |
||||
http://www.ijg.org/files/jfif.ps.gz. There is also a plain text version at |
||||
http://www.ijg.org/files/jfif.txt.gz, but it is missing the figures. |
||||
|
||||
The TIFF 6.0 file format specification can be obtained by FTP from |
||||
ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme |
||||
found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems. |
||||
IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6). |
||||
Instead, we recommend the JPEG design proposed by TIFF Technical Note #2 |
||||
(Compression tag 7). Copies of this Note can be obtained from |
||||
http://www.ijg.org/files/. It is expected that the next revision |
||||
of the TIFF spec will replace the 6.0 JPEG design with the Note's design. |
||||
Although IJG's own code does not support TIFF/JPEG, the free libtiff library |
||||
uses our library to implement TIFF/JPEG per the Note. |
||||
|
||||
|
||||
ARCHIVE LOCATIONS |
||||
================= |
||||
|
||||
The "official" archive site for this software is www.ijg.org. |
||||
The most recent released version can always be found there in |
||||
directory "files". This particular version will be archived as |
||||
http://www.ijg.org/files/jpegsrc.v8c.tar.gz, and in Windows-compatible |
||||
"zip" archive format as http://www.ijg.org/files/jpegsr8c.zip. |
||||
|
||||
The JPEG FAQ (Frequently Asked Questions) article is a source of some |
||||
general information about JPEG. |
||||
It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq/ |
||||
and other news.answers archive sites, including the official news.answers |
||||
archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/. |
||||
If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu |
||||
with body |
||||
send usenet/news.answers/jpeg-faq/part1 |
||||
send usenet/news.answers/jpeg-faq/part2 |
||||
|
||||
|
||||
ACKNOWLEDGMENTS |
||||
=============== |
||||
|
||||
Thank to Juergen Bruder for providing me with a copy of the common DCT |
||||
algorithm article, only to find out that I had come to the same result |
||||
in a more direct and comprehensible way with a more generative approach. |
||||
|
||||
Thank to Istvan Sebestyen and Joan L. Mitchell for inviting me to the |
||||
ITU JPEG (Study Group 16) meeting in Geneva, Switzerland. |
||||
|
||||
Thank to Thomas Wiegand and Gary Sullivan for inviting me to the |
||||
Joint Video Team (MPEG & ITU) meeting in Geneva, Switzerland. |
||||
|
||||
Thank to John Korejwa and Massimo Ballerini for inviting me to |
||||
fruitful consultations in Boston, MA and Milan, Italy. |
||||
|
||||
Thank to Hendrik Elstner, Roland Fassauer, Simone Zuck, Guenther |
||||
Maier-Gerber, Walter Stoeber, Fred Schmitz, and Norbert Braunagel |
||||
for corresponding business development. |
||||
|
||||
Thank to Nico Zschach and Dirk Stelling of the technical support team |
||||
at the Digital Images company in Halle for providing me with extra |
||||
equipment for configuration tests. |
||||
|
||||
Thank to Richard F. Lyon (then of Foveon Inc.) for fruitful |
||||
communication about JPEG configuration in Sigma Photo Pro software. |
||||
|
||||
Thank to Andrew Finkenstadt for hosting the ijg.org site. |
||||
|
||||
Last but not least special thank to Thomas G. Lane for the original |
||||
design and development of this singular software package. |
||||
|
||||
|
||||
FILE FORMAT WARS |
||||
================ |
||||
|
||||
The ISO JPEG standards committee actually promotes different formats like |
||||
"JPEG 2000" or "JPEG XR" which are incompatible with original DCT-based |
||||
JPEG and which are based on faulty technologies. IJG therefore does not |
||||
and will not support such momentary mistakes (see REFERENCES). |
||||
We have little or no sympathy for the promotion of these formats. Indeed, |
||||
one of the original reasons for developing this free software was to help |
||||
force convergence on common, interoperable format standards for JPEG files. |
||||
Don't use an incompatible file format! |
||||
(In any case, our decoder will remain capable of reading existing JPEG |
||||
image files indefinitely.) |
||||
|
||||
|
||||
TO DO |
||||
===== |
||||
|
||||
Version 8 is the first release of a new generation JPEG standard |
||||
to overcome the limitations of the original JPEG specification. |
||||
More features are being prepared for coming releases... |
||||
|
||||
Please send bug reports, offers of help, etc. to jpeg-info@uc.ag. |
@ -1,5 +0,0 @@
|
||||
This is a slightly modified version of the jpeg library. A new color space |
||||
is added, "JCS_RGBA", for reading from/writing to jpeg files using the format |
||||
expected by the CyanWorlds.com Engine. This code does not pretend to provide |
||||
more RGBA support than needed for the CyanWorlds.com Engine. |
||||
|
File diff suppressed because it is too large
Load Diff
@ -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>. |
@ -1,739 +0,0 @@
|
||||
/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved. */ |
||||
|
||||
/*$Id: ansi2knr.c,v 1.14 2003/09/06 05:36:56 eggert Exp $*/ |
||||
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */ |
||||
|
||||
/*
|
||||
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, |
||||
or, if there is no file named COPYLEFT, a file named COPYING. 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 set of sources 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. |
||||
*/ |
||||
|
||||
/*
|
||||
* Usage: |
||||
ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]] |
||||
* --filename provides the file name for the #line directive in the output, |
||||
* overriding input_file (if present). |
||||
* If no input_file is supplied, input is read from stdin. |
||||
* 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 and/or preprocessor directives), except that a line |
||||
* consisting of only |
||||
* identifier1(identifier2) |
||||
* will not be considered a function definition unless identifier2 is |
||||
* the word "void", and a line consisting of |
||||
* identifier1(identifier2, <<arbitrary>>) |
||||
* will not be considered a function definition. |
||||
* ansi2knr 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, comments, and preprocessor directives, 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 function headers. |
||||
*/ |
||||
|
||||
/*
|
||||
* 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 2000-04-12 backs out Eggert's changes because of bugs: |
||||
- concatlits didn't declare the type of its bufend argument; |
||||
- concatlits didn't recognize when it was inside a comment; |
||||
- scanstring could scan backward past the beginning of the string; when |
||||
- the check for \ + newline in scanstring was unnecessary. |
||||
|
||||
2000-03-05 Paul Eggert <eggert@twinsun.com> |
||||
|
||||
Add support for concatenated string literals. |
||||
* ansi2knr.c (concatlits): New decl. |
||||
(main): Invoke concatlits to concatenate string literals. |
||||
(scanstring): Handle backslash-newline correctly. Work with |
||||
character constants. Fix bug when scanning backwards through |
||||
backslash-quote. Check for unterminated strings. |
||||
(convert1): Parse character constants, too. |
||||
(appendline, concatlits): New functions. |
||||
* ansi2knr.1: Document this. |
||||
|
||||
lpd 1999-08-17 added code to allow preprocessor directives |
||||
wherever comments are allowed |
||||
lpd 1999-04-12 added minor fixes from Pavel Roskin |
||||
<pavel_roskin@geocities.com> for clean compilation with |
||||
gcc -W -Wall |
||||
lpd 1999-03-22 added hack to recognize lines consisting of |
||||
identifier1(identifier2, xxx) as *not* being procedures |
||||
lpd 1999-02-03 made indentation of preprocessor commands consistent |
||||
lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an |
||||
endless loop; quoted strings within an argument list |
||||
confused the parser |
||||
lpd 1999-01-24 added a check for write errors on the output, |
||||
suggested by Jim Meyering <meyering@ascend.com> |
||||
lpd 1998-11-09 added further hack to recognize identifier(void) |
||||
as being a procedure |
||||
lpd 1998-10-23 added hack to recognize lines consisting of |
||||
identifier1(identifier2) as *not* being procedures |
||||
lpd 1997-12-08 made input_file optional; only closes input and/or |
||||
output file if not stdin or stdout respectively; prints |
||||
usage message on stderr rather than stdout; adds |
||||
--filename switch (changes suggested by |
||||
<ceder@lysator.liu.se>) |
||||
lpd 1996-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 1996-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 1995-06-22 removed #ifndefs whose sole purpose was to define |
||||
undefined preprocessor symbols as 0; changed all #ifdefs |
||||
for configuration symbols to #ifs |
||||
lpd 1995-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 1994-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 1994-10-10 removed CONFIG_BROKETS conditional |
||||
lpd 1994-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 1989-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 |
||||
|
||||
/* Define NULL (for *very* old compilers). */ |
||||
#ifndef NULL |
||||
# define NULL (0) |
||||
#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 *ppdirforward(); |
||||
char *ppdirbackward(); |
||||
char *skipspace(); |
||||
char *scanstring(); |
||||
int writeblanks(); |
||||
int test1(); |
||||
int convert1(); |
||||
|
||||
/* The main program */ |
||||
int |
||||
main(argc, argv) |
||||
int argc; |
||||
char *argv[]; |
||||
{ FILE *in = stdin; |
||||
FILE *out = stdout; |
||||
char *filename = 0; |
||||
char *program_name = argv[0]; |
||||
char *output_name = 0; |
||||
#define bufsize 5000 /* arbitrary size */ |
||||
char *buf; |
||||
char *line; |
||||
char *more; |
||||
char *usage = |
||||
"Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n"; |
||||
/*
|
||||
* 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; |
||||
int output_error; |
||||
|
||||
while ( argc > 1 && argv[1][0] == '-' ) { |
||||
if ( !strcmp(argv[1], "--varargs") ) { |
||||
convert_varargs = 1; |
||||
argc--; |
||||
argv++; |
||||
continue; |
||||
} |
||||
if ( !strcmp(argv[1], "--filename") && argc > 2 ) { |
||||
filename = argv[2]; |
||||
argc -= 2; |
||||
argv += 2; |
||||
continue; |
||||
} |
||||
fprintf(stderr, "%s: Unrecognized switch: %s\n", program_name, |
||||
argv[1]); |
||||
fprintf(stderr, usage); |
||||
exit(1); |
||||
} |
||||
switch ( argc ) |
||||
{ |
||||
default: |
||||
fprintf(stderr, usage); |
||||
exit(0); |
||||
case 3: |
||||
output_name = argv[2]; |
||||
out = fopen(output_name, "w"); |
||||
if ( out == NULL ) { |
||||
fprintf(stderr, "%s: Cannot open output file %s\n", |
||||
program_name, output_name); |
||||
exit(1); |
||||
} |
||||
/* falls through */ |
||||
case 2: |
||||
in = fopen(argv[1], "r"); |
||||
if ( in == NULL ) { |
||||
fprintf(stderr, "%s: Cannot open input file %s\n", |
||||
program_name, argv[1]); |
||||
exit(1); |
||||
} |
||||
if ( filename == 0 ) |
||||
filename = argv[1]; |
||||
/* falls through */ |
||||
case 1: |
||||
break; |
||||
} |
||||
if ( filename ) |
||||
fprintf(out, "#line 1 \"%s\"\n", filename); |
||||
buf = malloc(bufsize); |
||||
if ( buf == NULL ) |
||||
{ |
||||
fprintf(stderr, "Unable to allocate read buffer!\n"); |
||||
exit(1); |
||||
} |
||||
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(ppdirforward(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); |
||||
if ( output_name ) { |
||||
output_error = ferror(out); |
||||
output_error |= fclose(out); |
||||
} else { /* out == stdout */ |
||||
fflush(out); |
||||
output_error = ferror(out); |
||||
} |
||||
if ( output_error ) { |
||||
fprintf(stderr, "%s: error writing to %s\n", program_name, |
||||
(output_name ? output_name : "stdout")); |
||||
exit(1); |
||||
} |
||||
if ( in != stdin ) |
||||
fclose(in); |
||||
return 0; |
||||
} |
||||
|
||||
/*
|
||||
* Skip forward or backward over one or more preprocessor directives. |
||||
*/ |
||||
char * |
||||
ppdirforward(p) |
||||
char *p; |
||||
{ |
||||
for (; *p == '#'; ++p) { |
||||
for (; *p != '\r' && *p != '\n'; ++p) |
||||
if (*p == 0) |
||||
return p; |
||||
if (*p == '\r' && p[1] == '\n') |
||||
++p; |
||||
} |
||||
return p; |
||||
} |
||||
char * |
||||
ppdirbackward(p, limit) |
||||
char *p; |
||||
char *limit; |
||||
{ |
||||
char *np = p; |
||||
|
||||
for (;; p = --np) { |
||||
if (*np == '\n' && np[-1] == '\r') |
||||
--np; |
||||
for (; np > limit && np[-1] != '\r' && np[-1] != '\n'; --np) |
||||
if (np[-1] == 0) |
||||
return np; |
||||
if (*np != '#') |
||||
return p; |
||||
} |
||||
} |
||||
|
||||
/*
|
||||
* Skip over whitespace, comments, and preprocessor directives, |
||||
* in either direction. |
||||
*/ |
||||
char * |
||||
skipspace(p, dir) |
||||
char *p; |
||||
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; |
||||
} |
||||
|
||||
/* Scan over a quoted string, in either direction. */ |
||||
char * |
||||
scanstring(p, dir) |
||||
char *p; |
||||
int dir; |
||||
{ |
||||
for (p += dir; ; p += dir) |
||||
if (*p == '"' && p[-dir] != '\\') |
||||
return p + dir; |
||||
} |
||||
|
||||
/*
|
||||
* 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; |
||||
{ char *p = buf; |
||||
char *bend; |
||||
char *endfn; |
||||
int contin; |
||||
|
||||
if ( !isidfirstchar(*p) ) |
||||
return 0; /* no name at left margin */ |
||||
bend = skipspace(ppdirbackward(buf + strlen(buf) - 1, buf), -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; |
||||
unsigned len = endfn - buf; |
||||
|
||||
while ( (kp = *key) != 0 ) |
||||
{ if ( strlen(kp) == len && !strncmp(kp, buf, len) ) |
||||
return 0; /* name is a keyword */ |
||||
key++; |
||||
} |
||||
} |
||||
{ |
||||
char *id = p; |
||||
int len; |
||||
/*
|
||||
* Check for identifier1(identifier2) and not |
||||
* identifier1(void), or identifier1(identifier2, xxxx). |
||||
*/ |
||||
|
||||
while ( isidchar(*p) ) |
||||
p++; |
||||
len = p - id; |
||||
p = skipspace(p, 1); |
||||
if (*p == ',' || |
||||
(*p == ')' && (len != 4 || strncmp(id, "void", 4))) |
||||
) |
||||
return 0; /* not a function */ |
||||
} |
||||
/*
|
||||
* If the last significant character was a ), we need to count |
||||
* parentheses, because it might be part of a formal parameter |
||||
* that is a procedure. |
||||
*/ |
||||
if (contin > 0) { |
||||
int level = 0; |
||||
|
||||
for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1)) |
||||
level += (*p == '(' ? 1 : *p == ')' ? -1 : 0); |
||||
if (level > 0) |
||||
contin = -1; |
||||
} |
||||
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; |
||||
char *p; |
||||
/*
|
||||
* The breaks table contains pointers to the beginning and end |
||||
* of each argument. |
||||
*/ |
||||
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 == NULL ) |
||||
{ /* 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 = NULL; |
||||
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 '/': |
||||
if (p[1] == '*') |
||||
p = skipspace(p, 1) - 1; |
||||
break; |
||||
case '"': |
||||
p = scanstring(p, 1) - 1; |
||||
break; |
||||
default: |
||||
; |
||||
} |
||||
} |
||||
/* Erase any embedded prototype parameters. */ |
||||
if ( lp && rp ) |
||||
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 '/': |
||||
if (p > buf && p[-1] == '*') |
||||
p = skipspace(p, -1) + 1; |
||||
break; |
||||
case '"': |
||||
p = scanstring(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; |
||||
} |
@ -1,134 +0,0 @@
|
||||
/*
|
||||
* cderror.h |
||||
* |
||||
* Copyright (C) 1994-1997, Thomas G. Lane. |
||||
* Modified 2009 by Guido Vollbeding. |
||||
* This file is part of the Independent JPEG Group's software. |
||||
* For conditions of distribution and use, see the accompanying README file. |
||||
* |
||||
* This file defines the error and message codes for the cjpeg/djpeg |
||||
* applications. These strings are not needed as part of the JPEG library |
||||
* proper. |
||||
* Edit this file to add new codes, or to translate the message strings to |
||||
* some other language. |
||||
*/ |
||||
|
||||
/*
|
||||
* To define the enum list of message codes, include this file without |
||||
* defining macro JMESSAGE. To create a message string table, include it |
||||
* again with a suitable JMESSAGE definition (see jerror.c for an example). |
||||
*/ |
||||
#ifndef JMESSAGE |
||||
#ifndef CDERROR_H |
||||
#define CDERROR_H |
||||
/* First time through, define the enum list */ |
||||
#define JMAKE_ENUM_LIST |
||||
#else |
||||
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ |
||||
#define JMESSAGE(code,string) |
||||
#endif /* CDERROR_H */ |
||||
#endif /* JMESSAGE */ |
||||
|
||||
#ifdef JMAKE_ENUM_LIST |
||||
|
||||
typedef enum { |
||||
|
||||
#define JMESSAGE(code,string) code , |
||||
|
||||
#endif /* JMAKE_ENUM_LIST */ |
||||
|
||||
JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */ |
||||
|
||||
#ifdef BMP_SUPPORTED |
||||
JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format") |
||||
JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported") |
||||
JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length") |
||||
JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1") |
||||
JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB") |
||||
JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported") |
||||
JMESSAGE(JERR_BMP_EMPTY, "Empty BMP image") |
||||
JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM") |
||||
JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image") |
||||
JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image") |
||||
JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image") |
||||
JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image") |
||||
#endif /* BMP_SUPPORTED */ |
||||
|
||||
#ifdef GIF_SUPPORTED |
||||
JMESSAGE(JERR_GIF_BUG, "GIF output got confused") |
||||
JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d") |
||||
JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB") |
||||
JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file") |
||||
JMESSAGE(JERR_GIF_NOT, "Not a GIF file") |
||||
JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image") |
||||
JMESSAGE(JTRC_GIF_BADVERSION, |
||||
"Warning: unexpected GIF version number '%c%c%c'") |
||||
JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x") |
||||
JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input") |
||||
JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file") |
||||
JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring") |
||||
JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image") |
||||
JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits") |
||||
#endif /* GIF_SUPPORTED */ |
||||
|
||||
#ifdef PPM_SUPPORTED |
||||
JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB") |
||||
JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file") |
||||
JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file") |
||||
JMESSAGE(JTRC_PGM, "%ux%u PGM image") |
||||
JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image") |
||||
JMESSAGE(JTRC_PPM, "%ux%u PPM image") |
||||
JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image") |
||||
#endif /* PPM_SUPPORTED */ |
||||
|
||||
#ifdef RLE_SUPPORTED |
||||
JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library") |
||||
JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB") |
||||
JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE") |
||||
JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file") |
||||
JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header") |
||||
JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header") |
||||
JMESSAGE(JERR_RLE_NOT, "Not an RLE file") |
||||
JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE") |
||||
JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup") |
||||
JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file") |
||||
JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d") |
||||
JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file") |
||||
JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d") |
||||
JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d") |
||||
#endif /* RLE_SUPPORTED */ |
||||
|
||||
#ifdef TARGA_SUPPORTED |
||||
JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format") |
||||
JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file") |
||||
JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB") |
||||
JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image") |
||||
JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image") |
||||
JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image") |
||||
#else |
||||
JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled") |
||||
#endif /* TARGA_SUPPORTED */ |
||||
|
||||
JMESSAGE(JERR_BAD_CMAP_FILE, |
||||
"Color map file is invalid or of unsupported format") |
||||
JMESSAGE(JERR_TOO_MANY_COLORS, |
||||
"Output file format cannot handle %d colormap entries") |
||||
JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed") |
||||
#ifdef TARGA_SUPPORTED |
||||
JMESSAGE(JERR_UNKNOWN_FORMAT, |
||||
"Unrecognized input file format --- perhaps you need -targa") |
||||
#else |
||||
JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format") |
||||
#endif |
||||
JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format") |
||||
|
||||
#ifdef JMAKE_ENUM_LIST |
||||
|
||||
JMSG_LASTADDONCODE |
||||
} ADDON_MESSAGE_CODE; |
||||
|
||||
#undef JMAKE_ENUM_LIST |
||||
#endif /* JMAKE_ENUM_LIST */ |
||||
|
||||
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ |
||||
#undef JMESSAGE |
@ -1,181 +0,0 @@
|
||||
/*
|
||||
* cdjpeg.c |
||||
* |
||||
* Copyright (C) 1991-1997, Thomas G. Lane. |
||||
* This file is part of the Independent JPEG Group's software. |
||||
* For conditions of distribution and use, see the accompanying README file. |
||||
* |
||||
* This file contains common support routines used by the IJG application |
||||
* programs (cjpeg, djpeg, jpegtran). |
||||
*/ |
||||
|
||||
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ |
||||
#include <ctype.h> /* to declare isupper(), tolower() */ |
||||
#ifdef NEED_SIGNAL_CATCHER |
||||
#include <signal.h> /* to declare signal() */ |
||||
#endif |
||||
#ifdef USE_SETMODE |
||||
#include <fcntl.h> /* to declare setmode()'s parameter macros */ |
||||
/* If you have setmode() but not <io.h>, just delete this line: */ |
||||
#include <io.h> /* to declare setmode() */ |
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
* Signal catcher to ensure that temporary files are removed before aborting. |
||||
* NB: for Amiga Manx C this is actually a global routine named _abort(); |
||||
* we put "#define signal_catcher _abort" in jconfig.h. Talk about bogus... |
||||
*/ |
||||
|
||||
#ifdef NEED_SIGNAL_CATCHER |
||||
|
||||
static j_common_ptr sig_cinfo; |
||||
|
||||
void /* must be global for Manx C */ |
||||
signal_catcher (int signum) |
||||
{ |
||||
if (sig_cinfo != NULL) { |
||||
if (sig_cinfo->err != NULL) /* turn off trace output */ |
||||
sig_cinfo->err->trace_level = 0; |
||||
jpeg_destroy(sig_cinfo); /* clean up memory allocation & temp files */ |
||||
} |
||||
exit(EXIT_FAILURE); |
||||
} |
||||
|
||||
|
||||
GLOBAL(void) |
||||
enable_signal_catcher (j_common_ptr cinfo) |
||||
{ |
||||
sig_cinfo = cinfo; |
||||
#ifdef SIGINT /* not all systems have SIGINT */ |
||||
signal(SIGINT, signal_catcher); |
||||
#endif |
||||
#ifdef SIGTERM /* not all systems have SIGTERM */ |
||||
signal(SIGTERM, signal_catcher); |
||||
#endif |
||||
} |
||||
|
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
* Optional progress monitor: display a percent-done figure on stderr. |
||||
*/ |
||||
|
||||
#ifdef PROGRESS_REPORT |
||||
|
||||
METHODDEF(void) |
||||
progress_monitor (j_common_ptr cinfo) |
||||
{ |
||||
cd_progress_ptr prog = (cd_progress_ptr) cinfo->progress; |
||||
int total_passes = prog->pub.total_passes + prog->total_extra_passes; |
||||
int percent_done = (int) (prog->pub.pass_counter*100L/prog->pub.pass_limit); |
||||
|
||||
if (percent_done != prog->percent_done) { |
||||
prog->percent_done = percent_done; |
||||
if (total_passes > 1) { |
||||
fprintf(stderr, "\rPass %d/%d: %3d%% ", |
||||
prog->pub.completed_passes + prog->completed_extra_passes + 1, |
||||
total_passes, percent_done); |
||||
} else { |
||||
fprintf(stderr, "\r %3d%% ", percent_done); |
||||
} |
||||
fflush(stderr); |
||||
} |
||||
} |
||||
|
||||
|
||||
GLOBAL(void) |
||||
start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress) |
||||
{ |
||||
/* Enable progress display, unless trace output is on */ |
||||
if (cinfo->err->trace_level == 0) { |
||||
progress->pub.progress_monitor = progress_monitor; |
||||
progress->completed_extra_passes = 0; |
||||
progress->total_extra_passes = 0; |
||||
progress->percent_done = -1; |
||||
cinfo->progress = &progress->pub; |
||||
} |
||||
} |
||||
|
||||
|
||||
GLOBAL(void) |
||||
end_progress_monitor (j_common_ptr cinfo) |
||||
{ |
||||
/* Clear away progress display */ |
||||
if (cinfo->err->trace_level == 0) { |
||||
fprintf(stderr, "\r \r"); |
||||
fflush(stderr); |
||||
} |
||||
} |
||||
|
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
* Case-insensitive matching of possibly-abbreviated keyword switches. |
||||
* keyword is the constant keyword (must be lower case already), |
||||
* minchars is length of minimum legal abbreviation. |
||||
*/ |
||||
|
||||
GLOBAL(boolean) |
||||
keymatch (char * arg, const char * keyword, int minchars) |
||||
{ |
||||
register int ca, ck; |
||||
register int nmatched = 0; |
||||
|
||||
while ((ca = *arg++) != '\0') { |
||||
if ((ck = *keyword++) == '\0') |
||||
return FALSE; /* arg longer than keyword, no good */ |
||||
if (isupper(ca)) /* force arg to lcase (assume ck is already) */ |
||||
ca = tolower(ca); |
||||
if (ca != ck) |
||||
return FALSE; /* no good */ |
||||
nmatched++; /* count matched characters */ |
||||
} |
||||
/* reached end of argument; fail if it's too short for unique abbrev */ |
||||
if (nmatched < minchars) |
||||
return FALSE; |
||||
return TRUE; /* A-OK */ |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Routines to establish binary I/O mode for stdin and stdout. |
||||
* Non-Unix systems often require some hacking to get out of text mode. |
||||
*/ |
||||
|
||||
GLOBAL(FILE *) |
||||
read_stdin (void) |
||||
{ |
||||
FILE * input_file = stdin; |
||||
|
||||
#ifdef USE_SETMODE /* need to hack file mode? */ |
||||
setmode(fileno(stdin), O_BINARY); |
||||
#endif |
||||
#ifdef USE_FDOPEN /* need to re-open in binary mode? */ |
||||
if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) { |
||||
fprintf(stderr, "Cannot reopen stdin\n"); |
||||
exit(EXIT_FAILURE); |
||||
} |
||||
#endif |
||||
return input_file; |
||||
} |
||||
|
||||
|
||||
GLOBAL(FILE *) |
||||
write_stdout (void) |
||||
{ |
||||
FILE * output_file = stdout; |
||||
|
||||
#ifdef USE_SETMODE /* need to hack file mode? */ |
||||
setmode(fileno(stdout), O_BINARY); |
||||
#endif |
||||
#ifdef USE_FDOPEN /* need to re-open in binary mode? */ |
||||
if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) { |
||||
fprintf(stderr, "Cannot reopen stdout\n"); |
||||
exit(EXIT_FAILURE); |
||||
} |
||||
#endif |
||||
return output_file; |
||||
} |
@ -1,187 +0,0 @@
|
||||
/*
|
||||
* cdjpeg.h |
||||
* |
||||
* Copyright (C) 1994-1997, Thomas G. Lane. |
||||
* This file is part of the Independent JPEG Group's software. |
||||
* For conditions of distribution and use, see the accompanying README file. |
||||
* |
||||
* This file contains common declarations for the sample applications |
||||
* cjpeg and djpeg. It is NOT used by the core JPEG library. |
||||
*/ |
||||
|
||||
#define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */ |
||||
#define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */ |
||||
#include "jinclude.h" |
||||
#include "jpeglib.h" |
||||
#include "jerror.h" /* get library error codes too */ |
||||
#include "cderror.h" /* get application-specific error codes */ |
||||
|
||||
|
||||
/*
|
||||
* Object interface for cjpeg's source file decoding modules |
||||
*/ |
||||
|
||||
typedef struct cjpeg_source_struct * cjpeg_source_ptr; |
||||
|
||||
struct cjpeg_source_struct { |
||||
JMETHOD(void, start_input, (j_compress_ptr cinfo, |
||||
cjpeg_source_ptr sinfo)); |
||||
JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo, |
||||
cjpeg_source_ptr sinfo)); |
||||
JMETHOD(void, finish_input, (j_compress_ptr cinfo, |
||||
cjpeg_source_ptr sinfo)); |
||||
|
||||
FILE *input_file; |
||||
|
||||
JSAMPARRAY buffer; |
||||
JDIMENSION buffer_height; |
||||
}; |
||||
|
||||
|
||||
/*
|
||||
* Object interface for djpeg's output file encoding modules |
||||
*/ |
||||
|
||||
typedef struct djpeg_dest_struct * djpeg_dest_ptr; |
||||
|
||||
struct djpeg_dest_struct { |
||||
/* start_output is called after jpeg_start_decompress finishes.
|
||||
* The color map will be ready at this time, if one is needed. |
||||
*/ |
||||
JMETHOD(void, start_output, (j_decompress_ptr cinfo, |
||||
djpeg_dest_ptr dinfo)); |
||||
/* Emit the specified number of pixel rows from the buffer. */ |
||||
JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo, |
||||
djpeg_dest_ptr dinfo, |
||||
JDIMENSION rows_supplied)); |
||||
/* Finish up at the end of the image. */ |
||||
JMETHOD(void, finish_output, (j_decompress_ptr cinfo, |
||||
djpeg_dest_ptr dinfo)); |
||||
|
||||
/* Target file spec; filled in by djpeg.c after object is created. */ |
||||
FILE * output_file; |
||||
|
||||
/* Output pixel-row buffer. Created by module init or start_output.
|
||||
* Width is cinfo->output_width * cinfo->output_components; |
||||
* height is buffer_height. |
||||
*/ |
||||
JSAMPARRAY buffer; |
||||
JDIMENSION buffer_height; |
||||
}; |
||||
|
||||
|
||||
/*
|
||||
* cjpeg/djpeg may need to perform extra passes to convert to or from |
||||
* the source/destination file format. The JPEG library does not know |
||||
* about these passes, but we'd like them to be counted by the progress |
||||
* monitor. We use an expanded progress monitor object to hold the |
||||
* additional pass count. |
||||
*/ |
||||
|
||||
struct cdjpeg_progress_mgr { |
||||
struct jpeg_progress_mgr pub; /* fields known to JPEG library */ |
||||
int completed_extra_passes; /* extra passes completed */ |
||||
int total_extra_passes; /* total extra */ |
||||
/* last printed percentage stored here to avoid multiple printouts */ |
||||
int percent_done; |
||||
}; |
||||
|
||||
typedef struct cdjpeg_progress_mgr * cd_progress_ptr; |
||||
|
||||
|
||||
/* Short forms of external names for systems with brain-damaged linkers. */ |
||||
|
||||
#ifdef NEED_SHORT_EXTERNAL_NAMES |
||||
#define jinit_read_bmp jIRdBMP |
||||
#define jinit_write_bmp jIWrBMP |
||||
#define jinit_read_gif jIRdGIF |
||||
#define jinit_write_gif jIWrGIF |
||||
#define jinit_read_ppm jIRdPPM |
||||
#define jinit_write_ppm jIWrPPM |
||||
#define jinit_read_rle jIRdRLE |
||||
#define jinit_write_rle jIWrRLE |
||||
#define jinit_read_targa jIRdTarga |
||||
#define jinit_write_targa jIWrTarga |
||||
#define read_quant_tables RdQTables |
||||
#define read_scan_script RdScnScript |
||||
#define set_quality_ratings SetQRates |
||||
#define set_quant_slots SetQSlots |
||||
#define set_sample_factors SetSFacts |
||||
#define read_color_map RdCMap |
||||
#define enable_signal_catcher EnSigCatcher |
||||
#define start_progress_monitor StProgMon |
||||
#define end_progress_monitor EnProgMon |
||||
#define read_stdin RdStdin |
||||
#define write_stdout WrStdout |
||||
#endif /* NEED_SHORT_EXTERNAL_NAMES */ |
||||
|
||||
/* Module selection routines for I/O modules. */ |
||||
|
||||
EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo)); |
||||
EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo, |
||||
boolean is_os2)); |
||||
EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo)); |
||||
EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo)); |
||||
EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo)); |
||||
EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo)); |
||||
EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo)); |
||||
EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo)); |
||||
EXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo)); |
||||
EXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo)); |
||||
|
||||
/* cjpeg support routines (in rdswitch.c) */ |
||||
|
||||
EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename, |
||||
boolean force_baseline)); |
||||
EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename)); |
||||
EXTERN(boolean) set_quality_ratings JPP((j_compress_ptr cinfo, char *arg, |
||||
boolean force_baseline)); |
||||
EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg)); |
||||
EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg)); |
||||
|
||||
/* djpeg support routines (in rdcolmap.c) */ |
||||
|
||||
EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile)); |
||||
|
||||
/* common support routines (in cdjpeg.c) */ |
||||
|
||||
EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo)); |
||||
EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo, |
||||
cd_progress_ptr progress)); |
||||
EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo)); |
||||
EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars)); |
||||
EXTERN(FILE *) read_stdin JPP((void)); |
||||
EXTERN(FILE *) write_stdout JPP((void)); |
||||
|
||||
/* miscellaneous useful macros */ |
||||
|
||||
#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ |
||||
#define READ_BINARY "r" |
||||
#define WRITE_BINARY "w" |
||||
#else |
||||
#ifdef VMS /* VMS is very nonstandard */ |
||||
#define READ_BINARY "rb", "ctx=stm" |
||||
#define WRITE_BINARY "wb", "ctx=stm" |
||||
#else /* standard ANSI-compliant case */ |
||||
#define READ_BINARY "rb" |
||||
#define WRITE_BINARY "wb" |
||||
#endif |
||||
#endif |
||||
|
||||
#ifndef EXIT_FAILURE /* define exit() codes if not provided */ |
||||
#define EXIT_FAILURE 1 |
||||
#endif |
||||
#ifndef EXIT_SUCCESS |
||||
#ifdef VMS |
||||
#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ |
||||
#else |
||||
#define EXIT_SUCCESS 0 |
||||
#endif |
||||
#endif |
||||
#ifndef EXIT_WARNING |
||||
#ifdef VMS |
||||
#define EXIT_WARNING 1 /* VMS is very nonstandard */ |
||||
#else |
||||
#define EXIT_WARNING 2 |
||||
#endif |
||||
#endif |
@ -1,326 +0,0 @@
|
||||
CHANGE LOG for Independent JPEG Group's JPEG software |
||||
|
||||
|
||||
Version 8c 16-Jan-2011 |
||||
----------------------- |
||||
|
||||
Add option to compression library and cjpeg (-block N) to use |
||||
different DCT block size. |
||||
All N from 1 to 16 are possible. Default is 8 (baseline format). |
||||
Larger values produce higher compression, |
||||
smaller values produce higher quality. |
||||
SmartScale capable decoder (introduced with IJG JPEG 8) required. |
||||
|
||||
|
||||
Version 8b 16-May-2010 |
||||
----------------------- |
||||
|
||||
Repair problem in new memory source manager with corrupt JPEG data. |
||||
Thank to Ted Campbell and Samuel Chun for the report. |
||||
|
||||
Repair problem in Makefile.am test target. |
||||
Thank to anonymous user for the report. |
||||
|
||||
Support MinGW installation with automatic configure. |
||||
Thank to Volker Grabsch for the suggestion. |
||||
|
||||
|
||||
Version 8a 28-Feb-2010 |
||||
----------------------- |
||||
|
||||
Writing tables-only datastreams via jpeg_write_tables works again. |
||||
|
||||
Support 32-bit BMPs (RGB image with Alpha channel) for read in cjpeg. |
||||
Thank to Brett Blackham for the suggestion. |
||||
|
||||
Improve accuracy in floating point IDCT calculation. |
||||
Thank to Robert Hooke for the hint. |
||||
|
||||
|
||||
Version 8 10-Jan-2010 |
||||
---------------------- |
||||
|
||||
jpegtran now supports the same -scale option as djpeg for "lossless" resize. |
||||
An implementation of the JPEG SmartScale extension is required for this |
||||
feature. A (draft) specification of the JPEG SmartScale extension is |
||||
available as a contributed document at ITU and ISO. Revision 2 or later |
||||
of the document is required (latest document version is Revision 3). |
||||
The SmartScale extension will enable more features beside lossless resize |
||||
in future implementations, as described in the document (new compression |
||||
options). |
||||
|
||||
Add sanity check in BMP reader module to avoid cjpeg crash for empty input |
||||
image (thank to Isaev Ildar of ISP RAS, Moscow, RU for reporting this error). |
||||
|
||||
Add data source and destination managers for read from and write to |
||||
memory buffers. New API functions jpeg_mem_src and jpeg_mem_dest. |
||||
Thank to Roberto Boni from Italy for the suggestion. |
||||
|
||||
|
||||
Version 7 27-Jun-2009 |
||||
---------------------- |
||||
|
||||
New scaled DCTs implemented. |
||||
djpeg now supports scalings N/8 with all N from 1 to 16. |
||||
cjpeg now supports scalings 8/N with all N from 1 to 16. |
||||
Scaled DCTs with size larger than 8 are now also used for resolving the |
||||
common 2x2 chroma subsampling case without additional spatial resampling. |
||||
Separate spatial resampling for those kind of files is now only necessary |
||||
for N>8 scaling cases. |
||||
Furthermore, separate scaled DCT functions are provided for direct resolving |
||||
of the common asymmetric subsampling cases (2x1 and 1x2) without additional |
||||
spatial resampling. |
||||
|
||||
cjpeg -quality option has been extended for support of separate quality |
||||
settings for luminance and chrominance (or in general, for every provided |
||||
quantization table slot). |
||||
New API function jpeg_default_qtables() and q_scale_factor array in library. |
||||
|
||||
Added -nosmooth option to cjpeg, complementary to djpeg. |
||||
New variable "do_fancy_downsampling" in library, complement to fancy |
||||
upsampling. Fancy upsampling now uses direct DCT scaling with sizes |
||||
larger than 8. The old method is not reversible and has been removed. |
||||
|
||||
Support arithmetic entropy encoding and decoding. |
||||
Added files jaricom.c, jcarith.c, jdarith.c. |
||||
|
||||
Straighten the file structure: |
||||
Removed files jidctred.c, jcphuff.c, jchuff.h, jdphuff.c, jdhuff.h. |
||||
|
||||
jpegtran has a new "lossless" cropping feature. |
||||
|
||||
Implement -perfect option in jpegtran, new API function |
||||
jtransform_perfect_transform() in transupp. (DP 204_perfect.dpatch) |
||||
|
||||
Better error messages for jpegtran fopen failure. |
||||
(DP 203_jpegtran_errmsg.dpatch) |
||||
|
||||
Fix byte order issue with 16bit PPM/PGM files in rdppm.c/wrppm.c: |
||||
according to Netpbm, the de facto standard implementation of the PNM formats, |
||||
the most significant byte is first. (DP 203_rdppm.dpatch) |
||||
|
||||
Add -raw option to rdjpgcom not to mangle the output. |
||||
(DP 205_rdjpgcom_raw.dpatch) |
||||
|
||||
Make rdjpgcom locale aware. (DP 201_rdjpgcom_locale.dpatch) |
||||
|
||||
Add extern "C" to jpeglib.h. |
||||
This avoids the need to put extern "C" { ... } around #include "jpeglib.h" |
||||
in your C++ application. Defining the symbol DONT_USE_EXTERN_C in the |
||||
configuration prevents this. (DP 202_jpeglib.h_c++.dpatch) |
||||
|
||||
|
||||
Version 6b 27-Mar-1998 |
||||
----------------------- |
||||
|
||||
jpegtran has new features for lossless image transformations (rotation |
||||
and flipping) as well as "lossless" reduction to grayscale. |
||||
|
||||
jpegtran now copies comments by default; it has a -copy switch to enable |
||||
copying all APPn blocks as well, or to suppress comments. (Formerly it |
||||
always suppressed comments and APPn blocks.) jpegtran now also preserves |
||||
JFIF version and resolution information. |
||||
|
||||
New decompressor library feature: COM and APPn markers found in the input |
||||
file can be saved in memory for later use by the application. (Before, |
||||
you had to code this up yourself with a custom marker processor.) |
||||
|
||||
There is an unused field "void * client_data" now in compress and decompress |
||||
parameter structs; this may be useful in some applications. |
||||
|
||||
JFIF version number information is now saved by the decoder and accepted by |
||||
the encoder. jpegtran uses this to copy the source file's version number, |
||||
to ensure "jpegtran -copy all" won't create bogus files that contain JFXX |
||||
extensions but claim to be version 1.01. Applications that generate their |
||||
own JFXX extension markers also (finally) have a supported way to cause the |
||||
encoder to emit JFIF version number 1.02. |
||||
|
||||
djpeg's trace mode reports JFIF 1.02 thumbnail images as such, rather |
||||
than as unknown APP0 markers. |
||||
|
||||
In -verbose mode, djpeg and rdjpgcom will try to print the contents of |
||||
APP12 markers as text. Some digital cameras store useful text information |
||||
in APP12 markers. |
||||
|
||||
Handling of truncated data streams is more robust: blocks beyond the one in |
||||
which the error occurs will be output as uniform gray, or left unchanged |
||||
if decoding a progressive JPEG. The appearance no longer depends on the |
||||
Huffman tables being used. |
||||
|
||||
Huffman tables are checked for validity much more carefully than before. |
||||
|
||||
To avoid the Unisys LZW patent, djpeg's GIF output capability has been |
||||
changed to produce "uncompressed GIFs", and cjpeg's GIF input capability |
||||
has been removed altogether. We're not happy about it either, but there |
||||
seems to be no good alternative. |
||||
|
||||
The configure script now supports building libjpeg as a shared library |
||||
on many flavors of Unix (all the ones that GNU libtool knows how to |
||||
build shared libraries for). Use "./configure --enable-shared" to |
||||
try this out. |
||||
|
||||
New jconfig file and makefiles for Microsoft Visual C++ and Developer Studio. |
||||
Also, a jconfig file and a build script for Metrowerks CodeWarrior |
||||
on Apple Macintosh. makefile.dj has been updated for DJGPP v2, and there |
||||
are miscellaneous other minor improvements in the makefiles. |
||||
|
||||
jmemmac.c now knows how to create temporary files following Mac System 7 |
||||
conventions. |
||||
|
||||
djpeg's -map switch is now able to read raw-format PPM files reliably. |
||||
|
||||
cjpeg -progressive -restart no longer generates any unnecessary DRI markers. |
||||
|
||||
Multiple calls to jpeg_simple_progression for a single JPEG object |
||||
no longer leak memory. |
||||
|
||||
|
||||
Version 6a 7-Feb-96 |
||||
-------------------- |
||||
|
||||
Library initialization sequence modified to detect version mismatches |
||||
and struct field packing mismatches between library and calling application. |
||||
This change requires applications to be recompiled, but does not require |
||||
any application source code change. |
||||
|
||||
All routine declarations changed to the style "GLOBAL(type) name ...", |
||||
that is, GLOBAL, LOCAL, METHODDEF, EXTERN are now macros taking the |
||||
routine's return type as an argument. This makes it possible to add |
||||
Microsoft-style linkage keywords to all the routines by changing just |
||||
these macros. Note that any application code that was using these macros |
||||
will have to be changed. |
||||
|
||||
DCT coefficient quantization tables are now stored in normal array order |
||||
rather than zigzag order. Application code that calls jpeg_add_quant_table, |
||||
or otherwise manipulates quantization tables directly, will need to be |
||||
changed. If you need to make such code work with either older or newer |
||||
versions of the library, a test like "#if JPEG_LIB_VERSION >= 61" is |
||||
recommended. |
||||
|
||||
djpeg's trace capability now dumps DQT tables in natural order, not zigzag |
||||
order. This allows the trace output to be made into a "-qtables" file |
||||
more easily. |
||||
|
||||
New system-dependent memory manager module for use on Apple Macintosh. |
||||
|
||||
Fix bug in cjpeg's -smooth option: last one or two scanlines would be |
||||
duplicates of the prior line unless the image height mod 16 was 1 or 2. |
||||
|
||||
Repair minor problems in VMS, BCC, MC6 makefiles. |
||||
|
||||
New configure script based on latest GNU Autoconf. |
||||
|
||||
Correct the list of include files needed by MetroWerks C for ccommand(). |
||||
|
||||
Numerous small documentation updates. |
||||
|
||||
|
||||
Version 6 2-Aug-95 |
||||
------------------- |
||||
|
||||
Progressive JPEG support: library can read and write full progressive JPEG |
||||
files. A "buffered image" mode supports incremental decoding for on-the-fly |
||||
display of progressive images. Simply recompiling an existing IJG-v5-based |
||||
decoder with v6 should allow it to read progressive files, though of course |
||||
without any special progressive display. |
||||
|
||||
New "jpegtran" application performs lossless transcoding between different |
||||
JPEG formats; primarily, it can be used to convert baseline to progressive |
||||
JPEG and vice versa. In support of jpegtran, the library now allows lossless |
||||
reading and writing of JPEG files as DCT coefficient arrays. This ability |
||||
may be of use in other applications. |
||||
|
||||
Notes for programmers: |
||||
* We changed jpeg_start_decompress() to be able to suspend; this makes all |
||||
decoding modes available to suspending-input applications. However, |
||||
existing applications that use suspending input will need to be changed |
||||
to check the return value from jpeg_start_decompress(). You don't need to |
||||
do anything if you don't use a suspending data source. |
||||
* We changed the interface to the virtual array routines: access_virt_array |
||||
routines now take a count of the number of rows to access this time. The |
||||
last parameter to request_virt_array routines is now interpreted as the |
||||
maximum number of rows that may be accessed at once, but not necessarily |
||||
the height of every access. |
||||
|
||||
|
||||
Version 5b 15-Mar-95 |
||||
--------------------- |
||||
|
||||
Correct bugs with grayscale images having v_samp_factor > 1. |
||||
|
||||
jpeg_write_raw_data() now supports output suspension. |
||||
|
||||
Correct bugs in "configure" script for case of compiling in |
||||
a directory other than the one containing the source files. |
||||
|
||||
Repair bug in jquant1.c: sometimes didn't use as many colors as it could. |
||||
|
||||
Borland C makefile and jconfig file work under either MS-DOS or OS/2. |
||||
|
||||
Miscellaneous improvements to documentation. |
||||
|
||||
|
||||
Version 5a 7-Dec-94 |
||||
-------------------- |
||||
|
||||
Changed color conversion roundoff behavior so that grayscale values are |
||||
represented exactly. (This causes test image files to change.) |
||||
|
||||
Make ordered dither use 16x16 instead of 4x4 pattern for a small quality |
||||
improvement. |
||||
|
||||
New configure script based on latest GNU Autoconf. |
||||
Fix configure script to handle CFLAGS correctly. |
||||
Rename *.auto files to *.cfg, so that configure script still works if |
||||
file names have been truncated for DOS. |
||||
|
||||
Fix bug in rdbmp.c: didn't allow for extra data between header and image. |
||||
|
||||
Modify rdppm.c/wrppm.c to handle 2-byte raw PPM/PGM formats for 12-bit data. |
||||
|
||||
Fix several bugs in rdrle.c. |
||||
|
||||
NEED_SHORT_EXTERNAL_NAMES option was broken. |
||||
|
||||
Revise jerror.h/jerror.c for more flexibility in message table. |
||||
|
||||
Repair oversight in jmemname.c NO_MKTEMP case: file could be there |
||||
but unreadable. |
||||
|
||||
|
||||
Version 5 24-Sep-94 |
||||
-------------------- |
||||
|
||||
Version 5 represents a nearly complete redesign and rewrite of the IJG |
||||
software. Major user-visible changes include: |
||||
* Automatic configuration simplifies installation for most Unix systems. |
||||
* A range of speed vs. image quality tradeoffs are supported. |
||||
This includes resizing of an image during decompression: scaling down |
||||
by a factor of 1/2, 1/4, or 1/8 is handled very efficiently. |
||||
* New programs rdjpgcom and wrjpgcom allow insertion and extraction |
||||
of text comments in a JPEG file. |
||||
|
||||
The application programmer's interface to the library has changed completely. |
||||
Notable improvements include: |
||||
* We have eliminated the use of callback routines for handling the |
||||
uncompressed image data. The application now sees the library as a |
||||
set of routines that it calls to read or write image data on a |
||||
scanline-by-scanline basis. |
||||
* The application image data is represented in a conventional interleaved- |
||||
pixel format, rather than as a separate array for each color channel. |
||||
This can save a copying step in many programs. |
||||
* The handling of compressed data has been cleaned up: the application can |
||||
supply routines to source or sink the compressed data. It is possible to |
||||
suspend processing on source/sink buffer overrun, although this is not |
||||
supported in all operating modes. |
||||
* All static state has been eliminated from the library, so that multiple |
||||
instances of compression or decompression can be active concurrently. |
||||
* JPEG abbreviated datastream formats are supported, ie, quantization and |
||||
Huffman tables can be stored separately from the image data. |
||||
* And not only that, but the documentation of the library has improved |
||||
considerably! |
||||
|
||||
|
||||
The last widely used release before the version 5 rewrite was version 4A of |
||||
18-Feb-93. Change logs before that point have been discarded, since they |
||||
are not of much interest after the rewrite. |
@ -1,339 +0,0 @@
|
||||
.TH CJPEG 1 "14 November 2010" |
||||
.SH NAME |
||||
cjpeg \- compress an image file to a JPEG file |
||||
.SH SYNOPSIS |
||||
.B cjpeg |
||||
[ |
||||
.I options |
||||
] |
||||
[ |
||||
.I filename |
||||
] |
||||
.LP |
||||
.SH DESCRIPTION |
||||
.LP |
||||
.B cjpeg |
||||
compresses the named image file, or the standard input if no file is |
||||
named, and produces a JPEG/JFIF file on the standard output. |
||||
The currently supported input file formats are: PPM (PBMPLUS color |
||||
format), PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster |
||||
Toolkit format). (RLE is supported only if the URT library is available.) |
||||
.SH OPTIONS |
||||
All switch names may be abbreviated; for example, |
||||
.B \-grayscale |
||||
may be written |
||||
.B \-gray |
||||
or |
||||
.BR \-gr . |
||||
Most of the "basic" switches can be abbreviated to as little as one letter. |
||||
Upper and lower case are equivalent (thus |
||||
.B \-BMP |
||||
is the same as |
||||
.BR \-bmp ). |
||||
British spellings are also accepted (e.g., |
||||
.BR \-greyscale ), |
||||
though for brevity these are not mentioned below. |
||||
.PP |
||||
The basic switches are: |
||||
.TP |
||||
.BI \-quality " N[,...]" |
||||
Scale quantization tables to adjust image quality. Quality is 0 (worst) to |
||||
100 (best); default is 75. (See below for more info.) |
||||
.TP |
||||
.B \-grayscale |
||||
Create monochrome JPEG file from color input. Be sure to use this switch when |
||||
compressing a grayscale BMP file, because |
||||
.B cjpeg |
||||
isn't bright enough to notice whether a BMP file uses only shades of gray. |
||||
By saying |
||||
.BR \-grayscale , |
||||
you'll get a smaller JPEG file that takes less time to process. |
||||
.TP |
||||
.B \-optimize |
||||
Perform optimization of entropy encoding parameters. Without this, default |
||||
encoding parameters are used. |
||||
.B \-optimize |
||||
usually makes the JPEG file a little smaller, but |
||||
.B cjpeg |
||||
runs somewhat slower and needs much more memory. Image quality and speed of |
||||
decompression are unaffected by |
||||
.BR \-optimize . |
||||
.TP |
||||
.B \-progressive |
||||
Create progressive JPEG file (see below). |
||||
.TP |
||||
.BI \-scale " M/N" |
||||
Scale the output image by a factor M/N. Currently supported scale factors are |
||||
M/N with all N from 1 to 16, where M is the destination DCT size, which is 8 |
||||
by default (see |
||||
.BI \-block " N" |
||||
switch below). |
||||
.TP |
||||
.B \-targa |
||||
Input file is Targa format. Targa files that contain an "identification" |
||||
field will not be automatically recognized by |
||||
.BR cjpeg ; |
||||
for such files you must specify |
||||
.B \-targa |
||||
to make |
||||
.B cjpeg |
||||
treat the input as Targa format. |
||||
For most Targa files, you won't need this switch. |
||||
.PP |
||||
The |
||||
.B \-quality |
||||
switch lets you trade off compressed file size against quality of the |
||||
reconstructed image: the higher the quality setting, the larger the JPEG file, |
||||
and the closer the output image will be to the original input. Normally you |
||||
want to use the lowest quality setting (smallest file) that decompresses into |
||||
something visually indistinguishable from the original image. For this |
||||
purpose the quality setting should be between 50 and 95; the default of 75 is |
||||
often about right. If you see defects at |
||||
.B \-quality |
||||
75, then go up 5 or 10 counts at a time until you are happy with the output |
||||
image. (The optimal setting will vary from one image to another.) |
||||
.PP |
||||
.B \-quality |
||||
100 will generate a quantization table of all 1's, minimizing loss in the |
||||
quantization step (but there is still information loss in subsampling, as well |
||||
as roundoff error). This setting is mainly of interest for experimental |
||||
purposes. Quality values above about 95 are |
||||
.B not |
||||
recommended for normal use; the compressed file size goes up dramatically for |
||||
hardly any gain in output image quality. |
||||
.PP |
||||
In the other direction, quality values below 50 will produce very small files |
||||
of low image quality. Settings around 5 to 10 might be useful in preparing an |
||||
index of a large image library, for example. Try |
||||
.B \-quality |
||||
2 (or so) for some amusing Cubist effects. (Note: quality |
||||
values below about 25 generate 2-byte quantization tables, which are |
||||
considered optional in the JPEG standard. |
||||
.B cjpeg |
||||
emits a warning message when you give such a quality value, because some |
||||
other JPEG programs may be unable to decode the resulting file. Use |
||||
.B \-baseline |
||||
if you need to ensure compatibility at low quality values.) |
||||
.PP |
||||
The |
||||
.B \-quality |
||||
option has been extended in IJG version 7 for support of separate quality |
||||
settings for luminance and chrominance (or in general, for every provided |
||||
quantization table slot). This feature is useful for high-quality |
||||
applications which cannot accept the damage of color data by coarse |
||||
subsampling settings. You can now easily reduce the color data amount more |
||||
smoothly with finer control without separate subsampling. The resulting file |
||||
is fully compliant with standard JPEG decoders. |
||||
Note that the |
||||
.B \-quality |
||||
ratings refer to the quantization table slots, and that the last value is |
||||
replicated if there are more q-table slots than parameters. The default |
||||
q-table slots are 0 for luminance and 1 for chrominance with default tables as |
||||
given in the JPEG standard. This is compatible with the old behaviour in case |
||||
that only one parameter is given, which is then used for both luminance and |
||||
chrominance (slots 0 and 1). More or custom quantization tables can be set |
||||
with |
||||
.B \-qtables |
||||
and assigned to components with |
||||
.B \-qslots |
||||
parameter (see the "wizard" switches below). |
||||
.B Caution: |
||||
You must explicitly add |
||||
.BI \-sample " 1x1" |
||||
for efficient separate color |
||||
quality selection, since the default value used by library is 2x2! |
||||
.PP |
||||
The |
||||
.B \-progressive |
||||
switch creates a "progressive JPEG" file. In this type of JPEG file, the data |
||||
is stored in multiple scans of increasing quality. If the file is being |
||||
transmitted over a slow communications link, the decoder can use the first |
||||
scan to display a low-quality image very quickly, and can then improve the |
||||
display with each subsequent scan. The final image is exactly equivalent to a |
||||
standard JPEG file of the same quality setting, and the total file size is |
||||
about the same --- often a little smaller. |
||||
.PP |
||||
Switches for advanced users: |
||||
.TP |
||||
.BI \-block " N" |
||||
Set DCT block size. All N from 1 to 16 are possible. |
||||
Default is 8 (baseline format). |
||||
Larger values produce higher compression, |
||||
smaller values produce higher quality |
||||
(exact DCT stage possible with 1 or 2; with the default quality of 75 and |
||||
default Luminance qtable the DCT+Quantization stage is lossless for N=1). |
||||
CAUTION: An implementation of the JPEG SmartScale extension is required for |
||||
this feature. SmartScale enabled JPEG is not yet widely implemented, so |
||||
many decoders will be unable to view a SmartScale extended JPEG file at all. |
||||
.TP |
||||
.B \-dct int |
||||
Use integer DCT method (default). |
||||
.TP |
||||
.B \-dct fast |
||||
Use fast integer DCT (less accurate). |
||||
.TP |
||||
.B \-dct float |
||||
Use floating-point DCT method. |
||||
The float method is very slightly more accurate than the int method, but is |
||||
much slower unless your machine has very fast floating-point hardware. Also |
||||
note that results of the floating-point method may vary slightly across |
||||
machines, while the integer methods should give the same results everywhere. |
||||
The fast integer method is much less accurate than the other two. |
||||
.TP |
||||
.B \-nosmooth |
||||
Don't use high-quality downsampling. |
||||
.TP |
||||
.BI \-restart " N" |
||||
Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is |
||||
attached to the number. |
||||
.B \-restart 0 |
||||
(the default) means no restart markers. |
||||
.TP |
||||
.BI \-smooth " N" |
||||
Smooth the input image to eliminate dithering noise. N, ranging from 1 to |
||||
100, indicates the strength of smoothing. 0 (the default) means no smoothing. |
||||
.TP |
||||
.BI \-maxmemory " N" |
||||
Set limit for amount of memory to use in processing large images. Value is |
||||
in thousands of bytes, or millions of bytes if "M" is attached to the |
||||
number. For example, |
||||
.B \-max 4m |
||||
selects 4000000 bytes. If more space is needed, temporary files will be used. |
||||
.TP |
||||
.BI \-outfile " name" |
||||
Send output image to the named file, not to standard output. |
||||
.TP |
||||
.B \-verbose |
||||
Enable debug printout. More |
||||
.BR \-v 's |
||||
give more output. Also, version information is printed at startup. |
||||
.TP |
||||
.B \-debug |
||||
Same as |
||||
.BR \-verbose . |
||||
.PP |
||||
The |
||||
.B \-restart |
||||
option inserts extra markers that allow a JPEG decoder to resynchronize after |
||||
a transmission error. Without restart markers, any damage to a compressed |
||||
file will usually ruin the image from the point of the error to the end of the |
||||
image; with restart markers, the damage is usually confined to the portion of |
||||
the image up to the next restart marker. Of course, the restart markers |
||||
occupy extra space. We recommend |
||||
.B \-restart 1 |
||||
for images that will be transmitted across unreliable networks such as Usenet. |
||||
.PP |
||||
The |
||||
.B \-smooth |
||||
option filters the input to eliminate fine-scale noise. This is often useful |
||||
when converting dithered images to JPEG: a moderate smoothing factor of 10 to |
||||
50 gets rid of dithering patterns in the input file, resulting in a smaller |
||||
JPEG file and a better-looking image. Too large a smoothing factor will |
||||
visibly blur the image, however. |
||||
.PP |
||||
Switches for wizards: |
||||
.TP |
||||
.B \-arithmetic |
||||
Use arithmetic coding. |
||||
.B Caution: |
||||
arithmetic coded JPEG is not yet widely implemented, so many decoders will be |
||||
unable to view an arithmetic coded JPEG file at all. |
||||
.TP |
||||
.B \-baseline |
||||
Force baseline-compatible quantization tables to be generated. This clamps |
||||
quantization values to 8 bits even at low quality settings. (This switch is |
||||
poorly named, since it does not ensure that the output is actually baseline |
||||
JPEG. For example, you can use |
||||
.B \-baseline |
||||
and |
||||
.B \-progressive |
||||
together.) |
||||
.TP |
||||
.BI \-qtables " file" |
||||
Use the quantization tables given in the specified text file. |
||||
.TP |
||||
.BI \-qslots " N[,...]" |
||||
Select which quantization table to use for each color component. |
||||
.TP |
||||
.BI \-sample " HxV[,...]" |
||||
Set JPEG sampling factors for each color component. |
||||
.TP |
||||
.BI \-scans " file" |
||||
Use the scan script given in the specified text file. |
||||
.PP |
||||
The "wizard" switches are intended for experimentation with JPEG. If you |
||||
don't know what you are doing, \fBdon't use them\fR. These switches are |
||||
documented further in the file wizard.txt. |
||||
.SH EXAMPLES |
||||
.LP |
||||
This example compresses the PPM file foo.ppm with a quality factor of |
||||
60 and saves the output as foo.jpg: |
||||
.IP |
||||
.B cjpeg \-quality |
||||
.I 60 foo.ppm |
||||
.B > |
||||
.I foo.jpg |
||||
.SH HINTS |
||||
Color GIF files are not the ideal input for JPEG; JPEG is really intended for |
||||
compressing full-color (24-bit) images. In particular, don't try to convert |
||||
cartoons, line drawings, and other images that have only a few distinct |
||||
colors. GIF works great on these, JPEG does not. If you want to convert a |
||||
GIF to JPEG, you should experiment with |
||||
.BR cjpeg 's |
||||
.B \-quality |
||||
and |
||||
.B \-smooth |
||||
options to get a satisfactory conversion. |
||||
.B \-smooth 10 |
||||
or so is often helpful. |
||||
.PP |
||||
Avoid running an image through a series of JPEG compression/decompression |
||||
cycles. Image quality loss will accumulate; after ten or so cycles the image |
||||
may be noticeably worse than it was after one cycle. It's best to use a |
||||
lossless format while manipulating an image, then convert to JPEG format when |
||||
you are ready to file the image away. |
||||
.PP |
||||
The |
||||
.B \-optimize |
||||
option to |
||||
.B cjpeg |
||||
is worth using when you are making a "final" version for posting or archiving. |
||||
It's also a win when you are using low quality settings to make very small |
||||
JPEG files; the percentage improvement is often a lot more than it is on |
||||
larger files. (At present, |
||||
.B \-optimize |
||||
mode is always selected when generating progressive JPEG files.) |
||||
.SH ENVIRONMENT |
||||
.TP |
||||
.B JPEGMEM |
||||
If this environment variable is set, its value is the default memory limit. |
||||
The value is specified as described for the |
||||
.B \-maxmemory |
||||
switch. |
||||
.B JPEGMEM |
||||
overrides the default value specified when the program was compiled, and |
||||
itself is overridden by an explicit |
||||
.BR \-maxmemory . |
||||
.SH SEE ALSO |
||||
.BR djpeg (1), |
||||
.BR jpegtran (1), |
||||
.BR rdjpgcom (1), |
||||
.BR wrjpgcom (1) |
||||
.br |
||||
.BR ppm (5), |
||||
.BR pgm (5) |
||||
.br |
||||
Wallace, Gregory K. "The JPEG Still Picture Compression Standard", |
||||
Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. |
||||
.SH AUTHOR |
||||
Independent JPEG Group |
||||
.SH BUGS |
||||
GIF input files are no longer supported, to avoid the Unisys LZW patent. |
||||
(Conversion of GIF files to JPEG is usually a bad idea anyway.) |
||||
.PP |
||||
Not all variants of BMP and Targa file formats are supported. |
||||
.PP |
||||
The |
||||
.B \-targa |
||||
switch is not a bug, it's a feature. (It would be a bug if the Targa format |
||||
designers had not been clueless.) |
@ -1,639 +0,0 @@
|
||||
/*
|
||||
* cjpeg.c |
||||
* |
||||
* Copyright (C) 1991-1998, Thomas G. Lane. |
||||
* Modified 2003-2010 by Guido Vollbeding. |
||||
* This file is part of the Independent JPEG Group's software. |
||||
* For conditions of distribution and use, see the accompanying README file. |
||||
* |
||||
* This file contains a command-line user interface for the JPEG compressor. |
||||
* It should work on any system with Unix- or MS-DOS-style command lines. |
||||
* |
||||
* Two different command line styles are permitted, depending on the |
||||
* compile-time switch TWO_FILE_COMMANDLINE: |
||||
* cjpeg [options] inputfile outputfile |
||||
* cjpeg [options] [inputfile] |
||||
* In the second style, output is always to standard output, which you'd |
||||
* normally redirect to a file or pipe to some other program. Input is |
||||
* either from a named file or from standard input (typically redirected). |
||||
* The second style is convenient on Unix but is unhelpful on systems that |
||||
* don't support pipes. Also, you MUST use the first style if your system |
||||
* doesn't do binary I/O to stdin/stdout. |
||||
* To simplify script writing, the "-outfile" switch is provided. The syntax |
||||
* cjpeg [options] -outfile outputfile inputfile |
||||
* works regardless of which command line style is used. |
||||
*/ |
||||
|
||||
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ |
||||
#include "jversion.h" /* for version message */ |
||||
|
||||
#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ |
||||
#ifdef __MWERKS__ |
||||
#include <SIOUX.h> /* Metrowerks needs this */ |
||||
#include <console.h> /* ... and this */ |
||||
#endif |
||||
#ifdef THINK_C |
||||
#include <console.h> /* Think declares it here */ |
||||
#endif |
||||
#endif |
||||
|
||||
|
||||
/* Create the add-on message string table. */ |
||||
|
||||
#define JMESSAGE(code,string) string , |
||||
|
||||
static const char * const cdjpeg_message_table[] = { |
||||
#include "cderror.h" |
||||
NULL |
||||
}; |
||||
|
||||
|
||||
/*
|
||||
* This routine determines what format the input file is, |
||||
* and selects the appropriate input-reading module. |
||||
* |
||||
* To determine which family of input formats the file belongs to, |
||||
* we may look only at the first byte of the file, since C does not |
||||
* guarantee that more than one character can be pushed back with ungetc. |
||||
* Looking at additional bytes would require one of these approaches: |
||||
* 1) assume we can fseek() the input file (fails for piped input); |
||||
* 2) assume we can push back more than one character (works in |
||||
* some C implementations, but unportable); |
||||
* 3) provide our own buffering (breaks input readers that want to use |
||||
* stdio directly, such as the RLE library); |
||||
* or 4) don't put back the data, and modify the input_init methods to assume |
||||
* they start reading after the start of file (also breaks RLE library). |
||||
* #1 is attractive for MS-DOS but is untenable on Unix. |
||||
* |
||||
* The most portable solution for file types that can't be identified by their |
||||
* first byte is to make the user tell us what they are. This is also the |
||||
* only approach for "raw" file types that contain only arbitrary values. |
||||
* We presently apply this method for Targa files. Most of the time Targa |
||||
* files start with 0x00, so we recognize that case. Potentially, however, |
||||
* a Targa file could start with any byte value (byte 0 is the length of the |
||||
* seldom-used ID field), so we provide a switch to force Targa input mode. |
||||
*/ |
||||
|
||||
static boolean is_targa; /* records user -targa switch */ |
||||
|
||||
|
||||
LOCAL(cjpeg_source_ptr) |
||||
select_file_type (j_compress_ptr cinfo, FILE * infile) |
||||
{ |
||||
int c; |
||||
|
||||
if (is_targa) { |
||||
#ifdef TARGA_SUPPORTED |
||||
return jinit_read_targa(cinfo); |
||||
#else |
||||
ERREXIT(cinfo, JERR_TGA_NOTCOMP); |
||||
#endif |
||||
} |
||||
|
||||
if ((c = getc(infile)) == EOF) |
||||
ERREXIT(cinfo, JERR_INPUT_EMPTY); |
||||
if (ungetc(c, infile) == EOF) |
||||
ERREXIT(cinfo, JERR_UNGETC_FAILED); |
||||
|
||||
switch (c) { |
||||
#ifdef BMP_SUPPORTED |
||||
case 'B': |
||||
return jinit_read_bmp(cinfo); |
||||
#endif |
||||
#ifdef GIF_SUPPORTED |
||||
case 'G': |
||||
return jinit_read_gif(cinfo); |
||||
#endif |
||||
#ifdef PPM_SUPPORTED |
||||
case 'P': |
||||
return jinit_read_ppm(cinfo); |
||||
#endif |
||||
#ifdef RLE_SUPPORTED |
||||
case 'R': |
||||
return jinit_read_rle(cinfo); |
||||
#endif |
||||
#ifdef TARGA_SUPPORTED |
||||
case 0x00: |
||||
return jinit_read_targa(cinfo); |
||||
#endif |
||||
default: |
||||
ERREXIT(cinfo, JERR_UNKNOWN_FORMAT); |
||||
break; |
||||
} |
||||
|
||||
return NULL; /* suppress compiler warnings */ |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Argument-parsing code. |
||||
* The switch parser is designed to be useful with DOS-style command line |
||||
* syntax, ie, intermixed switches and file names, where only the switches |
||||
* to the left of a given file name affect processing of that file. |
||||
* The main program in this file doesn't actually use this capability... |
||||
*/ |
||||
|
||||
|
||||
static const char * progname; /* program name for error messages */ |
||||
static char * outfilename; /* for -outfile switch */ |
||||
|
||||
|
||||
LOCAL(void) |
||||
usage (void) |
||||
/* complain about bad command line */ |
||||
{ |
||||
fprintf(stderr, "usage: %s [switches] ", progname); |
||||
#ifdef TWO_FILE_COMMANDLINE |
||||
fprintf(stderr, "inputfile outputfile\n"); |
||||
#else |
||||
fprintf(stderr, "[inputfile]\n"); |
||||
#endif |
||||
|
||||
fprintf(stderr, "Switches (names may be abbreviated):\n"); |
||||
fprintf(stderr, " -quality N[,...] Compression quality (0..100; 5-95 is useful range)\n"); |
||||
fprintf(stderr, " -grayscale Create monochrome JPEG file\n"); |
||||
#ifdef ENTROPY_OPT_SUPPORTED |
||||
fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n"); |
||||
#endif |
||||
#ifdef C_PROGRESSIVE_SUPPORTED |
||||
fprintf(stderr, " -progressive Create progressive JPEG file\n"); |
||||
#endif |
||||
#ifdef DCT_SCALING_SUPPORTED |
||||
fprintf(stderr, " -scale M/N Scale image by fraction M/N, eg, 1/2\n"); |
||||
#endif |
||||
#ifdef TARGA_SUPPORTED |
||||
fprintf(stderr, " -targa Input file is Targa format (usually not needed)\n"); |
||||
#endif |
||||
fprintf(stderr, "Switches for advanced users:\n"); |
||||
#ifdef DCT_SCALING_SUPPORTED |
||||
fprintf(stderr, " -block N DCT block size (1..16; default is 8)\n"); |
||||
#endif |
||||
#ifdef DCT_ISLOW_SUPPORTED |
||||
fprintf(stderr, " -dct int Use integer DCT method%s\n", |
||||
(JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : "")); |
||||
#endif |
||||
#ifdef DCT_IFAST_SUPPORTED |
||||
fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n", |
||||
(JDCT_DEFAULT == JDCT_IFAST ? " (default)" : "")); |
||||
#endif |
||||
#ifdef DCT_FLOAT_SUPPORTED |
||||
fprintf(stderr, " -dct float Use floating-point DCT method%s\n", |
||||
(JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : "")); |
||||
#endif |
||||
fprintf(stderr, " -nosmooth Don't use high-quality downsampling\n"); |
||||
fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n"); |
||||
#ifdef INPUT_SMOOTHING_SUPPORTED |
||||
fprintf(stderr, " -smooth N Smooth dithered input (N=1..100 is strength)\n"); |
||||
#endif |
||||
fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n"); |
||||
fprintf(stderr, " -outfile name Specify name for output file\n"); |
||||
fprintf(stderr, " -verbose or -debug Emit debug output\n"); |
||||
fprintf(stderr, "Switches for wizards:\n"); |
||||
#ifdef C_ARITH_CODING_SUPPORTED |
||||
fprintf(stderr, " -arithmetic Use arithmetic coding\n"); |
||||
#endif |
||||
fprintf(stderr, " -baseline Force baseline quantization tables\n"); |
||||
fprintf(stderr, " -qtables file Use quantization tables given in file\n"); |
||||
fprintf(stderr, " -qslots N[,...] Set component quantization tables\n"); |
||||
fprintf(stderr, " -sample HxV[,...] Set component sampling factors\n"); |
||||
#ifdef C_MULTISCAN_FILES_SUPPORTED |
||||
fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n"); |
||||
#endif |
||||
exit(EXIT_FAILURE); |
||||
} |
||||
|
||||
|
||||
LOCAL(int) |
||||
parse_switches (j_compress_ptr cinfo, int argc, char **argv, |
||||
int last_file_arg_seen, boolean for_real) |
||||
/* Parse optional switches.
|
||||
* Returns argv[] index of first file-name argument (== argc if none). |
||||
* Any file names with indexes <= last_file_arg_seen are ignored; |
||||
* they have presumably been processed in a previous iteration. |
||||
* (Pass 0 for last_file_arg_seen on the first or only iteration.) |
||||
* for_real is FALSE on the first (dummy) pass; we may skip any expensive |
||||
* processing. |
||||
*/ |
||||
{ |
||||
int argn; |
||||
char * arg; |
||||
boolean force_baseline; |
||||
boolean simple_progressive; |
||||
char * qualityarg = NULL; /* saves -quality parm if any */ |
||||
char * qtablefile = NULL; /* saves -qtables filename if any */ |
||||
char * qslotsarg = NULL; /* saves -qslots parm if any */ |
||||
char * samplearg = NULL; /* saves -sample parm if any */ |
||||
char * scansarg = NULL; /* saves -scans parm if any */ |
||||
|
||||
/* Set up default JPEG parameters. */ |
||||
|
||||
force_baseline = FALSE; /* by default, allow 16-bit quantizers */ |
||||
simple_progressive = FALSE; |
||||
is_targa = FALSE; |
||||
outfilename = NULL; |
||||
cinfo->err->trace_level = 0; |
||||
|
||||
/* Scan command line options, adjust parameters */ |
||||
|
||||
for (argn = 1; argn < argc; argn++) { |
||||
arg = argv[argn]; |
||||
if (*arg != '-') { |
||||
/* Not a switch, must be a file name argument */ |
||||
if (argn <= last_file_arg_seen) { |
||||
outfilename = NULL; /* -outfile applies to just one input file */ |
||||
continue; /* ignore this name if previously processed */ |
||||
} |
||||
break; /* else done parsing switches */ |
||||
} |
||||
arg++; /* advance past switch marker character */ |
||||
|
||||
if (keymatch(arg, "arithmetic", 1)) { |
||||
/* Use arithmetic coding. */ |
||||
#ifdef C_ARITH_CODING_SUPPORTED |
||||
cinfo->arith_code = TRUE; |
||||
#else |
||||
fprintf(stderr, "%s: sorry, arithmetic coding not supported\n", |
||||
progname); |
||||
exit(EXIT_FAILURE); |
||||
#endif |
||||
|
||||
} else if (keymatch(arg, "baseline", 2)) { |
||||
/* Force baseline-compatible output (8-bit quantizer values). */ |
||||
force_baseline = TRUE; |
||||
|
||||
} else if (keymatch(arg, "block", 2)) { |
||||
/* Set DCT block size. */ |
||||
#if defined(DCT_SCALING_SUPPORTED) && defined(JPEG_LIB_VERSION_MAJOR) && \ |
||||
(JPEG_LIB_VERSION_MAJOR > 8 || (JPEG_LIB_VERSION_MAJOR == 8 && \
|
||||
defined(JPEG_LIB_VERSION_MINOR) && JPEG_LIB_VERSION_MINOR >= 3)) |
||||
int val; |
||||
|
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (sscanf(argv[argn], "%d", &val) != 1) |
||||
usage(); |
||||
if (val < 1 || val > 16) |
||||
usage(); |
||||
cinfo->block_size = val; |
||||
#else |
||||
fprintf(stderr, "%s: sorry, block size setting not supported\n", |
||||
progname); |
||||
exit(EXIT_FAILURE); |
||||
#endif |
||||
|
||||
} else if (keymatch(arg, "dct", 2)) { |
||||
/* Select DCT algorithm. */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (keymatch(argv[argn], "int", 1)) { |
||||
cinfo->dct_method = JDCT_ISLOW; |
||||
} else if (keymatch(argv[argn], "fast", 2)) { |
||||
cinfo->dct_method = JDCT_IFAST; |
||||
} else if (keymatch(argv[argn], "float", 2)) { |
||||
cinfo->dct_method = JDCT_FLOAT; |
||||
} else |
||||
usage(); |
||||
|
||||
} else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { |
||||
/* Enable debug printouts. */ |
||||
/* On first -d, print version identification */ |
||||
static boolean printed_version = FALSE; |
||||
|
||||
if (! printed_version) { |
||||
fprintf(stderr, "Independent JPEG Group's CJPEG, version %s\n%s\n", |
||||
JVERSION, JCOPYRIGHT); |
||||
printed_version = TRUE; |
||||
} |
||||
cinfo->err->trace_level++; |
||||
|
||||
} else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) { |
||||
/* Force a monochrome JPEG file to be generated. */ |
||||
jpeg_set_colorspace(cinfo, JCS_GRAYSCALE); |
||||
|
||||
} else if (keymatch(arg, "maxmemory", 3)) { |
||||
/* Maximum memory in Kb (or Mb with 'm'). */ |
||||
long lval; |
||||
char ch = 'x'; |
||||
|
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) |
||||
usage(); |
||||
if (ch == 'm' || ch == 'M') |
||||
lval *= 1000L; |
||||
cinfo->mem->max_memory_to_use = lval * 1000L; |
||||
|
||||
} else if (keymatch(arg, "nosmooth", 3)) { |
||||
/* Suppress fancy downsampling */ |
||||
cinfo->do_fancy_downsampling = FALSE; |
||||
|
||||
} else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) { |
||||
/* Enable entropy parm optimization. */ |
||||
#ifdef ENTROPY_OPT_SUPPORTED |
||||
cinfo->optimize_coding = TRUE; |
||||
#else |
||||
fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n", |
||||
progname); |
||||
exit(EXIT_FAILURE); |
||||
#endif |
||||
|
||||
} else if (keymatch(arg, "outfile", 4)) { |
||||
/* Set output file name. */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
outfilename = argv[argn]; /* save it away for later use */ |
||||
|
||||
} else if (keymatch(arg, "progressive", 1)) { |
||||
/* Select simple progressive mode. */ |
||||
#ifdef C_PROGRESSIVE_SUPPORTED |
||||
simple_progressive = TRUE; |
||||
/* We must postpone execution until num_components is known. */ |
||||
#else |
||||
fprintf(stderr, "%s: sorry, progressive output was not compiled\n", |
||||
progname); |
||||
exit(EXIT_FAILURE); |
||||
#endif |
||||
|
||||
} else if (keymatch(arg, "quality", 1)) { |
||||
/* Quality ratings (quantization table scaling factors). */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
qualityarg = argv[argn]; |
||||
|
||||
} else if (keymatch(arg, "qslots", 2)) { |
||||
/* Quantization table slot numbers. */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
qslotsarg = argv[argn]; |
||||
/* Must delay setting qslots until after we have processed any
|
||||
* colorspace-determining switches, since jpeg_set_colorspace sets |
||||
* default quant table numbers. |
||||
*/ |
||||
|
||||
} else if (keymatch(arg, "qtables", 2)) { |
||||
/* Quantization tables fetched from file. */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
qtablefile = argv[argn]; |
||||
/* We postpone actually reading the file in case -quality comes later. */ |
||||
|
||||
} else if (keymatch(arg, "restart", 1)) { |
||||
/* Restart interval in MCU rows (or in MCUs with 'b'). */ |
||||
long lval; |
||||
char ch = 'x'; |
||||
|
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) |
||||
usage(); |
||||
if (lval < 0 || lval > 65535L) |
||||
usage(); |
||||
if (ch == 'b' || ch == 'B') { |
||||
cinfo->restart_interval = (unsigned int) lval; |
||||
cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */ |
||||
} else { |
||||
cinfo->restart_in_rows = (int) lval; |
||||
/* restart_interval will be computed during startup */ |
||||
} |
||||
|
||||
} else if (keymatch(arg, "sample", 2)) { |
||||
/* Set sampling factors. */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
samplearg = argv[argn]; |
||||
/* Must delay setting sample factors until after we have processed any
|
||||
* colorspace-determining switches, since jpeg_set_colorspace sets |
||||
* default sampling factors. |
||||
*/ |
||||
|
||||
} else if (keymatch(arg, "scale", 4)) { |
||||
/* Scale the image by a fraction M/N. */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (sscanf(argv[argn], "%d/%d", |
||||
&cinfo->scale_num, &cinfo->scale_denom) != 2) |
||||
usage(); |
||||
|
||||
} else if (keymatch(arg, "scans", 4)) { |
||||
/* Set scan script. */ |
||||
#ifdef C_MULTISCAN_FILES_SUPPORTED |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
scansarg = argv[argn]; |
||||
/* We must postpone reading the file in case -progressive appears. */ |
||||
#else |
||||
fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n", |
||||
progname); |
||||
exit(EXIT_FAILURE); |
||||
#endif |
||||
|
||||
} else if (keymatch(arg, "smooth", 2)) { |
||||
/* Set input smoothing factor. */ |
||||
int val; |
||||
|
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (sscanf(argv[argn], "%d", &val) != 1) |
||||
usage(); |
||||
if (val < 0 || val > 100) |
||||
usage(); |
||||
cinfo->smoothing_factor = val; |
||||
|
||||
} else if (keymatch(arg, "targa", 1)) { |
||||
/* Input file is Targa format. */ |
||||
is_targa = TRUE; |
||||
|
||||
} else { |
||||
usage(); /* bogus switch */ |
||||
} |
||||
} |
||||
|
||||
/* Post-switch-scanning cleanup */ |
||||
|
||||
if (for_real) { |
||||
|
||||
/* Set quantization tables for selected quality. */ |
||||
/* Some or all may be overridden if -qtables is present. */ |
||||
if (qualityarg != NULL) /* process -quality if it was present */ |
||||
if (! set_quality_ratings(cinfo, qualityarg, force_baseline)) |
||||
usage(); |
||||
|
||||
if (qtablefile != NULL) /* process -qtables if it was present */ |
||||
if (! read_quant_tables(cinfo, qtablefile, force_baseline)) |
||||
usage(); |
||||
|
||||
if (qslotsarg != NULL) /* process -qslots if it was present */ |
||||
if (! set_quant_slots(cinfo, qslotsarg)) |
||||
usage(); |
||||
|
||||
if (samplearg != NULL) /* process -sample if it was present */ |
||||
if (! set_sample_factors(cinfo, samplearg)) |
||||
usage(); |
||||
|
||||
#ifdef C_PROGRESSIVE_SUPPORTED |
||||
if (simple_progressive) /* process -progressive; -scans can override */ |
||||
jpeg_simple_progression(cinfo); |
||||
#endif |
||||
|
||||
#ifdef C_MULTISCAN_FILES_SUPPORTED |
||||
if (scansarg != NULL) /* process -scans if it was present */ |
||||
if (! read_scan_script(cinfo, scansarg)) |
||||
usage(); |
||||
#endif |
||||
} |
||||
|
||||
return argn; /* return index of next arg (file name) */ |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* The main program. |
||||
*/ |
||||
|
||||
int |
||||
main (int argc, char **argv) |
||||
{ |
||||
struct jpeg_compress_struct cinfo; |
||||
struct jpeg_error_mgr jerr; |
||||
#ifdef PROGRESS_REPORT |
||||
struct cdjpeg_progress_mgr progress; |
||||
#endif |
||||
int file_index; |
||||
cjpeg_source_ptr src_mgr; |
||||
FILE * input_file; |
||||
FILE * output_file; |
||||
JDIMENSION num_scanlines; |
||||
|
||||
/* On Mac, fetch a command line. */ |
||||
#ifdef USE_CCOMMAND |
||||
argc = ccommand(&argv); |
||||
#endif |
||||
|
||||
progname = argv[0]; |
||||
if (progname == NULL || progname[0] == 0) |
||||
progname = "cjpeg"; /* in case C library doesn't provide it */ |
||||
|
||||
/* Initialize the JPEG compression object with default error handling. */ |
||||
cinfo.err = jpeg_std_error(&jerr); |
||||
jpeg_create_compress(&cinfo); |
||||
/* Add some application-specific error messages (from cderror.h) */ |
||||
jerr.addon_message_table = cdjpeg_message_table; |
||||
jerr.first_addon_message = JMSG_FIRSTADDONCODE; |
||||
jerr.last_addon_message = JMSG_LASTADDONCODE; |
||||
|
||||
/* Now safe to enable signal catcher. */ |
||||
#ifdef NEED_SIGNAL_CATCHER |
||||
enable_signal_catcher((j_common_ptr) &cinfo); |
||||
#endif |
||||
|
||||
/* Initialize JPEG parameters.
|
||||
* Much of this may be overridden later. |
||||
* In particular, we don't yet know the input file's color space, |
||||
* but we need to provide some value for jpeg_set_defaults() to work. |
||||
*/ |
||||
|
||||
cinfo.in_color_space = JCS_RGB; /* arbitrary guess */ |
||||
jpeg_set_defaults(&cinfo); |
||||
|
||||
/* Scan command line to find file names.
|
||||
* It is convenient to use just one switch-parsing routine, but the switch |
||||
* values read here are ignored; we will rescan the switches after opening |
||||
* the input file. |
||||
*/ |
||||
|
||||
file_index = parse_switches(&cinfo, argc, argv, 0, FALSE); |
||||
|
||||
#ifdef TWO_FILE_COMMANDLINE |
||||
/* Must have either -outfile switch or explicit output file name */ |
||||
if (outfilename == NULL) { |
||||
if (file_index != argc-2) { |
||||
fprintf(stderr, "%s: must name one input and one output file\n", |
||||
progname); |
||||
usage(); |
||||
} |
||||
outfilename = argv[file_index+1]; |
||||
} else { |
||||
if (file_index != argc-1) { |
||||
fprintf(stderr, "%s: must name one input and one output file\n", |
||||
progname); |
||||
usage(); |
||||
} |
||||
} |
||||
#else |
||||
/* Unix style: expect zero or one file name */ |
||||
if (file_index < argc-1) { |
||||
fprintf(stderr, "%s: only one input file\n", progname); |
||||
usage(); |
||||
} |
||||
#endif /* TWO_FILE_COMMANDLINE */ |
||||
|
||||
/* Open the input file. */ |
||||
if (file_index < argc) { |
||||
if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) { |
||||
fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]); |
||||
exit(EXIT_FAILURE); |
||||
} |
||||
} else { |
||||
/* default input file is stdin */ |
||||
input_file = read_stdin(); |
||||
} |
||||
|
||||
/* Open the output file. */ |
||||
if (outfilename != NULL) { |
||||
if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) { |
||||
fprintf(stderr, "%s: can't open %s\n", progname, outfilename); |
||||
exit(EXIT_FAILURE); |
||||
} |
||||
} else { |
||||
/* default output file is stdout */ |
||||
output_file = write_stdout(); |
||||
} |
||||
|
||||
#ifdef PROGRESS_REPORT |
||||
start_progress_monitor((j_common_ptr) &cinfo, &progress); |
||||
#endif |
||||
|
||||
/* Figure out the input file format, and set up to read it. */ |
||||
src_mgr = select_file_type(&cinfo, input_file); |
||||
src_mgr->input_file = input_file; |
||||
|
||||
/* Read the input file header to obtain file size & colorspace. */ |
||||
(*src_mgr->start_input) (&cinfo, src_mgr); |
||||
|
||||
/* Now that we know input colorspace, fix colorspace-dependent defaults */ |
||||
jpeg_default_colorspace(&cinfo); |
||||
|
||||
/* Adjust default compression parameters by re-parsing the options */ |
||||
file_index = parse_switches(&cinfo, argc, argv, 0, TRUE); |
||||
|
||||
/* Specify data destination for compression */ |
||||
jpeg_stdio_dest(&cinfo, output_file); |
||||
|
||||
/* Start compressor */ |
||||
jpeg_start_compress(&cinfo, TRUE); |
||||
|
||||
/* Process data */ |
||||
while (cinfo.next_scanline < cinfo.image_height) { |
||||
num_scanlines = (*src_mgr->get_pixel_rows) (&cinfo, src_mgr); |
||||
(void) jpeg_write_scanlines(&cinfo, src_mgr->buffer, num_scanlines); |
||||
} |
||||
|
||||
/* Finish compression and release memory */ |
||||
(*src_mgr->finish_input) (&cinfo, src_mgr); |
||||
jpeg_finish_compress(&cinfo); |
||||
jpeg_destroy_compress(&cinfo); |
||||
|
||||
/* Close files, if we opened them */ |
||||
if (input_file != stdin) |
||||
fclose(input_file); |
||||
if (output_file != stdout) |
||||
fclose(output_file); |
||||
|
||||
#ifdef PROGRESS_REPORT |
||||
end_progress_monitor((j_common_ptr) &cinfo); |
||||
#endif |
||||
|
||||
/* All done. */ |
||||
exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS); |
||||
return 0; /* suppress no-return-value warnings */ |
||||
} |
@ -1,402 +0,0 @@
|
||||
/*
|
||||
* ckconfig.c |
||||
* |
||||
* Copyright (C) 1991-1994, Thomas G. Lane. |
||||
* This file is part of the Independent JPEG Group's software. |
||||
* For conditions of distribution and use, see the accompanying README file. |
||||
*/ |
||||
|
||||
/*
|
||||
* This program is intended to help you determine how to configure the JPEG |
||||
* software for installation on a particular system. The idea is to try to |
||||
* compile and execute this program. If your compiler fails to compile the |
||||
* program, make changes as indicated in the comments below. Once you can |
||||
* compile the program, run it, and it will produce a "jconfig.h" file for |
||||
* your system. |
||||
* |
||||
* As a general rule, each time you try to compile this program, |
||||
* pay attention only to the *first* error message you get from the compiler. |
||||
* Many C compilers will issue lots of spurious error messages once they |
||||
* have gotten confused. Go to the line indicated in the first error message, |
||||
* and read the comments preceding that line to see what to change. |
||||
* |
||||
* Almost all of the edits you may need to make to this program consist of |
||||
* changing a line that reads "#define SOME_SYMBOL" to "#undef SOME_SYMBOL", |
||||
* or vice versa. This is called defining or undefining that symbol. |
||||
*/ |
||||
|
||||
|
||||
/* First we must see if your system has the include files we need.
|
||||
* We start out with the assumption that your system has all the ANSI-standard |
||||
* include files. If you get any error trying to include one of these files, |
||||
* undefine the corresponding HAVE_xxx symbol. |
||||
*/ |
||||
|
||||
#define HAVE_STDDEF_H /* replace 'define' by 'undef' if error here */ |
||||
#ifdef HAVE_STDDEF_H /* next line will be skipped if you undef... */ |
||||
#include <stddef.h> |
||||
#endif |
||||
|
||||
#define HAVE_STDLIB_H /* same thing for stdlib.h */ |
||||
#ifdef HAVE_STDLIB_H |
||||
#include <stdlib.h> |
||||
#endif |
||||
|
||||
#include <stdio.h> /* If you ain't got this, you ain't got C. */ |
||||
|
||||
/* We have to see if your string functions are defined by
|
||||
* strings.h (old BSD convention) or string.h (everybody else). |
||||
* We try the non-BSD convention first; define NEED_BSD_STRINGS |
||||
* if the compiler says it can't find string.h. |
||||
*/ |
||||
|
||||
#undef NEED_BSD_STRINGS |
||||
|
||||
#ifdef NEED_BSD_STRINGS |
||||
#include <strings.h> |
||||
#else |
||||
#include <string.h> |
||||
#endif |
||||
|
||||
/* On some systems (especially older Unix machines), type size_t is
|
||||
* defined only in the include file <sys/types.h>. If you get a failure |
||||
* on the size_t test below, try defining NEED_SYS_TYPES_H. |
||||
*/ |
||||
|
||||
#undef NEED_SYS_TYPES_H /* start by assuming we don't need it */ |
||||
#ifdef NEED_SYS_TYPES_H |
||||
#include <sys/types.h> |
||||
#endif |
||||
|
||||
|
||||
/* Usually type size_t is defined in one of the include files we've included
|
||||
* above. If not, you'll get an error on the "typedef size_t my_size_t;" line. |
||||
* In that case, first try defining NEED_SYS_TYPES_H just above. |
||||
* If that doesn't work, you'll have to search through your system library |
||||
* to figure out which include file defines "size_t". Look for a line that |
||||
* says "typedef something-or-other size_t;". Then, change the line below |
||||
* that says "#include <someincludefile.h>" to instead include the file |
||||
* you found size_t in, and define NEED_SPECIAL_INCLUDE. If you can't find |
||||
* type size_t anywhere, try replacing "#include <someincludefile.h>" with |
||||
* "typedef unsigned int size_t;". |
||||
*/ |
||||
|
||||
#undef NEED_SPECIAL_INCLUDE /* assume we DON'T need it, for starters */ |
||||
|
||||
#ifdef NEED_SPECIAL_INCLUDE |
||||
#include <someincludefile.h> |
||||
#endif |
||||
|
||||
typedef size_t my_size_t; /* The payoff: do we have size_t now? */ |
||||
|
||||
|
||||
/* The next question is whether your compiler supports ANSI-style function
|
||||
* prototypes. You need to know this in order to choose between using |
||||
* makefile.ansi and using makefile.unix. |
||||
* The #define line below is set to assume you have ANSI function prototypes. |
||||
* If you get an error in this group of lines, undefine HAVE_PROTOTYPES. |
||||
*/ |
||||
|
||||
#define HAVE_PROTOTYPES |
||||
|
||||
#ifdef HAVE_PROTOTYPES |
||||
int testfunction (int arg1, int * arg2); /* check prototypes */ |
||||
|
||||
struct methods_struct { /* check method-pointer declarations */ |
||||
int (*error_exit) (char *msgtext); |
||||
int (*trace_message) (char *msgtext); |
||||
int (*another_method) (void); |
||||
}; |
||||
|
||||
int testfunction (int arg1, int * arg2) /* check definitions */ |
||||
{ |
||||
return arg2[arg1]; |
||||
} |
||||
|
||||
int test2function (void) /* check void arg list */ |
||||
{ |
||||
return 0; |
||||
} |
||||
#endif |
||||
|
||||
|
||||
/* Now we want to find out if your compiler knows what "unsigned char" means.
|
||||
* If you get an error on the "unsigned char un_char;" line, |
||||
* then undefine HAVE_UNSIGNED_CHAR. |
||||
*/ |
||||
|
||||
#define HAVE_UNSIGNED_CHAR |
||||
|
||||
#ifdef HAVE_UNSIGNED_CHAR |
||||
unsigned char un_char; |
||||
#endif |
||||
|
||||
|
||||
/* Now we want to find out if your compiler knows what "unsigned short" means.
|
||||
* If you get an error on the "unsigned short un_short;" line, |
||||
* then undefine HAVE_UNSIGNED_SHORT. |
||||
*/ |
||||
|
||||
#define HAVE_UNSIGNED_SHORT |
||||
|
||||
#ifdef HAVE_UNSIGNED_SHORT |
||||
unsigned short un_short; |
||||
#endif |
||||
|
||||
|
||||
/* Now we want to find out if your compiler understands type "void".
|
||||
* If you get an error anywhere in here, undefine HAVE_VOID. |
||||
*/ |
||||
|
||||
#define HAVE_VOID |
||||
|
||||
#ifdef HAVE_VOID |
||||
/* Caution: a C++ compiler will insist on complete prototypes */ |
||||
typedef void * void_ptr; /* check void * */ |
||||
#ifdef HAVE_PROTOTYPES /* check ptr to function returning void */ |
||||
typedef void (*void_func) (int a, int b); |
||||
#else |
||||
typedef void (*void_func) (); |
||||
#endif |
||||
|
||||
#ifdef HAVE_PROTOTYPES /* check void function result */ |
||||
void test3function (void_ptr arg1, void_func arg2) |
||||
#else |
||||
void test3function (arg1, arg2) |
||||
void_ptr arg1; |
||||
void_func arg2; |
||||
#endif |
||||
{ |
||||
char * locptr = (char *) arg1; /* check casting to and from void * */ |
||||
arg1 = (void *) locptr; |
||||
(*arg2) (1, 2); /* check call of fcn returning void */ |
||||
} |
||||
#endif |
||||
|
||||
|
||||
/* Now we want to find out if your compiler knows what "const" means.
|
||||
* If you get an error here, undefine HAVE_CONST. |
||||
*/ |
||||
|
||||
#define HAVE_CONST |
||||
|
||||
#ifdef HAVE_CONST |
||||
static const int carray[3] = {1, 2, 3}; |
||||
|
||||
#ifdef HAVE_PROTOTYPES |
||||
int test4function (const int arg1) |
||||
#else |
||||
int test4function (arg1) |
||||
const int arg1; |
||||
#endif |
||||
{ |
||||
return carray[arg1]; |
||||
} |
||||
#endif |
||||
|
||||
|
||||
/* If you get an error or warning about this structure definition,
|
||||
* define INCOMPLETE_TYPES_BROKEN. |
||||
*/ |
||||
|
||||
#undef INCOMPLETE_TYPES_BROKEN |
||||
|
||||
#ifndef INCOMPLETE_TYPES_BROKEN |
||||
typedef struct undefined_structure * undef_struct_ptr; |
||||
#endif |
||||
|
||||
|
||||
/* If you get an error about duplicate names,
|
||||
* define NEED_SHORT_EXTERNAL_NAMES. |
||||
*/ |
||||
|
||||
#undef NEED_SHORT_EXTERNAL_NAMES |
||||
|
||||
#ifndef NEED_SHORT_EXTERNAL_NAMES |
||||
|
||||
int possibly_duplicate_function () |
||||
{ |
||||
return 0; |
||||
} |
||||
|
||||
int possibly_dupli_function () |
||||
{ |
||||
return 1; |
||||
} |
||||
|
||||
#endif |
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* OK, that's it. You should not have to change anything beyond this |
||||
* point in order to compile and execute this program. (You might get |
||||
* some warnings, but you can ignore them.) |
||||
* When you run the program, it will make a couple more tests that it |
||||
* can do automatically, and then it will create jconfig.h and print out |
||||
* any additional suggestions it has. |
||||
************************************************************************ |
||||
*/ |
||||
|
||||
|
||||
#ifdef HAVE_PROTOTYPES |
||||
int is_char_signed (int arg) |
||||
#else |
||||
int is_char_signed (arg) |
||||
int arg; |
||||
#endif |
||||
{ |
||||
if (arg == 189) { /* expected result for unsigned char */ |
||||
return 0; /* type char is unsigned */ |
||||
} |
||||
else if (arg != -67) { /* expected result for signed char */ |
||||
printf("Hmm, it seems 'char' is not eight bits wide on your machine.\n"); |
||||
printf("I fear the JPEG software will not work at all.\n\n"); |
||||
} |
||||
return 1; /* assume char is signed otherwise */ |
||||
} |
||||
|
||||
|
||||
#ifdef HAVE_PROTOTYPES |
||||
int is_shifting_signed (long arg) |
||||
#else |
||||
int is_shifting_signed (arg) |
||||
long arg; |
||||
#endif |
||||
/* See whether right-shift on a long is signed or not. */ |
||||
{ |
||||
long res = arg >> 4; |
||||
|
||||
if (res == -0x7F7E80CL) { /* expected result for signed shift */ |
||||
return 1; /* right shift is signed */ |
||||
} |
||||
/* see if unsigned-shift hack will fix it. */ |
||||
/* we can't just test exact value since it depends on width of long... */ |
||||
res |= (~0L) << (32-4); |
||||
if (res == -0x7F7E80CL) { /* expected result now? */ |
||||
return 0; /* right shift is unsigned */ |
||||
} |
||||
printf("Right shift isn't acting as I expect it to.\n"); |
||||
printf("I fear the JPEG software will not work at all.\n\n"); |
||||
return 0; /* try it with unsigned anyway */ |
||||
} |
||||
|
||||
|
||||
#ifdef HAVE_PROTOTYPES |
||||
int main (int argc, char ** argv) |
||||
#else |
||||
int main (argc, argv) |
||||
int argc; |
||||
char ** argv; |
||||
#endif |
||||
{ |
||||
char signed_char_check = (char) (-67); |
||||
FILE *outfile; |
||||
|
||||
/* Attempt to write jconfig.h */ |
||||
if ((outfile = fopen("jconfig.h", "w")) == NULL) { |
||||
printf("Failed to write jconfig.h\n"); |
||||
return 1; |
||||
} |
||||
|
||||
/* Write out all the info */ |
||||
fprintf(outfile, "/* jconfig.h --- generated by ckconfig.c */\n"); |
||||
fprintf(outfile, "/* see jconfig.txt for explanations */\n\n"); |
||||
#ifdef HAVE_PROTOTYPES |
||||
fprintf(outfile, "#define HAVE_PROTOTYPES\n"); |
||||
#else |
||||
fprintf(outfile, "#undef HAVE_PROTOTYPES\n"); |
||||
#endif |
||||
#ifdef HAVE_UNSIGNED_CHAR |
||||
fprintf(outfile, "#define HAVE_UNSIGNED_CHAR\n"); |
||||
#else |
||||
fprintf(outfile, "#undef HAVE_UNSIGNED_CHAR\n"); |
||||
#endif |
||||
#ifdef HAVE_UNSIGNED_SHORT |
||||
fprintf(outfile, "#define HAVE_UNSIGNED_SHORT\n"); |
||||
#else |
||||
fprintf(outfile, "#undef HAVE_UNSIGNED_SHORT\n"); |
||||
#endif |
||||
#ifdef HAVE_VOID |
||||
fprintf(outfile, "/* #define void char */\n"); |
||||
#else |
||||
fprintf(outfile, "#define void char\n"); |
||||
#endif |
||||
#ifdef HAVE_CONST |
||||
fprintf(outfile, "/* #define const */\n"); |
||||
#else |
||||
fprintf(outfile, "#define const\n"); |
||||
#endif |
||||
if (is_char_signed((int) signed_char_check)) |
||||
fprintf(outfile, "#undef CHAR_IS_UNSIGNED\n"); |
||||
else |
||||
fprintf(outfile, "#define CHAR_IS_UNSIGNED\n"); |
||||
#ifdef HAVE_STDDEF_H |
||||
fprintf(outfile, "#define HAVE_STDDEF_H\n"); |
||||
#else |
||||
fprintf(outfile, "#undef HAVE_STDDEF_H\n"); |
||||
#endif |
||||
#ifdef HAVE_STDLIB_H |
||||
fprintf(outfile, "#define HAVE_STDLIB_H\n"); |
||||
#else |
||||
fprintf(outfile, "#undef HAVE_STDLIB_H\n"); |
||||
#endif |
||||
#ifdef NEED_BSD_STRINGS |
||||
fprintf(outfile, "#define NEED_BSD_STRINGS\n"); |
||||
#else |
||||
fprintf(outfile, "#undef NEED_BSD_STRINGS\n"); |
||||
#endif |
||||
#ifdef NEED_SYS_TYPES_H |
||||
fprintf(outfile, "#define NEED_SYS_TYPES_H\n"); |
||||
#else |
||||
fprintf(outfile, "#undef NEED_SYS_TYPES_H\n"); |
||||
#endif |
||||
fprintf(outfile, "#undef NEED_FAR_POINTERS\n"); |
||||
#ifdef NEED_SHORT_EXTERNAL_NAMES |
||||
fprintf(outfile, "#define NEED_SHORT_EXTERNAL_NAMES\n"); |
||||
#else |
||||
fprintf(outfile, "#undef NEED_SHORT_EXTERNAL_NAMES\n"); |
||||
#endif |
||||
#ifdef INCOMPLETE_TYPES_BROKEN |
||||
fprintf(outfile, "#define INCOMPLETE_TYPES_BROKEN\n"); |
||||
#else |
||||
fprintf(outfile, "#undef INCOMPLETE_TYPES_BROKEN\n"); |
||||
#endif |
||||
fprintf(outfile, "\n#ifdef JPEG_INTERNALS\n\n"); |
||||
if (is_shifting_signed(-0x7F7E80B1L)) |
||||
fprintf(outfile, "#undef RIGHT_SHIFT_IS_UNSIGNED\n"); |
||||
else |
||||
fprintf(outfile, "#define RIGHT_SHIFT_IS_UNSIGNED\n"); |
||||
fprintf(outfile, "\n#endif /* JPEG_INTERNALS */\n"); |
||||
fprintf(outfile, "\n#ifdef JPEG_CJPEG_DJPEG\n\n"); |
||||
fprintf(outfile, "#define BMP_SUPPORTED /* BMP image file format */\n"); |
||||
fprintf(outfile, "#define GIF_SUPPORTED /* GIF image file format */\n"); |
||||
fprintf(outfile, "#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */\n"); |
||||
fprintf(outfile, "#undef RLE_SUPPORTED /* Utah RLE image file format */\n"); |
||||
fprintf(outfile, "#define TARGA_SUPPORTED /* Targa image file format */\n\n"); |
||||
fprintf(outfile, "#undef TWO_FILE_COMMANDLINE /* You may need this on non-Unix systems */\n"); |
||||
fprintf(outfile, "#undef NEED_SIGNAL_CATCHER /* Define this if you use jmemname.c */\n"); |
||||
fprintf(outfile, "#undef DONT_USE_B_MODE\n"); |
||||
fprintf(outfile, "/* #define PROGRESS_REPORT */ /* optional */\n"); |
||||
fprintf(outfile, "\n#endif /* JPEG_CJPEG_DJPEG */\n"); |
||||
|
||||
/* Close the jconfig.h file */ |
||||
fclose(outfile); |
||||
|
||||
/* User report */ |
||||
printf("Configuration check for Independent JPEG Group's software done.\n"); |
||||
printf("\nI have written the jconfig.h file for you.\n\n"); |
||||
#ifdef HAVE_PROTOTYPES |
||||
printf("You should use makefile.ansi as the starting point for your Makefile.\n"); |
||||
#else |
||||
printf("You should use makefile.unix as the starting point for your Makefile.\n"); |
||||
#endif |
||||
|
||||
#ifdef NEED_SPECIAL_INCLUDE |
||||
printf("\nYou'll need to change jconfig.h to include the system include file\n"); |
||||
printf("that you found type size_t in, or add a direct definition of type\n"); |
||||
printf("size_t if that's what you used. Just add it to the end.\n"); |
||||
#endif |
||||
|
||||
return 0; |
||||
} |
@ -1,118 +0,0 @@
|
||||
IJG JPEG LIBRARY: CODING RULES |
||||
|
||||
Copyright (C) 1991-1996, Thomas G. Lane. |
||||
This file is part of the Independent JPEG Group's software. |
||||
For conditions of distribution and use, see the accompanying README file. |
||||
|
||||
|
||||
Since numerous people will be contributing code and bug fixes, it's important |
||||
to establish a common coding style. The goal of using similar coding styles |
||||
is much more important than the details of just what that style is. |
||||
|
||||
In general we follow the recommendations of "Recommended C Style and Coding |
||||
Standards" revision 6.1 (Cannon et al. as modified by Spencer, Keppel and |
||||
Brader). This document is available in the IJG FTP archive (see |
||||
jpeg/doc/cstyle.ms.tbl.Z, or cstyle.txt.Z for those without nroff/tbl). |
||||
|
||||
Block comments should be laid out thusly: |
||||
|
||||
/* |
||||
* Block comments in this style. |
||||
*/ |
||||
|
||||
We indent statements in K&R style, e.g., |
||||
if (test) { |
||||
then-part; |
||||
} else { |
||||
else-part; |
||||
} |
||||
with two spaces per indentation level. (This indentation convention is |
||||
handled automatically by GNU Emacs and many other text editors.) |
||||
|
||||
Multi-word names should be written in lower case with underscores, e.g., |
||||
multi_word_name (not multiWordName). Preprocessor symbols and enum constants |
||||
are similar but upper case (MULTI_WORD_NAME). Names should be unique within |
||||
the first fifteen characters. (On some older systems, global names must be |
||||
unique within six characters. We accommodate this without cluttering the |
||||
source code by using macros to substitute shorter names.) |
||||
|
||||
We use function prototypes everywhere; we rely on automatic source code |
||||
transformation to feed prototype-less C compilers. Transformation is done |
||||
by the simple and portable tool 'ansi2knr.c' (courtesy of Ghostscript). |
||||
ansi2knr is not very bright, so it imposes a format requirement on function |
||||
declarations: the function name MUST BEGIN IN COLUMN 1. Thus all functions |
||||
should be written in the following style: |
||||
|
||||
LOCAL(int *) |
||||
function_name (int a, char *b) |
||||
{ |
||||
code... |
||||
} |
||||
|
||||
Note that each function definition must begin with GLOBAL(type), LOCAL(type), |
||||
or METHODDEF(type). These macros expand to "static type" or just "type" as |
||||
appropriate. They provide a readable indication of the routine's usage and |
||||
can readily be changed for special needs. (For instance, special linkage |
||||
keywords can be inserted for use in Windows DLLs.) |
||||
|
||||
ansi2knr does not transform method declarations (function pointers in |
||||
structs). We handle these with a macro JMETHOD, defined as |
||||
#ifdef HAVE_PROTOTYPES |
||||
#define JMETHOD(type,methodname,arglist) type (*methodname) arglist |
||||
#else |
||||
#define JMETHOD(type,methodname,arglist) type (*methodname) () |
||||
#endif |
||||
which is used like this: |
||||
struct function_pointers { |
||||
JMETHOD(void, init_entropy_encoder, (int somearg, jparms *jp)); |
||||
JMETHOD(void, term_entropy_encoder, (void)); |
||||
}; |
||||
Note the set of parentheses surrounding the parameter list. |
||||
|
||||
A similar solution is used for forward and external function declarations |
||||
(see the EXTERN and JPP macros). |
||||
|
||||
If the code is to work on non-ANSI compilers, we cannot rely on a prototype |
||||
declaration to coerce actual parameters into the right types. Therefore, use |
||||
explicit casts on actual parameters whenever the actual parameter type is not |
||||
identical to the formal parameter. Beware of implicit conversions to "int". |
||||
|
||||
It seems there are some non-ANSI compilers in which the sizeof() operator |
||||
is defined to return int, yet size_t is defined as long. Needless to say, |
||||
this is brain-damaged. Always use the SIZEOF() macro in place of sizeof(), |
||||
so that the result is guaranteed to be of type size_t. |
||||
|
||||
|
||||
The JPEG library is intended to be used within larger programs. Furthermore, |
||||
we want it to be reentrant so that it can be used by applications that process |
||||
multiple images concurrently. The following rules support these requirements: |
||||
|
||||
1. Avoid direct use of file I/O, "malloc", error report printouts, etc; |
||||
pass these through the common routines provided. |
||||
|
||||
2. Minimize global namespace pollution. Functions should be declared static |
||||
wherever possible. (Note that our method-based calling conventions help this |
||||
a lot: in many modules only the initialization function will ever need to be |
||||
called directly, so only that function need be externally visible.) All |
||||
global function names should begin with "jpeg_", and should have an |
||||
abbreviated name (unique in the first six characters) substituted by macro |
||||
when NEED_SHORT_EXTERNAL_NAMES is set. |
||||
|
||||
3. Don't use global variables; anything that must be used in another module |
||||
should be in the common data structures. |
||||
|
||||
4. Don't use static variables except for read-only constant tables. Variables |
||||
that should be private to a module can be placed into private structures (see |
||||
the system architecture document, structure.txt). |
||||
|
||||
5. Source file names should begin with "j" for files that are part of the |
||||
library proper; source files that are not part of the library, such as cjpeg.c |
||||
and djpeg.c, do not begin with "j". Keep source file names to eight |
||||
characters (plus ".c" or ".h", etc) to make life easy for MS-DOSers. Keep |
||||
compression and decompression code in separate source files --- some |
||||
applications may want only one half of the library. |
||||
|
||||
Note: these rules (particularly #4) are not followed religiously in the |
||||
modules that are used in cjpeg/djpeg but are not part of the JPEG library |
||||
proper. Those modules are not really intended to be used in other |
||||
applications. |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,318 +0,0 @@
|
||||
# IJG auto-configuration source file. |
||||
# Process this file with autoconf to produce a configure script. |
||||
|
||||
# |
||||
# Configure script for IJG libjpeg |
||||
# |
||||
|
||||
AC_INIT([libjpeg], [8.3.0]) |
||||
|
||||
# Directory where autotools helper scripts lives. |
||||
AC_CONFIG_AUX_DIR([.]) |
||||
|
||||
# Generate configuration headers. |
||||
AC_CONFIG_HEADERS([jconfig.h:jconfig.cfg]) |
||||
|
||||
# Hack: disable autoheader so that it doesn't overwrite our cfg template. |
||||
AUTOHEADER="echo autoheader ignored" |
||||
|
||||
# Check system type |
||||
AC_CANONICAL_TARGET |
||||
|
||||
# Initialize Automake |
||||
# Don't require all the GNU mandated files |
||||
AM_INIT_AUTOMAKE([-Wall -Werror ansi2knr no-dist foreign]) |
||||
|
||||
# Make --enable-silent-rules the default. |
||||
# To get verbose build output you may configure |
||||
# with --disable-silent-rules or use "make V=1". |
||||
AM_SILENT_RULES([yes]) |
||||
|
||||
# This is required when using the de-ANSI-fication feature. |
||||
AM_C_PROTOTYPES |
||||
|
||||
# Add configure option --enable-maintainer-mode which enables |
||||
# dependency checking and generation useful to package maintainers. |
||||
# This is made an option to avoid confusing end users. |
||||
AM_MAINTAINER_MODE |
||||
|
||||
# Check for programs |
||||
AC_PROG_CC |
||||
AC_PROG_CC_STDC |
||||
AC_PROG_CPP |
||||
AC_PROG_INSTALL |
||||
AC_PROG_MAKE_SET |
||||
AC_PROG_LN_S |
||||
|
||||
# Check if LD supports linker scripts, |
||||
# and define automake conditional HAVE_LD_VERSION_SCRIPT if so. |
||||
AC_ARG_ENABLE([ld-version-script], |
||||
AS_HELP_STRING([--enable-ld-version-script], |
||||
[enable linker version script (default is enabled when possible)]), |
||||
[have_ld_version_script=$enableval], []) |
||||
if test -z "$have_ld_version_script"; then |
||||
AC_MSG_CHECKING([if LD -Wl,--version-script works]) |
||||
save_LDFLAGS="$LDFLAGS" |
||||
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" |
||||
cat > conftest.map <<EOF |
||||
VERS_1 { |
||||
global: sym; |
||||
}; |
||||
|
||||
VERS_2 { |
||||
global: sym; |
||||
} VERS_1; |
||||
EOF |
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], |
||||
[have_ld_version_script=yes], [have_ld_version_script=no]) |
||||
rm -f conftest.map |
||||
LDFLAGS="$save_LDFLAGS" |
||||
AC_MSG_RESULT($have_ld_version_script) |
||||
fi |
||||
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") |
||||
|
||||
# See if compiler supports prototypes. |
||||
AC_MSG_CHECKING(for function prototypes) |
||||
AC_CACHE_VAL(ijg_cv_have_prototypes, |
||||
[AC_TRY_COMPILE([ |
||||
int testfunction (int arg1, int * arg2); /* check prototypes */ |
||||
struct methods_struct { /* check method-pointer declarations */ |
||||
int (*error_exit) (char *msgtext); |
||||
int (*trace_message) (char *msgtext); |
||||
int (*another_method) (void); |
||||
}; |
||||
int testfunction (int arg1, int * arg2) /* check definitions */ |
||||
{ return arg2[arg1]; } |
||||
int test2function (void) /* check void arg list */ |
||||
{ return 0; } |
||||
], [ ], ijg_cv_have_prototypes=yes, ijg_cv_have_prototypes=no)]) |
||||
AC_MSG_RESULT($ijg_cv_have_prototypes) |
||||
if test $ijg_cv_have_prototypes = yes; then |
||||
AC_DEFINE([HAVE_PROTOTYPES],[1],[Compiler supports function prototypes.]) |
||||
else |
||||
echo Your compiler does not seem to know about function prototypes. |
||||
echo Perhaps it needs a special switch to enable ANSI C mode. |
||||
echo If so, we recommend running configure like this: |
||||
echo " ./configure CC='cc -switch'" |
||||
echo where -switch is the proper switch. |
||||
fi |
||||
|
||||
# Check header files |
||||
AC_CHECK_HEADERS(stddef.h stdlib.h locale.h) |
||||
AC_CHECK_HEADER(string.h, , AC_DEFINE([NEED_BSD_STRINGS],[1],[Compiler has <strings.h> rather than standard <string.h>.])) |
||||
|
||||
# See whether type size_t is defined in any ANSI-standard places; |
||||
# if not, perhaps it is defined in <sys/types.h>. |
||||
AC_MSG_CHECKING(for size_t) |
||||
AC_TRY_COMPILE([ |
||||
#ifdef HAVE_STDDEF_H |
||||
#include <stddef.h> |
||||
#endif |
||||
#ifdef HAVE_STDLIB_H |
||||
#include <stdlib.h> |
||||
#endif |
||||
#include <stdio.h> |
||||
#ifdef NEED_BSD_STRINGS |
||||
#include <strings.h> |
||||
#else |
||||
#include <string.h> |
||||
#endif |
||||
typedef size_t my_size_t; |
||||
], [ my_size_t foovar; ], ijg_size_t_ok=yes, |
||||
[ijg_size_t_ok="not ANSI, perhaps it is in sys/types.h"]) |
||||
AC_MSG_RESULT($ijg_size_t_ok) |
||||
if test "$ijg_size_t_ok" != yes; then |
||||
AC_CHECK_HEADER(sys/types.h, [AC_DEFINE([NEED_SYS_TYPES_H],[1],[Need to include <sys/types.h> in order to obtain size_t.]) |
||||
AC_EGREP_CPP(size_t, [#include <sys/types.h>], |
||||
[ijg_size_t_ok="size_t is in sys/types.h"], ijg_size_t_ok=no)], |
||||
ijg_size_t_ok=no) |
||||
AC_MSG_RESULT($ijg_size_t_ok) |
||||
if test "$ijg_size_t_ok" = no; then |
||||
echo Type size_t is not defined in any of the usual places. |
||||
echo Try putting '"typedef unsigned int size_t;"' in jconfig.h. |
||||
fi |
||||
fi |
||||
|
||||
# Check compiler characteristics |
||||
AC_MSG_CHECKING(for type unsigned char) |
||||
AC_TRY_COMPILE(, [ unsigned char un_char; ], |
||||
[AC_MSG_RESULT(yes) |
||||
AC_DEFINE([HAVE_UNSIGNED_CHAR],[1],[Compiler supports 'unsigned char'.])], AC_MSG_RESULT(no)) |
||||
dnl |
||||
AC_MSG_CHECKING(for type unsigned short) |
||||
AC_TRY_COMPILE(, [ unsigned short un_short; ], |
||||
[AC_MSG_RESULT(yes) |
||||
AC_DEFINE([HAVE_UNSIGNED_SHORT],[1],[Compiler supports 'unsigned short'.])], AC_MSG_RESULT(no)) |
||||
dnl |
||||
AC_MSG_CHECKING(for type void) |
||||
AC_TRY_COMPILE([ |
||||
/* Caution: a C++ compiler will insist on valid prototypes */ |
||||
typedef void * void_ptr; /* check void * */ |
||||
#ifdef HAVE_PROTOTYPES /* check ptr to function returning void */ |
||||
typedef void (*void_func) (int a, int b); |
||||
#else |
||||
typedef void (*void_func) (); |
||||
#endif |
||||
|
||||
#ifdef HAVE_PROTOTYPES /* check void function result */ |
||||
void test3function (void_ptr arg1, void_func arg2) |
||||
#else |
||||
void test3function (arg1, arg2) |
||||
void_ptr arg1; |
||||
void_func arg2; |
||||
#endif |
||||
{ |
||||
char * locptr = (char *) arg1; /* check casting to and from void * */ |
||||
arg1 = (void *) locptr; |
||||
(*arg2) (1, 2); /* check call of fcn returning void */ |
||||
} |
||||
], [ ], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no) |
||||
AC_DEFINE([void],[char],[Define 'void' as 'char' for archaic compilers that don't understand it.])]) |
||||
AC_C_CONST |
||||
|
||||
# Check for non-broken inline under various spellings |
||||
AC_MSG_CHECKING(for inline) |
||||
ijg_cv_inline="" |
||||
AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; } |
||||
int bar() { return foo();], ijg_cv_inline="__inline__", |
||||
AC_TRY_COMPILE(, [} __inline int foo() { return 0; } |
||||
int bar() { return foo();], ijg_cv_inline="__inline", |
||||
AC_TRY_COMPILE(, [} inline int foo() { return 0; } |
||||
int bar() { return foo();], ijg_cv_inline="inline"))) |
||||
AC_MSG_RESULT($ijg_cv_inline) |
||||
AC_DEFINE_UNQUOTED([INLINE],[$ijg_cv_inline],[How to obtain function inlining.]) |
||||
|
||||
# We cannot check for bogus warnings, but at least we can check for errors |
||||
AC_MSG_CHECKING(for broken incomplete types) |
||||
AC_TRY_COMPILE([ typedef struct undefined_structure * undef_struct_ptr; ], , |
||||
AC_MSG_RESULT(ok), |
||||
[AC_MSG_RESULT(broken) |
||||
AC_DEFINE([INCOMPLETE_TYPES_BROKEN],[1],[Compiler does not support pointers to unspecified structures.])]) |
||||
|
||||
# Test whether global names are unique to at least 15 chars |
||||
AC_MSG_CHECKING(for short external names) |
||||
AC_TRY_LINK([ |
||||
int possibly_duplicate_function () { return 0; } |
||||
int possibly_dupli_function () { return 1; } |
||||
], [ ], AC_MSG_RESULT(ok), [AC_MSG_RESULT(short) |
||||
AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES],[1],[Linker requires that global names be unique in first 15 characters.])]) |
||||
|
||||
# Run-time checks |
||||
AC_MSG_CHECKING(to see if char is signed) |
||||
AC_TRY_RUN([ |
||||
#ifdef HAVE_PROTOTYPES |
||||
int is_char_signed (int arg) |
||||
#else |
||||
int is_char_signed (arg) |
||||
int arg; |
||||
#endif |
||||
{ |
||||
if (arg == 189) { /* expected result for unsigned char */ |
||||
return 0; /* type char is unsigned */ |
||||
} |
||||
else if (arg != -67) { /* expected result for signed char */ |
||||
printf("Hmm, it seems 'char' is not eight bits wide on your machine.\n"); |
||||
printf("I fear the JPEG software will not work at all.\n\n"); |
||||
} |
||||
return 1; /* assume char is signed otherwise */ |
||||
} |
||||
char signed_char_check = (char) (-67); |
||||
int main() { |
||||
exit(is_char_signed((int) signed_char_check)); |
||||
}], [AC_MSG_RESULT(no) |
||||
AC_DEFINE([CHAR_IS_UNSIGNED],[1],[Characters are unsigned])], AC_MSG_RESULT(yes), |
||||
[echo Assuming that char is signed on target machine. |
||||
echo If it is unsigned, this will be a little bit inefficient. |
||||
]) |
||||
dnl |
||||
AC_MSG_CHECKING(to see if right shift is signed) |
||||
AC_TRY_RUN([ |
||||
#ifdef HAVE_PROTOTYPES |
||||
int is_shifting_signed (long arg) |
||||
#else |
||||
int is_shifting_signed (arg) |
||||
long arg; |
||||
#endif |
||||
/* See whether right-shift on a long is signed or not. */ |
||||
{ |
||||
long res = arg >> 4; |
||||
|
||||
if (res == -0x7F7E80CL) { /* expected result for signed shift */ |
||||
return 1; /* right shift is signed */ |
||||
} |
||||
/* see if unsigned-shift hack will fix it. */ |
||||
/* we can't just test exact value since it depends on width of long... */ |
||||
res |= (~0L) << (32-4); |
||||
if (res == -0x7F7E80CL) { /* expected result now? */ |
||||
return 0; /* right shift is unsigned */ |
||||
} |
||||
printf("Right shift isn't acting as I expect it to.\n"); |
||||
printf("I fear the JPEG software will not work at all.\n\n"); |
||||
return 0; /* try it with unsigned anyway */ |
||||
} |
||||
int main() { |
||||
exit(is_shifting_signed(-0x7F7E80B1L)); |
||||
}], [AC_MSG_RESULT(no) |
||||
AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED],[1],[Broken compiler shifts signed values as an unsigned shift.])], AC_MSG_RESULT(yes), |
||||
AC_MSG_RESULT(Assuming that right shift is signed on target machine.)) |
||||
dnl |
||||
AC_MSG_CHECKING(to see if fopen accepts b spec) |
||||
AC_TRY_RUN([ |
||||
#include <stdio.h> |
||||
int main() { |
||||
if (fopen("conftestdata", "wb") != NULL) |
||||
exit(0); |
||||
exit(1); |
||||
}], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no) |
||||
AC_DEFINE([DONT_USE_B_MODE],[1],[Don't open files in binary mode.])], |
||||
AC_MSG_RESULT(Assuming that it does.)) |
||||
|
||||
# Configure libtool |
||||
AC_LIBTOOL_WIN32_DLL |
||||
AC_PROG_LIBTOOL |
||||
|
||||
# Select memory manager depending on user input. |
||||
# If no "-enable-maxmem", use jmemnobs |
||||
MEMORYMGR='jmemnobs' |
||||
MAXMEM="no" |
||||
AC_ARG_ENABLE(maxmem, |
||||
[ --enable-maxmem[=N] enable use of temp files, set max mem usage to N MB], |
||||
MAXMEM="$enableval") |
||||
dnl [# support --with-maxmem for backwards compatibility with IJG V5.] |
||||
dnl AC_ARG_WITH(maxmem, , MAXMEM="$withval") |
||||
if test "x$MAXMEM" = xyes; then |
||||
MAXMEM=1 |
||||
fi |
||||
if test "x$MAXMEM" != xno; then |
||||
if test -n "`echo $MAXMEM | sed 's/[[0-9]]//g'`"; then |
||||
AC_MSG_ERROR(non-numeric argument to --enable-maxmem) |
||||
fi |
||||
DEFAULTMAXMEM=`expr $MAXMEM \* 1048576` |
||||
AC_DEFINE_UNQUOTED([DEFAULT_MAX_MEM], [${DEFAULTMAXMEM}], [Maximum data space library will allocate.]) |
||||
AC_MSG_CHECKING([for 'tmpfile()']) |
||||
AC_TRY_LINK([#include <stdio.h>], [ FILE * tfile = tmpfile(); ], |
||||
[AC_MSG_RESULT(yes) |
||||
MEMORYMGR='jmemansi'], |
||||
[AC_MSG_RESULT(no) |
||||
dnl if tmpfile is not present, must use jmemname. |
||||
MEMORYMGR='jmemname' |
||||
|
||||
# Test for the need to remove temporary files using a signal handler (for cjpeg/djpeg) |
||||
AC_DEFINE([NEED_SIGNAL_CATCHER],[1],[Need signal handler to clean up temporary files.]) |
||||
AC_MSG_CHECKING([for 'mktemp()']) |
||||
AC_TRY_LINK(, [ char fname[80]; mktemp(fname); ], AC_MSG_RESULT(yes), |
||||
[AC_MSG_RESULT(no) |
||||
AC_DEFINE([NO_MKTEMP],[1],[The mktemp() function is not available.])])]) |
||||
fi |
||||
AC_SUBST(MEMORYMGR) |
||||
|
||||
# Extract the library version IDs from jpeglib.h. |
||||
AC_MSG_CHECKING([libjpeg version number]) |
||||
[JPEG_LIB_VERSION_MAJOR=`sed -e '/^#define JPEG_LIB_VERSION_MAJOR/!d' -e 's/^[^0-9]*\([0-9][0-9]*\).*$/\1/' $srcdir/jpeglib.h`] |
||||
[JPEG_LIB_VERSION_MINOR=`sed -e '/^#define JPEG_LIB_VERSION_MINOR/!d' -e 's/^[^0-9]*\([0-9][0-9]*\).*$/\1/' $srcdir/jpeglib.h`] |
||||
[JPEG_LIB_VERSION="`expr $JPEG_LIB_VERSION_MAJOR + $JPEG_LIB_VERSION_MINOR`:0:$JPEG_LIB_VERSION_MINOR"] |
||||
AC_MSG_RESULT([$JPEG_LIB_VERSION]) |
||||
AC_SUBST([JPEG_LIB_VERSION]) |
||||
|
||||
AC_CONFIG_FILES([Makefile]) |
||||
AC_OUTPUT |
@ -1,630 +0,0 @@
|
||||
#! /bin/sh |
||||
# depcomp - compile a program generating dependencies as side-effects |
||||
|
||||
scriptversion=2009-04-28.21; # UTC |
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free |
||||
# Software Foundation, Inc. |
||||
|
||||
# This program is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 2, or (at your option) |
||||
# any later version. |
||||
|
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
|
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
# As a special exception to the GNU General Public License, if you |
||||
# distribute this file as part of a program that contains a |
||||
# configuration script generated by Autoconf, you may include it under |
||||
# the same distribution terms that you use for the rest of that program. |
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. |
||||
|
||||
case $1 in |
||||
'') |
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2 |
||||
exit 1; |
||||
;; |
||||
-h | --h*) |
||||
cat <<\EOF |
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS] |
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies |
||||
as side-effects. |
||||
|
||||
Environment variables: |
||||
depmode Dependency tracking mode. |
||||
source Source file read by `PROGRAMS ARGS'. |
||||
object Object file output by `PROGRAMS ARGS'. |
||||
DEPDIR directory where to store dependencies. |
||||
depfile Dependency file to output. |
||||
tmpdepfile Temporary file to use when outputing dependencies. |
||||
libtool Whether libtool is used (yes/no). |
||||
|
||||
Report bugs to <bug-automake@gnu.org>. |
||||
EOF |
||||
exit $? |
||||
;; |
||||
-v | --v*) |
||||
echo "depcomp $scriptversion" |
||||
exit $? |
||||
;; |
||||
esac |
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then |
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. |
||||
depfile=${depfile-`echo "$object" | |
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} |
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} |
||||
|
||||
rm -f "$tmpdepfile" |
||||
|
||||
# Some modes work just like other modes, but use different flags. We |
||||
# parameterize here, but still list the modes in the big case below, |
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case |
||||
# here, because this file can only contain one case statement. |
||||
if test "$depmode" = hp; then |
||||
# HP compiler uses -M and no extra arg. |
||||
gccflag=-M |
||||
depmode=gcc |
||||
fi |
||||
|
||||
if test "$depmode" = dashXmstdout; then |
||||
# This is just like dashmstdout with a different argument. |
||||
dashmflag=-xM |
||||
depmode=dashmstdout |
||||
fi |
||||
|
||||
cygpath_u="cygpath -u -f -" |
||||
if test "$depmode" = msvcmsys; then |
||||
# This is just like msvisualcpp but w/o cygpath translation. |
||||
# Just convert the backslash-escaped backslashes to single forward |
||||
# slashes to satisfy depend.m4 |
||||
cygpath_u="sed s,\\\\\\\\,/,g" |
||||
depmode=msvisualcpp |
||||
fi |
||||
|
||||
case "$depmode" in |
||||
gcc3) |
||||
## gcc 3 implements dependency tracking that does exactly what |
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like |
||||
## it if -MD -MP comes after the -MF stuff. Hmm. |
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon |
||||
## the command line argument order; so add the flags where they |
||||
## appear in depend2.am. Note that the slowdown incurred here |
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this. |
||||
for arg |
||||
do |
||||
case $arg in |
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; |
||||
*) set fnord "$@" "$arg" ;; |
||||
esac |
||||
shift # fnord |
||||
shift # $arg |
||||
done |
||||
"$@" |
||||
stat=$? |
||||
if test $stat -eq 0; then : |
||||
else |
||||
rm -f "$tmpdepfile" |
||||
exit $stat |
||||
fi |
||||
mv "$tmpdepfile" "$depfile" |
||||
;; |
||||
|
||||
gcc) |
||||
## There are various ways to get dependency output from gcc. Here's |
||||
## why we pick this rather obscure method: |
||||
## - Don't want to use -MD because we'd like the dependencies to end |
||||
## up in a subdir. Having to rename by hand is ugly. |
||||
## (We might end up doing this anyway to support other compilers.) |
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like |
||||
## -MM, not -M (despite what the docs say). |
||||
## - Using -M directly means running the compiler twice (even worse |
||||
## than renaming). |
||||
if test -z "$gccflag"; then |
||||
gccflag=-MD, |
||||
fi |
||||
"$@" -Wp,"$gccflag$tmpdepfile" |
||||
stat=$? |
||||
if test $stat -eq 0; then : |
||||
else |
||||
rm -f "$tmpdepfile" |
||||
exit $stat |
||||
fi |
||||
rm -f "$depfile" |
||||
echo "$object : \\" > "$depfile" |
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz |
||||
## The second -e expression handles DOS-style file names with drive letters. |
||||
sed -e 's/^[^:]*: / /' \ |
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" |
||||
## This next piece of magic avoids the `deleted header file' problem. |
||||
## The problem is that when a header file which appears in a .P file |
||||
## is deleted, the dependency causes make to die (because there is |
||||
## typically no way to rebuild the header). We avoid this by adding |
||||
## dummy dependencies for each header file. Too bad gcc doesn't do |
||||
## this for us directly. |
||||
tr ' ' ' |
||||
' < "$tmpdepfile" | |
||||
## Some versions of gcc put a space before the `:'. On the theory |
||||
## that the space means something, we add a space to the output as |
||||
## well. |
||||
## Some versions of the HPUX 10.20 sed can't process this invocation |
||||
## correctly. Breaking it into two sed invocations is a workaround. |
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |
||||
rm -f "$tmpdepfile" |
||||
;; |
||||
|
||||
hp) |
||||
# This case exists only to let depend.m4 do its work. It works by |
||||
# looking at the text of this script. This case will never be run, |
||||
# since it is checked for above. |
||||
exit 1 |
||||
;; |
||||
|
||||
sgi) |
||||
if test "$libtool" = yes; then |
||||
"$@" "-Wp,-MDupdate,$tmpdepfile" |
||||
else |
||||
"$@" -MDupdate "$tmpdepfile" |
||||
fi |
||||
stat=$? |
||||
if test $stat -eq 0; then : |
||||
else |
||||
rm -f "$tmpdepfile" |
||||
exit $stat |
||||
fi |
||||
rm -f "$depfile" |
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files |
||||
echo "$object : \\" > "$depfile" |
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be |
||||
# clever and replace this with sed code, as IRIX sed won't handle |
||||
# lines with more than a fixed number of characters (4096 in |
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; |
||||
# the IRIX cc adds comments like `#:fec' to the end of the |
||||
# dependency line. |
||||
tr ' ' ' |
||||
' < "$tmpdepfile" \ |
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ |
||||
tr ' |
||||
' ' ' >> "$depfile" |
||||
echo >> "$depfile" |
||||
|
||||
# The second pass generates a dummy entry for each header file. |
||||
tr ' ' ' |
||||
' < "$tmpdepfile" \ |
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ |
||||
>> "$depfile" |
||||
else |
||||
# The sourcefile does not contain any dependencies, so just |
||||
# store a dummy comment line, to avoid errors with the Makefile |
||||
# "include basename.Plo" scheme. |
||||
echo "#dummy" > "$depfile" |
||||
fi |
||||
rm -f "$tmpdepfile" |
||||
;; |
||||
|
||||
aix) |
||||
# The C for AIX Compiler uses -M and outputs the dependencies |
||||
# in a .u file. In older versions, this file always lives in the |
||||
# current directory. Also, the AIX compiler puts `$object:' at the |
||||
# start of each line; $object doesn't have directory information. |
||||
# Version 6 uses the directory in both cases. |
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
||||
test "x$dir" = "x$object" && dir= |
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` |
||||
if test "$libtool" = yes; then |
||||
tmpdepfile1=$dir$base.u |
||||
tmpdepfile2=$base.u |
||||
tmpdepfile3=$dir.libs/$base.u |
||||
"$@" -Wc,-M |
||||
else |
||||
tmpdepfile1=$dir$base.u |
||||
tmpdepfile2=$dir$base.u |
||||
tmpdepfile3=$dir$base.u |
||||
"$@" -M |
||||
fi |
||||
stat=$? |
||||
|
||||
if test $stat -eq 0; then : |
||||
else |
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" |
||||
exit $stat |
||||
fi |
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" |
||||
do |
||||
test -f "$tmpdepfile" && break |
||||
done |
||||
if test -f "$tmpdepfile"; then |
||||
# Each line is of the form `foo.o: dependent.h'. |
||||
# Do two passes, one to just change these to |
||||
# `$object: dependent.h' and one to simply `dependent.h:'. |
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" |
||||
# That's a tab and a space in the []. |
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" |
||||
else |
||||
# The sourcefile does not contain any dependencies, so just |
||||
# store a dummy comment line, to avoid errors with the Makefile |
||||
# "include basename.Plo" scheme. |
||||
echo "#dummy" > "$depfile" |
||||
fi |
||||
rm -f "$tmpdepfile" |
||||
;; |
||||
|
||||
icc) |
||||
# Intel's C compiler understands `-MD -MF file'. However on |
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c |
||||
# ICC 7.0 will fill foo.d with something like |
||||
# foo.o: sub/foo.c |
||||
# foo.o: sub/foo.h |
||||
# which is wrong. We want: |
||||
# sub/foo.o: sub/foo.c |
||||
# sub/foo.o: sub/foo.h |
||||
# sub/foo.c: |
||||
# sub/foo.h: |
||||
# ICC 7.1 will output |
||||
# foo.o: sub/foo.c sub/foo.h |
||||
# and will wrap long lines using \ : |
||||
# foo.o: sub/foo.c ... \ |
||||
# sub/foo.h ... \ |
||||
# ... |
||||
|
||||
"$@" -MD -MF "$tmpdepfile" |
||||
stat=$? |
||||
if test $stat -eq 0; then : |
||||
else |
||||
rm -f "$tmpdepfile" |
||||
exit $stat |
||||
fi |
||||
rm -f "$depfile" |
||||
# Each line is of the form `foo.o: dependent.h', |
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. |
||||
# Do two passes, one to just change these to |
||||
# `$object: dependent.h' and one to simply `dependent.h:'. |
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" |
||||
# Some versions of the HPUX 10.20 sed can't process this invocation |
||||
# correctly. Breaking it into two sed invocations is a workaround. |
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | |
||||
sed -e 's/$/ :/' >> "$depfile" |
||||
rm -f "$tmpdepfile" |
||||
;; |
||||
|
||||
hp2) |
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64 |
||||
# compilers, which have integrated preprocessors. The correct option |
||||
# to use with these is +Maked; it writes dependencies to a file named |
||||
# 'foo.d', which lands next to the object file, wherever that |
||||
# happens to be. |
||||
# Much of this is similar to the tru64 case; see comments there. |
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
||||
test "x$dir" = "x$object" && dir= |
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` |
||||
if test "$libtool" = yes; then |
||||
tmpdepfile1=$dir$base.d |
||||
tmpdepfile2=$dir.libs/$base.d |
||||
"$@" -Wc,+Maked |
||||
else |
||||
tmpdepfile1=$dir$base.d |
||||
tmpdepfile2=$dir$base.d |
||||
"$@" +Maked |
||||
fi |
||||
stat=$? |
||||
if test $stat -eq 0; then : |
||||
else |
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" |
||||
exit $stat |
||||
fi |
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" |
||||
do |
||||
test -f "$tmpdepfile" && break |
||||
done |
||||
if test -f "$tmpdepfile"; then |
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" |
||||
# Add `dependent.h:' lines. |
||||
sed -ne '2,${ |
||||
s/^ *// |
||||
s/ \\*$// |
||||
s/$/:/ |
||||
p |
||||
}' "$tmpdepfile" >> "$depfile" |
||||
else |
||||
echo "#dummy" > "$depfile" |
||||
fi |
||||
rm -f "$tmpdepfile" "$tmpdepfile2" |
||||
;; |
||||
|
||||
tru64) |
||||
# The Tru64 compiler uses -MD to generate dependencies as a side |
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. |
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put |
||||
# dependencies in `foo.d' instead, so we check for that too. |
||||
# Subdirectories are respected. |
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
||||
test "x$dir" = "x$object" && dir= |
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` |
||||
|
||||
if test "$libtool" = yes; then |
||||
# With Tru64 cc, shared objects can also be used to make a |
||||
# static library. This mechanism is used in libtool 1.4 series to |
||||
# handle both shared and static libraries in a single compilation. |
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. |
||||
# |
||||
# With libtool 1.5 this exception was removed, and libtool now |
||||
# generates 2 separate objects for the 2 libraries. These two |
||||
# compilations output dependencies in $dir.libs/$base.o.d and |
||||
# in $dir$base.o.d. We have to check for both files, because |
||||
# one of the two compilations can be disabled. We should prefer |
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is |
||||
# automatically cleaned when .libs/ is deleted, while ignoring |
||||
# the former would cause a distcleancheck panic. |
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 |
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5 |
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 |
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 |
||||
"$@" -Wc,-MD |
||||
else |
||||
tmpdepfile1=$dir$base.o.d |
||||
tmpdepfile2=$dir$base.d |
||||
tmpdepfile3=$dir$base.d |
||||
tmpdepfile4=$dir$base.d |
||||
"$@" -MD |
||||
fi |
||||
|
||||
stat=$? |
||||
if test $stat -eq 0; then : |
||||
else |
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" |
||||
exit $stat |
||||
fi |
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" |
||||
do |
||||
test -f "$tmpdepfile" && break |
||||
done |
||||
if test -f "$tmpdepfile"; then |
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" |
||||
# That's a tab and a space in the []. |
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" |
||||
else |
||||
echo "#dummy" > "$depfile" |
||||
fi |
||||
rm -f "$tmpdepfile" |
||||
;; |
||||
|
||||
#nosideeffect) |
||||
# This comment above is used by automake to tell side-effect |
||||
# dependency tracking mechanisms from slower ones. |
||||
|
||||
dashmstdout) |
||||
# Important note: in order to support this mode, a compiler *must* |
||||
# always write the preprocessed file to stdout, regardless of -o. |
||||
"$@" || exit $? |
||||
|
||||
# Remove the call to Libtool. |
||||
if test "$libtool" = yes; then |
||||
while test "X$1" != 'X--mode=compile'; do |
||||
shift |
||||
done |
||||
shift |
||||
fi |
||||
|
||||
# Remove `-o $object'. |
||||
IFS=" " |
||||
for arg |
||||
do |
||||
case $arg in |
||||
-o) |
||||
shift |
||||
;; |
||||
$object) |
||||
shift |
||||
;; |
||||
*) |
||||
set fnord "$@" "$arg" |
||||
shift # fnord |
||||
shift # $arg |
||||
;; |
||||
esac |
||||
done |
||||
|
||||
test -z "$dashmflag" && dashmflag=-M |
||||
# Require at least two characters before searching for `:' |
||||
# in the target name. This is to cope with DOS-style filenames: |
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. |
||||
"$@" $dashmflag | |
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" |
||||
rm -f "$depfile" |
||||
cat < "$tmpdepfile" > "$depfile" |
||||
tr ' ' ' |
||||
' < "$tmpdepfile" | \ |
||||
## Some versions of the HPUX 10.20 sed can't process this invocation |
||||
## correctly. Breaking it into two sed invocations is a workaround. |
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |
||||
rm -f "$tmpdepfile" |
||||
;; |
||||
|
||||
dashXmstdout) |
||||
# This case only exists to satisfy depend.m4. It is never actually |
||||
# run, as this mode is specially recognized in the preamble. |
||||
exit 1 |
||||
;; |
||||
|
||||
makedepend) |
||||
"$@" || exit $? |
||||
# Remove any Libtool call |
||||
if test "$libtool" = yes; then |
||||
while test "X$1" != 'X--mode=compile'; do |
||||
shift |
||||
done |
||||
shift |
||||
fi |
||||
# X makedepend |
||||
shift |
||||
cleared=no eat=no |
||||
for arg |
||||
do |
||||
case $cleared in |
||||
no) |
||||
set ""; shift |
||||
cleared=yes ;; |
||||
esac |
||||
if test $eat = yes; then |
||||
eat=no |
||||
continue |
||||
fi |
||||
case "$arg" in |
||||
-D*|-I*) |
||||
set fnord "$@" "$arg"; shift ;; |
||||
# Strip any option that makedepend may not understand. Remove |
||||
# the object too, otherwise makedepend will parse it as a source file. |
||||
-arch) |
||||
eat=yes ;; |
||||
-*|$object) |
||||
;; |
||||
*) |
||||
set fnord "$@" "$arg"; shift ;; |
||||
esac |
||||
done |
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'` |
||||
touch "$tmpdepfile" |
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" |
||||
rm -f "$depfile" |
||||
cat < "$tmpdepfile" > "$depfile" |
||||
sed '1,2d' "$tmpdepfile" | tr ' ' ' |
||||
' | \ |
||||
## Some versions of the HPUX 10.20 sed can't process this invocation |
||||
## correctly. Breaking it into two sed invocations is a workaround. |
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak |
||||
;; |
||||
|
||||
cpp) |
||||
# Important note: in order to support this mode, a compiler *must* |
||||
# always write the preprocessed file to stdout. |
||||
"$@" || exit $? |
||||
|
||||
# Remove the call to Libtool. |
||||
if test "$libtool" = yes; then |
||||
while test "X$1" != 'X--mode=compile'; do |
||||
shift |
||||
done |
||||
shift |
||||
fi |
||||
|
||||
# Remove `-o $object'. |
||||
IFS=" " |
||||
for arg |
||||
do |
||||
case $arg in |
||||
-o) |
||||
shift |
||||
;; |
||||
$object) |
||||
shift |
||||
;; |
||||
*) |
||||
set fnord "$@" "$arg" |
||||
shift # fnord |
||||
shift # $arg |
||||
;; |
||||
esac |
||||
done |
||||
|
||||
"$@" -E | |
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ |
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | |
||||
sed '$ s: \\$::' > "$tmpdepfile" |
||||
rm -f "$depfile" |
||||
echo "$object : \\" > "$depfile" |
||||
cat < "$tmpdepfile" >> "$depfile" |
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" |
||||
rm -f "$tmpdepfile" |
||||
;; |
||||
|
||||
msvisualcpp) |
||||
# Important note: in order to support this mode, a compiler *must* |
||||
# always write the preprocessed file to stdout. |
||||
"$@" || exit $? |
||||
|
||||
# Remove the call to Libtool. |
||||
if test "$libtool" = yes; then |
||||
while test "X$1" != 'X--mode=compile'; do |
||||
shift |
||||
done |
||||
shift |
||||
fi |
||||
|
||||
IFS=" " |
||||
for arg |
||||
do |
||||
case "$arg" in |
||||
-o) |
||||
shift |
||||
;; |
||||
$object) |
||||
shift |
||||
;; |
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") |
||||
set fnord "$@" |
||||
shift |
||||
shift |
||||
;; |
||||
*) |
||||
set fnord "$@" "$arg" |
||||
shift |
||||
shift |
||||
;; |
||||
esac |
||||
done |
||||
"$@" -E 2>/dev/null | |
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" |
||||
rm -f "$depfile" |
||||
echo "$object : \\" > "$depfile" |
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" |
||||
echo " " >> "$depfile" |
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" |
||||
rm -f "$tmpdepfile" |
||||
;; |
||||
|
||||
msvcmsys) |
||||
# This case exists only to let depend.m4 do its work. It works by |
||||
# looking at the text of this script. This case will never be run, |
||||
# since it is checked for above. |
||||
exit 1 |
||||
;; |
||||
|
||||
none) |
||||
exec "$@" |
||||
;; |
||||
|
||||
*) |
||||
echo "Unknown depmode $depmode" 1>&2 |
||||
exit 1 |
||||
;; |
||||
esac |
||||
|
||||
exit 0 |
||||
|
||||
# Local Variables: |
||||
# mode: shell-script |
||||
# sh-indentation: 2 |
||||
# eval: (add-hook 'write-file-hooks 'time-stamp) |
||||
# time-stamp-start: "scriptversion=" |
||||
# time-stamp-format: "%:y-%02m-%02d.%02H" |
||||
# time-stamp-time-zone: "UTC" |
||||
# time-stamp-end: "; # UTC" |
||||
# End: |
@ -1,252 +0,0 @@
|
||||
.TH DJPEG 1 "3 October 2009" |
||||
.SH NAME |
||||
djpeg \- decompress a JPEG file to an image file |
||||
.SH SYNOPSIS |
||||
.B djpeg |
||||
[ |
||||
.I options |
||||
] |
||||
[ |
||||
.I filename |
||||
] |
||||
.LP |
||||
.SH DESCRIPTION |
||||
.LP |
||||
.B djpeg |
||||
decompresses the named JPEG file, or the standard input if no file is named, |
||||
and produces an image file on the standard output. PBMPLUS (PPM/PGM), BMP, |
||||
GIF, Targa, or RLE (Utah Raster Toolkit) output format can be selected. |
||||
(RLE is supported only if the URT library is available.) |
||||
.SH OPTIONS |
||||
All switch names may be abbreviated; for example, |
||||
.B \-grayscale |
||||
may be written |
||||
.B \-gray |
||||
or |
||||
.BR \-gr . |
||||
Most of the "basic" switches can be abbreviated to as little as one letter. |
||||
Upper and lower case are equivalent (thus |
||||
.B \-BMP |
||||
is the same as |
||||
.BR \-bmp ). |
||||
British spellings are also accepted (e.g., |
||||
.BR \-greyscale ), |
||||
though for brevity these are not mentioned below. |
||||
.PP |
||||
The basic switches are: |
||||
.TP |
||||
.BI \-colors " N" |
||||
Reduce image to at most N colors. This reduces the number of colors used in |
||||
the output image, so that it can be displayed on a colormapped display or |
||||
stored in a colormapped file format. For example, if you have an 8-bit |
||||
display, you'd need to reduce to 256 or fewer colors. |
||||
.TP |
||||
.BI \-quantize " N" |
||||
Same as |
||||
.BR \-colors . |
||||
.B \-colors |
||||
is the recommended name, |
||||
.B \-quantize |
||||
is provided only for backwards compatibility. |
||||
.TP |
||||
.B \-fast |
||||
Select recommended processing options for fast, low quality output. (The |
||||
default options are chosen for highest quality output.) Currently, this is |
||||
equivalent to \fB\-dct fast \-nosmooth \-onepass \-dither ordered\fR. |
||||
.TP |
||||
.B \-grayscale |
||||
Force gray-scale output even if JPEG file is color. Useful for viewing on |
||||
monochrome displays; also, |
||||
.B djpeg |
||||
runs noticeably faster in this mode. |
||||
.TP |
||||
.BI \-scale " M/N" |
||||
Scale the output image by a factor M/N. Currently supported scale factors are |
||||
M/N with all M from 1 to 16, where N is the source DCT size, which is 8 for |
||||
baseline JPEG. If the /N part is omitted, then M specifies the DCT scaled |
||||
size to be applied on the given input. For baseline JPEG this is equivalent |
||||
to M/8 scaling, since the source DCT size for baseline JPEG is 8. |
||||
Scaling is handy if the image is larger than your screen; also, |
||||
.B djpeg |
||||
runs much faster when scaling down the output. |
||||
.TP |
||||
.B \-bmp |
||||
Select BMP output format (Windows flavor). 8-bit colormapped format is |
||||
emitted if |
||||
.B \-colors |
||||
or |
||||
.B \-grayscale |
||||
is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color |
||||
format is emitted. |
||||
.TP |
||||
.B \-gif |
||||
Select GIF output format. Since GIF does not support more than 256 colors, |
||||
.B \-colors 256 |
||||
is assumed (unless you specify a smaller number of colors). |
||||
.TP |
||||
.B \-os2 |
||||
Select BMP output format (OS/2 1.x flavor). 8-bit colormapped format is |
||||
emitted if |
||||
.B \-colors |
||||
or |
||||
.B \-grayscale |
||||
is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color |
||||
format is emitted. |
||||
.TP |
||||
.B \-pnm |
||||
Select PBMPLUS (PPM/PGM) output format (this is the default format). |
||||
PGM is emitted if the JPEG file is gray-scale or if |
||||
.B \-grayscale |
||||
is specified; otherwise PPM is emitted. |
||||
.TP |
||||
.B \-rle |
||||
Select RLE output format. (Requires URT library.) |
||||
.TP |
||||
.B \-targa |
||||
Select Targa output format. Gray-scale format is emitted if the JPEG file is |
||||
gray-scale or if |
||||
.B \-grayscale |
||||
is specified; otherwise, colormapped format is emitted if |
||||
.B \-colors |
||||
is specified; otherwise, 24-bit full-color format is emitted. |
||||
.PP |
||||
Switches for advanced users: |
||||
.TP |
||||
.B \-dct int |
||||
Use integer DCT method (default). |
||||
.TP |
||||
.B \-dct fast |
||||
Use fast integer DCT (less accurate). |
||||
.TP |
||||
.B \-dct float |
||||
Use floating-point DCT method. |
||||
The float method is very slightly more accurate than the int method, but is |
||||
much slower unless your machine has very fast floating-point hardware. Also |
||||
note that results of the floating-point method may vary slightly across |
||||
machines, while the integer methods should give the same results everywhere. |
||||
The fast integer method is much less accurate than the other two. |
||||
.TP |
||||
.B \-dither fs |
||||
Use Floyd-Steinberg dithering in color quantization. |
||||
.TP |
||||
.B \-dither ordered |
||||
Use ordered dithering in color quantization. |
||||
.TP |
||||
.B \-dither none |
||||
Do not use dithering in color quantization. |
||||
By default, Floyd-Steinberg dithering is applied when quantizing colors; this |
||||
is slow but usually produces the best results. Ordered dither is a compromise |
||||
between speed and quality; no dithering is fast but usually looks awful. Note |
||||
that these switches have no effect unless color quantization is being done. |
||||
Ordered dither is only available in |
||||
.B \-onepass |
||||
mode. |
||||
.TP |
||||
.BI \-map " file" |
||||
Quantize to the colors used in the specified image file. This is useful for |
||||
producing multiple files with identical color maps, or for forcing a |
||||
predefined set of colors to be used. The |
||||
.I file |
||||
must be a GIF or PPM file. This option overrides |
||||
.B \-colors |
||||
and |
||||
.BR \-onepass . |
||||
.TP |
||||
.B \-nosmooth |
||||
Don't use high-quality upsampling. |
||||
.TP |
||||
.B \-onepass |
||||
Use one-pass instead of two-pass color quantization. The one-pass method is |
||||
faster and needs less memory, but it produces a lower-quality image. |
||||
.B \-onepass |
||||
is ignored unless you also say |
||||
.B \-colors |
||||
.IR N . |
||||
Also, the one-pass method is always used for gray-scale output (the two-pass |
||||
method is no improvement then). |
||||
.TP |
||||
.BI \-maxmemory " N" |
||||
Set limit for amount of memory to use in processing large images. Value is |
||||
in thousands of bytes, or millions of bytes if "M" is attached to the |
||||
number. For example, |
||||
.B \-max 4m |
||||
selects 4000000 bytes. If more space is needed, temporary files will be used. |
||||
.TP |
||||
.BI \-outfile " name" |
||||
Send output image to the named file, not to standard output. |
||||
.TP |
||||
.B \-verbose |
||||
Enable debug printout. More |
||||
.BR \-v 's |
||||
give more output. Also, version information is printed at startup. |
||||
.TP |
||||
.B \-debug |
||||
Same as |
||||
.BR \-verbose . |
||||
.SH EXAMPLES |
||||
.LP |
||||
This example decompresses the JPEG file foo.jpg, quantizes it to |
||||
256 colors, and saves the output in 8-bit BMP format in foo.bmp: |
||||
.IP |
||||
.B djpeg \-colors 256 \-bmp |
||||
.I foo.jpg |
||||
.B > |
||||
.I foo.bmp |
||||
.SH HINTS |
||||
To get a quick preview of an image, use the |
||||
.B \-grayscale |
||||
and/or |
||||
.B \-scale |
||||
switches. |
||||
.B \-grayscale \-scale 1/8 |
||||
is the fastest case. |
||||
.PP |
||||
Several options are available that trade off image quality to gain speed. |
||||
.B \-fast |
||||
turns on the recommended settings. |
||||
.PP |
||||
.B \-dct fast |
||||
and/or |
||||
.B \-nosmooth |
||||
gain speed at a small sacrifice in quality. |
||||
When producing a color-quantized image, |
||||
.B \-onepass \-dither ordered |
||||
is fast but much lower quality than the default behavior. |
||||
.B \-dither none |
||||
may give acceptable results in two-pass mode, but is seldom tolerable in |
||||
one-pass mode. |
||||
.PP |
||||
If you are fortunate enough to have very fast floating point hardware, |
||||
\fB\-dct float\fR may be even faster than \fB\-dct fast\fR. But on most |
||||
machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is |
||||
not worth using, because its theoretical accuracy advantage is too small to be |
||||
significant in practice. |
||||
.SH ENVIRONMENT |
||||
.TP |
||||
.B JPEGMEM |
||||
If this environment variable is set, its value is the default memory limit. |
||||
The value is specified as described for the |
||||
.B \-maxmemory |
||||
switch. |
||||
.B JPEGMEM |
||||
overrides the default value specified when the program was compiled, and |
||||
itself is overridden by an explicit |
||||
.BR \-maxmemory . |
||||
.SH SEE ALSO |
||||
.BR cjpeg (1), |
||||
.BR jpegtran (1), |
||||
.BR rdjpgcom (1), |
||||
.BR wrjpgcom (1) |
||||
.br |
||||
.BR ppm (5), |
||||
.BR pgm (5) |
||||
.br |
||||
Wallace, Gregory K. "The JPEG Still Picture Compression Standard", |
||||
Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. |
||||
.SH AUTHOR |
||||
Independent JPEG Group |
||||
.SH BUGS |
||||
To avoid the Unisys LZW patent, |
||||
.B djpeg |
||||
produces uncompressed GIF files. These are larger than they should be, but |
||||
are readable by standard GIF decoders. |
@ -1,617 +0,0 @@
|
||||
/*
|
||||
* djpeg.c |
||||
* |
||||
* Copyright (C) 1991-1997, Thomas G. Lane. |
||||
* Modified 2009 by Guido Vollbeding. |
||||
* This file is part of the Independent JPEG Group's software. |
||||
* For conditions of distribution and use, see the accompanying README file. |
||||
* |
||||
* This file contains a command-line user interface for the JPEG decompressor. |
||||
* It should work on any system with Unix- or MS-DOS-style command lines. |
||||
* |
||||
* Two different command line styles are permitted, depending on the |
||||
* compile-time switch TWO_FILE_COMMANDLINE: |
||||
* djpeg [options] inputfile outputfile |
||||
* djpeg [options] [inputfile] |
||||
* In the second style, output is always to standard output, which you'd |
||||
* normally redirect to a file or pipe to some other program. Input is |
||||
* either from a named file or from standard input (typically redirected). |
||||
* The second style is convenient on Unix but is unhelpful on systems that |
||||
* don't support pipes. Also, you MUST use the first style if your system |
||||
* doesn't do binary I/O to stdin/stdout. |
||||
* To simplify script writing, the "-outfile" switch is provided. The syntax |
||||
* djpeg [options] -outfile outputfile inputfile |
||||
* works regardless of which command line style is used. |
||||
*/ |
||||
|
||||
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ |
||||
#include "jversion.h" /* for version message */ |
||||
|
||||
#include <ctype.h> /* to declare isprint() */ |
||||
|
||||
#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ |
||||
#ifdef __MWERKS__ |
||||
#include <SIOUX.h> /* Metrowerks needs this */ |
||||
#include <console.h> /* ... and this */ |
||||
#endif |
||||
#ifdef THINK_C |
||||
#include <console.h> /* Think declares it here */ |
||||
#endif |
||||
#endif |
||||
|
||||
|
||||
/* Create the add-on message string table. */ |
||||
|
||||
#define JMESSAGE(code,string) string , |
||||
|
||||
static const char * const cdjpeg_message_table[] = { |
||||
#include "cderror.h" |
||||
NULL |
||||
}; |
||||
|
||||
|
||||
/*
|
||||
* This list defines the known output image formats |
||||
* (not all of which need be supported by a given version). |
||||
* You can change the default output format by defining DEFAULT_FMT; |
||||
* indeed, you had better do so if you undefine PPM_SUPPORTED. |
||||
*/ |
||||
|
||||
typedef enum { |
||||
FMT_BMP, /* BMP format (Windows flavor) */ |
||||
FMT_GIF, /* GIF format */ |
||||
FMT_OS2, /* BMP format (OS/2 flavor) */ |
||||
FMT_PPM, /* PPM/PGM (PBMPLUS formats) */ |
||||
FMT_RLE, /* RLE format */ |
||||
FMT_TARGA, /* Targa format */ |
||||
FMT_TIFF /* TIFF format */ |
||||
} IMAGE_FORMATS; |
||||
|
||||
#ifndef DEFAULT_FMT /* so can override from CFLAGS in Makefile */ |
||||
#define DEFAULT_FMT FMT_PPM |
||||
#endif |
||||
|
||||
static IMAGE_FORMATS requested_fmt; |
||||
|
||||
|
||||
/*
|
||||
* Argument-parsing code. |
||||
* The switch parser is designed to be useful with DOS-style command line |
||||
* syntax, ie, intermixed switches and file names, where only the switches |
||||
* to the left of a given file name affect processing of that file. |
||||
* The main program in this file doesn't actually use this capability... |
||||
*/ |
||||
|
||||
|
||||
static const char * progname; /* program name for error messages */ |
||||
static char * outfilename; /* for -outfile switch */ |
||||
|
||||
|
||||
LOCAL(void) |
||||
usage (void) |
||||
/* complain about bad command line */ |
||||
{ |
||||
fprintf(stderr, "usage: %s [switches] ", progname); |
||||
#ifdef TWO_FILE_COMMANDLINE |
||||
fprintf(stderr, "inputfile outputfile\n"); |
||||
#else |
||||
fprintf(stderr, "[inputfile]\n"); |
||||
#endif |
||||
|
||||
fprintf(stderr, "Switches (names may be abbreviated):\n"); |
||||
fprintf(stderr, " -colors N Reduce image to no more than N colors\n"); |
||||
fprintf(stderr, " -fast Fast, low-quality processing\n"); |
||||
fprintf(stderr, " -grayscale Force grayscale output\n"); |
||||
#ifdef IDCT_SCALING_SUPPORTED |
||||
fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\n"); |
||||
#endif |
||||
#ifdef BMP_SUPPORTED |
||||
fprintf(stderr, " -bmp Select BMP output format (Windows style)%s\n", |
||||
(DEFAULT_FMT == FMT_BMP ? " (default)" : "")); |
||||
#endif |
||||
#ifdef GIF_SUPPORTED |
||||
fprintf(stderr, " -gif Select GIF output format%s\n", |
||||
(DEFAULT_FMT == FMT_GIF ? " (default)" : "")); |
||||
#endif |
||||
#ifdef BMP_SUPPORTED |
||||
fprintf(stderr, " -os2 Select BMP output format (OS/2 style)%s\n", |
||||
(DEFAULT_FMT == FMT_OS2 ? " (default)" : "")); |
||||
#endif |
||||
#ifdef PPM_SUPPORTED |
||||
fprintf(stderr, " -pnm Select PBMPLUS (PPM/PGM) output format%s\n", |
||||
(DEFAULT_FMT == FMT_PPM ? " (default)" : "")); |
||||
#endif |
||||
#ifdef RLE_SUPPORTED |
||||
fprintf(stderr, " -rle Select Utah RLE output format%s\n", |
||||
(DEFAULT_FMT == FMT_RLE ? " (default)" : "")); |
||||
#endif |
||||
#ifdef TARGA_SUPPORTED |
||||
fprintf(stderr, " -targa Select Targa output format%s\n", |
||||
(DEFAULT_FMT == FMT_TARGA ? " (default)" : "")); |
||||
#endif |
||||
fprintf(stderr, "Switches for advanced users:\n"); |
||||
#ifdef DCT_ISLOW_SUPPORTED |
||||
fprintf(stderr, " -dct int Use integer DCT method%s\n", |
||||
(JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : "")); |
||||
#endif |
||||
#ifdef DCT_IFAST_SUPPORTED |
||||
fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n", |
||||
(JDCT_DEFAULT == JDCT_IFAST ? " (default)" : "")); |
||||
#endif |
||||
#ifdef DCT_FLOAT_SUPPORTED |
||||
fprintf(stderr, " -dct float Use floating-point DCT method%s\n", |
||||
(JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : "")); |
||||
#endif |
||||
fprintf(stderr, " -dither fs Use F-S dithering (default)\n"); |
||||
fprintf(stderr, " -dither none Don't use dithering in quantization\n"); |
||||
fprintf(stderr, " -dither ordered Use ordered dither (medium speed, quality)\n"); |
||||
#ifdef QUANT_2PASS_SUPPORTED |
||||
fprintf(stderr, " -map FILE Map to colors used in named image file\n"); |
||||
#endif |
||||
fprintf(stderr, " -nosmooth Don't use high-quality upsampling\n"); |
||||
#ifdef QUANT_1PASS_SUPPORTED |
||||
fprintf(stderr, " -onepass Use 1-pass quantization (fast, low quality)\n"); |
||||
#endif |
||||
fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n"); |
||||
fprintf(stderr, " -outfile name Specify name for output file\n"); |
||||
fprintf(stderr, " -verbose or -debug Emit debug output\n"); |
||||
exit(EXIT_FAILURE); |
||||
} |
||||
|
||||
|
||||
LOCAL(int) |
||||
parse_switches (j_decompress_ptr cinfo, int argc, char **argv, |
||||
int last_file_arg_seen, boolean for_real) |
||||
/* Parse optional switches.
|
||||
* Returns argv[] index of first file-name argument (== argc if none). |
||||
* Any file names with indexes <= last_file_arg_seen are ignored; |
||||
* they have presumably been processed in a previous iteration. |
||||
* (Pass 0 for last_file_arg_seen on the first or only iteration.) |
||||
* for_real is FALSE on the first (dummy) pass; we may skip any expensive |
||||
* processing. |
||||
*/ |
||||
{ |
||||
int argn; |
||||
char * arg; |
||||
|
||||
/* Set up default JPEG parameters. */ |
||||
requested_fmt = DEFAULT_FMT; /* set default output file format */ |
||||
outfilename = NULL; |
||||
cinfo->err->trace_level = 0; |
||||
|
||||
/* Scan command line options, adjust parameters */ |
||||
|
||||
for (argn = 1; argn < argc; argn++) { |
||||
arg = argv[argn]; |
||||
if (*arg != '-') { |
||||
/* Not a switch, must be a file name argument */ |
||||
if (argn <= last_file_arg_seen) { |
||||
outfilename = NULL; /* -outfile applies to just one input file */ |
||||
continue; /* ignore this name if previously processed */ |
||||
} |
||||
break; /* else done parsing switches */ |
||||
} |
||||
arg++; /* advance past switch marker character */ |
||||
|
||||
if (keymatch(arg, "bmp", 1)) { |
||||
/* BMP output format. */ |
||||
requested_fmt = FMT_BMP; |
||||
|
||||
} else if (keymatch(arg, "colors", 1) || keymatch(arg, "colours", 1) || |
||||
keymatch(arg, "quantize", 1) || keymatch(arg, "quantise", 1)) { |
||||
/* Do color quantization. */ |
||||
int val; |
||||
|
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (sscanf(argv[argn], "%d", &val) != 1) |
||||
usage(); |
||||
cinfo->desired_number_of_colors = val; |
||||
cinfo->quantize_colors = TRUE; |
||||
|
||||
} else if (keymatch(arg, "dct", 2)) { |
||||
/* Select IDCT algorithm. */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (keymatch(argv[argn], "int", 1)) { |
||||
cinfo->dct_method = JDCT_ISLOW; |
||||
} else if (keymatch(argv[argn], "fast", 2)) { |
||||
cinfo->dct_method = JDCT_IFAST; |
||||
} else if (keymatch(argv[argn], "float", 2)) { |
||||
cinfo->dct_method = JDCT_FLOAT; |
||||
} else |
||||
usage(); |
||||
|
||||
} else if (keymatch(arg, "dither", 2)) { |
||||
/* Select dithering algorithm. */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (keymatch(argv[argn], "fs", 2)) { |
||||
cinfo->dither_mode = JDITHER_FS; |
||||
} else if (keymatch(argv[argn], "none", 2)) { |
||||
cinfo->dither_mode = JDITHER_NONE; |
||||
} else if (keymatch(argv[argn], "ordered", 2)) { |
||||
cinfo->dither_mode = JDITHER_ORDERED; |
||||
} else |
||||
usage(); |
||||
|
||||
} else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { |
||||
/* Enable debug printouts. */ |
||||
/* On first -d, print version identification */ |
||||
static boolean printed_version = FALSE; |
||||
|
||||
if (! printed_version) { |
||||
fprintf(stderr, "Independent JPEG Group's DJPEG, version %s\n%s\n", |
||||
JVERSION, JCOPYRIGHT); |
||||
printed_version = TRUE; |
||||
} |
||||
cinfo->err->trace_level++; |
||||
|
||||
} else if (keymatch(arg, "fast", 1)) { |
||||
/* Select recommended processing options for quick-and-dirty output. */ |
||||
cinfo->two_pass_quantize = FALSE; |
||||
cinfo->dither_mode = JDITHER_ORDERED; |
||||
if (! cinfo->quantize_colors) /* don't override an earlier -colors */ |
||||
cinfo->desired_number_of_colors = 216; |
||||
cinfo->dct_method = JDCT_FASTEST; |
||||
cinfo->do_fancy_upsampling = FALSE; |
||||
|
||||
} else if (keymatch(arg, "gif", 1)) { |
||||
/* GIF output format. */ |
||||
requested_fmt = FMT_GIF; |
||||
|
||||
} else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) { |
||||
/* Force monochrome output. */ |
||||
cinfo->out_color_space = JCS_GRAYSCALE; |
||||
|
||||
} else if (keymatch(arg, "map", 3)) { |
||||
/* Quantize to a color map taken from an input file. */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (for_real) { /* too expensive to do twice! */ |
||||
#ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */ |
||||
FILE * mapfile; |
||||
|
||||
if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) { |
||||
fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); |
||||
exit(EXIT_FAILURE); |
||||
} |
||||
read_color_map(cinfo, mapfile); |
||||
fclose(mapfile); |
||||
cinfo->quantize_colors = TRUE; |
||||
#else |
||||
ERREXIT(cinfo, JERR_NOT_COMPILED); |
||||
#endif |
||||
} |
||||
|
||||
} else if (keymatch(arg, "maxmemory", 3)) { |
||||
/* Maximum memory in Kb (or Mb with 'm'). */ |
||||
long lval; |
||||
char ch = 'x'; |
||||
|
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) |
||||
usage(); |
||||
if (ch == 'm' || ch == 'M') |
||||
lval *= 1000L; |
||||
cinfo->mem->max_memory_to_use = lval * 1000L; |
||||
|
||||
} else if (keymatch(arg, "nosmooth", 3)) { |
||||
/* Suppress fancy upsampling */ |
||||
cinfo->do_fancy_upsampling = FALSE; |
||||
|
||||
} else if (keymatch(arg, "onepass", 3)) { |
||||
/* Use fast one-pass quantization. */ |
||||
cinfo->two_pass_quantize = FALSE; |
||||
|
||||
} else if (keymatch(arg, "os2", 3)) { |
||||
/* BMP output format (OS/2 flavor). */ |
||||
requested_fmt = FMT_OS2; |
||||
|
||||
} else if (keymatch(arg, "outfile", 4)) { |
||||
/* Set output file name. */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
outfilename = argv[argn]; /* save it away for later use */ |
||||
|
||||
} else if (keymatch(arg, "pnm", 1) || keymatch(arg, "ppm", 1)) { |
||||
/* PPM/PGM output format. */ |
||||
requested_fmt = FMT_PPM; |
||||
|
||||
} else if (keymatch(arg, "rle", 1)) { |
||||
/* RLE output format. */ |
||||
requested_fmt = FMT_RLE; |
||||
|
||||
} else if (keymatch(arg, "scale", 1)) { |
||||
/* Scale the output image by a fraction M/N. */ |
||||
if (++argn >= argc) /* advance to next argument */ |
||||
usage(); |
||||
if (sscanf(argv[argn], "%d/%d", |
||||
&cinfo->scale_num, &cinfo->scale_denom) < 1) |
||||
usage(); |
||||
|
||||
} else if (keymatch(arg, "targa", 1)) { |
||||
/* Targa output format. */ |
||||
requested_fmt = FMT_TARGA; |
||||
|
||||
} else { |
||||
usage(); /* bogus switch */ |
||||
} |
||||
} |
||||
|
||||
return argn; /* return index of next arg (file name) */ |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Marker processor for COM and interesting APPn markers. |
||||
* This replaces the library's built-in processor, which just skips the marker. |
||||
* We want to print out the marker as text, to the extent possible. |
||||
* Note this code relies on a non-suspending data source. |
||||
*/ |
||||
|
||||
LOCAL(unsigned int) |
||||
jpeg_getc (j_decompress_ptr cinfo) |
||||
/* Read next byte */ |
||||
{ |
||||
struct jpeg_source_mgr * datasrc = cinfo->src; |
||||
|
||||
if (datasrc->bytes_in_buffer == 0) { |
||||
if (! (*datasrc->fill_input_buffer) (cinfo)) |
||||
ERREXIT(cinfo, JERR_CANT_SUSPEND); |
||||
} |
||||
datasrc->bytes_in_buffer--; |
||||
return GETJOCTET(*datasrc->next_input_byte++); |
||||
} |
||||
|
||||
|
||||
METHODDEF(boolean) |
||||
print_text_marker (j_decompress_ptr cinfo) |
||||
{ |
||||
boolean traceit = (cinfo->err->trace_level >= 1); |
||||
INT32 length; |
||||
unsigned int ch; |
||||
unsigned int lastch = 0; |
||||
|
||||
length = jpeg_getc(cinfo) << 8; |
||||
length += jpeg_getc(cinfo); |
||||
length -= 2; /* discount the length word itself */ |
||||
|
||||
if (traceit) { |
||||
if (cinfo->unread_marker == JPEG_COM) |
||||
fprintf(stderr, "Comment, length %ld:\n", (long) length); |
||||
else /* assume it is an APPn otherwise */ |
||||
fprintf(stderr, "APP%d, length %ld:\n", |
||||
cinfo->unread_marker - JPEG_APP0, (long) length); |
||||
} |
||||
|
||||
while (--length >= 0) { |
||||
ch = jpeg_getc(cinfo); |
||||
if (traceit) { |
||||
/* Emit the character in a readable form.
|
||||
* Nonprintables are converted to \nnn form, |
||||
* while \ is converted to \\. |
||||
* Newlines in CR, CR/LF, or LF form will be printed as one newline. |
||||
*/ |
||||
if (ch == '\r') { |
||||
fprintf(stderr, "\n"); |
||||
} else if (ch == '\n') { |
||||
if (lastch != '\r') |
||||
fprintf(stderr, "\n"); |
||||
} else if (ch == '\\') { |
||||
fprintf(stderr, "\\\\"); |
||||
} else if (isprint(ch)) { |
||||
putc(ch, stderr); |
||||
} else { |
||||
fprintf(stderr, "\\%03o", ch); |
||||
} |
||||
lastch = ch; |
||||
} |
||||
} |
||||
|
||||
if (traceit) |
||||
fprintf(stderr, "\n"); |
||||
|
||||
return TRUE; |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* The main program. |
||||
*/ |
||||
|
||||
int |
||||
main (int argc, char **argv) |
||||
{ |
||||
struct jpeg_decompress_struct cinfo; |
||||
struct jpeg_error_mgr jerr; |
||||
#ifdef PROGRESS_REPORT |
||||
struct cdjpeg_progress_mgr progress; |
||||
#endif |
||||
int file_index; |
||||
djpeg_dest_ptr dest_mgr = NULL; |
||||
FILE * input_file; |
||||
FILE * output_file; |
||||
JDIMENSION num_scanlines; |
||||
|
||||
/* On Mac, fetch a command line. */ |
||||
#ifdef USE_CCOMMAND |
||||
argc = ccommand(&argv); |
||||
#endif |
||||
|
||||
progname = argv[0]; |
||||
if (progname == NULL || progname[0] == 0) |
||||
progname = "djpeg"; /* in case C library doesn't provide it */ |
||||
|
||||
/* Initialize the JPEG decompression object with default error handling. */ |
||||
cinfo.err = jpeg_std_error(&jerr); |
||||
jpeg_create_decompress(&cinfo); |
||||
/* Add some application-specific error messages (from cderror.h) */ |
||||
jerr.addon_message_table = cdjpeg_message_table; |
||||
jerr.first_addon_message = JMSG_FIRSTADDONCODE; |
||||
jerr.last_addon_message = JMSG_LASTADDONCODE; |
||||
|
||||
/* Insert custom marker processor for COM and APP12.
|
||||
* APP12 is used by some digital camera makers for textual info, |
||||
* so we provide the ability to display it as text. |
||||
* If you like, additional APPn marker types can be selected for display, |
||||
* but don't try to override APP0 or APP14 this way (see libjpeg.doc). |
||||
*/ |
||||
jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker); |
||||
jpeg_set_marker_processor(&cinfo, JPEG_APP0+12, print_text_marker); |
||||
|
||||
/* Now safe to enable signal catcher. */ |
||||
#ifdef NEED_SIGNAL_CATCHER |
||||
enable_signal_catcher((j_common_ptr) &cinfo); |
||||
#endif |
||||
|
||||
/* Scan command line to find file names. */ |
||||
/* It is convenient to use just one switch-parsing routine, but the switch
|
||||
* values read here are ignored; we will rescan the switches after opening |
||||
* the input file. |
||||
* (Exception: tracing level set here controls verbosity for COM markers |
||||
* found during jpeg_read_header...) |
||||
*/ |
||||
|
||||
file_index = parse_switches(&cinfo, argc, argv, 0, FALSE); |
||||
|
||||
#ifdef TWO_FILE_COMMANDLINE |
||||
/* Must have either -outfile switch or explicit output file name */ |
||||
if (outfilename == NULL) { |
||||
if (file_index != argc-2) { |
||||
fprintf(stderr, "%s: must name one input and one output file\n", |
||||
progname); |
||||
usage(); |
||||
} |
||||
outfilename = argv[file_index+1]; |
||||
} else { |
||||
if (file_index != argc-1) { |
||||
fprintf(stderr, "%s: must name one input and one output file\n", |
||||
progname); |
||||
usage(); |
||||
} |
||||
} |
||||
#else |
||||
/* Unix style: expect zero or one file name */ |
||||
if (file_index < argc-1) { |
||||
fprintf(stderr, "%s: only one input file\n", progname); |
||||
usage(); |
||||
} |
||||
#endif /* TWO_FILE_COMMANDLINE */ |
||||
|
||||
/* Open the input file. */ |
||||
if (file_index < argc) { |
||||
if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) { |
||||
fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]); |
||||
exit(EXIT_FAILURE); |
||||
} |
||||
} else { |
||||
/* default input file is stdin */ |
||||
input_file = read_stdin(); |
||||
} |
||||
|
||||
/* Open the output file. */ |
||||
if (outfilename != NULL) { |
||||
if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) { |
||||
fprintf(stderr, "%s: can't open %s\n", progname, outfilename); |
||||
exit(EXIT_FAILURE); |
||||
} |
||||
} else { |
||||
/* default output file is stdout */ |
||||
output_file = write_stdout(); |
||||
} |
||||
|
||||
#ifdef PROGRESS_REPORT |
||||
start_progress_monitor((j_common_ptr) &cinfo, &progress); |
||||
#endif |
||||
|
||||
/* Specify data source for decompression */ |
||||
jpeg_stdio_src(&cinfo, input_file); |
||||
|
||||
/* Read file header, set default decompression parameters */ |
||||
(void) jpeg_read_header(&cinfo, TRUE); |
||||
|
||||
/* Adjust default decompression parameters by re-parsing the options */ |
||||
file_index = parse_switches(&cinfo, argc, argv, 0, TRUE); |
||||
|
||||
/* Initialize the output module now to let it override any crucial
|
||||
* option settings (for instance, GIF wants to force color quantization). |
||||
*/ |
||||
switch (requested_fmt) { |
||||
#ifdef BMP_SUPPORTED |
||||
case FMT_BMP: |
||||
dest_mgr = jinit_write_bmp(&cinfo, FALSE); |
||||
break; |
||||
case FMT_OS2: |
||||
dest_mgr = jinit_write_bmp(&cinfo, TRUE); |
||||
break; |
||||
#endif |
||||
#ifdef GIF_SUPPORTED |
||||
case FMT_GIF: |
||||
dest_mgr = jinit_write_gif(&cinfo); |
||||
break; |
||||
#endif |
||||
#ifdef PPM_SUPPORTED |
||||
case FMT_PPM: |
||||
dest_mgr = jinit_write_ppm(&cinfo); |
||||
break; |
||||
#endif |
||||
#ifdef RLE_SUPPORTED |
||||
case FMT_RLE: |
||||
dest_mgr = jinit_write_rle(&cinfo); |
||||
break; |
||||
#endif |
||||
#ifdef TARGA_SUPPORTED |
||||
case FMT_TARGA: |
||||
dest_mgr = jinit_write_targa(&cinfo); |
||||
break; |
||||
#endif |
||||
default: |
||||
ERREXIT(&cinfo, JERR_UNSUPPORTED_FORMAT); |
||||
break; |
||||
} |
||||
dest_mgr->output_file = output_file; |
||||
|
||||
/* Start decompressor */ |
||||
(void) jpeg_start_decompress(&cinfo); |
||||
|
||||
/* Write output file header */ |
||||
(*dest_mgr->start_output) (&cinfo, dest_mgr); |
||||
|
||||
/* Process data */ |
||||
while (cinfo.output_scanline < cinfo.output_height) { |
||||
num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer, |
||||
dest_mgr->buffer_height); |
||||
(*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines); |
||||
} |
||||
|
||||
#ifdef PROGRESS_REPORT |
||||
/* Hack: count final pass as done in case finish_output does an extra pass.
|
||||
* The library won't have updated completed_passes. |
||||
*/ |
||||
progress.pub.completed_passes = progress.pub.total_passes; |
||||
#endif |
||||
|
||||
/* Finish decompression and release memory.
|
||||
* I must do it in this order because output module has allocated memory |
||||
* of lifespan JPOOL_IMAGE; it needs to finish before releasing memory. |
||||
*/ |
||||
(*dest_mgr->finish_output) (&cinfo, dest_mgr); |
||||
(void) jpeg_finish_decompress(&cinfo); |
||||
jpeg_destroy_decompress(&cinfo); |
||||
|
||||
/* Close files, if we opened them */ |
||||
if (input_file != stdin) |
||||
fclose(input_file); |
||||
if (output_file != stdout) |
||||
fclose(output_file); |
||||
|
||||
#ifdef PROGRESS_REPORT |
||||
end_progress_monitor((j_common_ptr) &cinfo); |
||||
#endif |
||||
|
||||
/* All done. */ |
||||
exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS); |
||||
return 0; /* suppress no-return-value warnings */ |
||||
} |
@ -1,433 +0,0 @@
|
||||
/*
|
||||
* example.c |
||||
* |
||||
* This file illustrates how to use the IJG code as a subroutine library |
||||
* to read or write JPEG image files. You should look at this code in |
||||
* conjunction with the documentation file libjpeg.txt. |
||||
* |
||||
* This code will not do anything useful as-is, but it may be helpful as a |
||||
* skeleton for constructing routines that call the JPEG library.
|
||||
* |
||||
* We present these routines in the same coding style used in the JPEG code |
||||
* (ANSI function definitions, etc); but you are of course free to code your |
||||
* routines in a different style if you prefer. |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
|
||||
/*
|
||||
* Include file for users of JPEG library. |
||||
* You will need to have included system headers that define at least |
||||
* the typedefs FILE and size_t before you can include jpeglib.h. |
||||
* (stdio.h is sufficient on ANSI-conforming systems.) |
||||
* You may also wish to include "jerror.h". |
||||
*/ |
||||
|
||||
#include "jpeglib.h" |
||||
|
||||
/*
|
||||
* <setjmp.h> is used for the optional error recovery mechanism shown in |
||||
* the second part of the example. |
||||
*/ |
||||
|
||||
#include <setjmp.h> |
||||
|
||||
|
||||
|
||||
/******************** JPEG COMPRESSION SAMPLE INTERFACE *******************/ |
||||
|
||||
/* This half of the example shows how to feed data into the JPEG compressor.
|
||||
* We present a minimal version that does not worry about refinements such |
||||
* as error recovery (the JPEG code will just exit() if it gets an error). |
||||
*/ |
||||
|
||||
|
||||
/*
|
||||
* IMAGE DATA FORMATS: |
||||
* |
||||
* The standard input image format is a rectangular array of pixels, with |
||||
* each pixel having the same number of "component" values (color channels). |
||||
* Each pixel row is an array of JSAMPLEs (which typically are unsigned chars). |
||||
* If you are working with color data, then the color values for each pixel |
||||
* must be adjacent in the row; for example, R,G,B,R,G,B,R,G,B,... for 24-bit |
||||
* RGB color. |
||||
* |
||||
* For this example, we'll assume that this data structure matches the way |
||||
* our application has stored the image in memory, so we can just pass a |
||||
* pointer to our image buffer. In particular, let's say that the image is |
||||
* RGB color and is described by: |
||||
*/ |
||||
|
||||
extern JSAMPLE * image_buffer; /* Points to large array of R,G,B-order data */ |
||||
extern int image_height; /* Number of rows in image */ |
||||
extern int image_width; /* Number of columns in image */ |
||||
|
||||
|
||||
/*
|
||||
* Sample routine for JPEG compression. We assume that the target file name |
||||
* and a compression quality factor are passed in. |
||||
*/ |
||||
|
||||
GLOBAL(void) |
||||
write_JPEG_file (char * filename, int quality) |
||||
{ |
||||
/* This struct contains the JPEG compression parameters and pointers to
|
||||
* working space (which is allocated as needed by the JPEG library). |
||||
* It is possible to have several such structures, representing multiple |
||||
* compression/decompression processes, in existence at once. We refer |
||||
* to any one struct (and its associated working data) as a "JPEG object". |
||||
*/ |
||||
struct jpeg_compress_struct cinfo; |
||||
/* This struct represents a JPEG error handler. It is declared separately
|
||||
* because applications often want to supply a specialized error handler |
||||
* (see the second half of this file for an example). But here we just |
||||
* take the easy way out and use the standard error handler, which will |
||||
* print a message on stderr and call exit() if compression fails. |
||||
* Note that this struct must live as long as the main JPEG parameter |
||||
* struct, to avoid dangling-pointer problems. |
||||
*/ |
||||
struct jpeg_error_mgr jerr; |
||||
/* More stuff */ |
||||
FILE * outfile; /* target file */ |
||||
JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */ |
||||
int row_stride; /* physical row width in image buffer */ |
||||
|
||||
/* Step 1: allocate and initialize JPEG compression object */ |
||||
|
||||
/* We have to set up the error handler first, in case the initialization
|
||||
* step fails. (Unlikely, but it could happen if you are out of memory.) |
||||
* This routine fills in the contents of struct jerr, and returns jerr's |
||||
* address which we place into the link field in cinfo. |
||||
*/ |
||||
cinfo.err = jpeg_std_error(&jerr); |
||||
/* Now we can initialize the JPEG compression object. */ |
||||
jpeg_create_compress(&cinfo); |
||||
|
||||
/* Step 2: specify data destination (eg, a file) */ |
||||
/* Note: steps 2 and 3 can be done in either order. */ |
||||
|
||||
/* Here we use the library-supplied code to send compressed data to a
|
||||
* stdio stream. You can also write your own code to do something else. |
||||
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that |
||||
* requires it in order to write binary files. |
||||
*/ |
||||
if ((outfile = fopen(filename, "wb")) == NULL) { |
||||
fprintf(stderr, "can't open %s\n", filename); |
||||
exit(1); |
||||
} |
||||
jpeg_stdio_dest(&cinfo, outfile); |
||||
|
||||
/* Step 3: set parameters for compression */ |
||||
|
||||
/* First we supply a description of the input image.
|
||||
* Four fields of the cinfo struct must be filled in: |
||||
*/ |
||||
cinfo.image_width = image_width; /* image width and height, in pixels */ |
||||
cinfo.image_height = image_height; |
||||
cinfo.input_components = 3; /* # of color components per pixel */ |
||||
cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ |
||||
/* Now use the library's routine to set default compression parameters.
|
||||
* (You must set at least cinfo.in_color_space before calling this, |
||||
* since the defaults depend on the source color space.) |
||||
*/ |
||||
jpeg_set_defaults(&cinfo); |
||||
/* Now you can set any non-default parameters you wish to.
|
||||
* Here we just illustrate the use of quality (quantization table) scaling: |
||||
*/ |
||||
jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */); |
||||
|
||||
/* Step 4: Start compressor */ |
||||
|
||||
/* TRUE ensures that we will write a complete interchange-JPEG file.
|
||||
* Pass TRUE unless you are very sure of what you're doing. |
||||
*/ |
||||
jpeg_start_compress(&cinfo, TRUE); |
||||
|
||||
/* Step 5: while (scan lines remain to be written) */ |
||||
/* jpeg_write_scanlines(...); */ |
||||
|
||||
/* Here we use the library's state variable cinfo.next_scanline as the
|
||||
* loop counter, so that we don't have to keep track ourselves. |
||||
* To keep things simple, we pass one scanline per call; you can pass |
||||
* more if you wish, though. |
||||
*/ |
||||
row_stride = image_width * 3; /* JSAMPLEs per row in image_buffer */ |
||||
|
||||
while (cinfo.next_scanline < cinfo.image_height) { |
||||
/* jpeg_write_scanlines expects an array of pointers to scanlines.
|
||||
* Here the array is only one element long, but you could pass |
||||
* more than one scanline at a time if that's more convenient. |
||||
*/ |
||||
row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride]; |
||||
(void) jpeg_write_scanlines(&cinfo, row_pointer, 1); |
||||
} |
||||
|
||||
/* Step 6: Finish compression */ |
||||
|
||||
jpeg_finish_compress(&cinfo); |
||||
/* After finish_compress, we can close the output file. */ |
||||
fclose(outfile); |
||||
|
||||
/* Step 7: release JPEG compression object */ |
||||
|
||||
/* This is an important step since it will release a good deal of memory. */ |
||||
jpeg_destroy_compress(&cinfo); |
||||
|
||||
/* And we're done! */ |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* SOME FINE POINTS: |
||||
* |
||||
* In the above loop, we ignored the return value of jpeg_write_scanlines, |
||||
* which is the number of scanlines actually written. We could get away |
||||
* with this because we were only relying on the value of cinfo.next_scanline, |
||||
* which will be incremented correctly. If you maintain additional loop |
||||
* variables then you should be careful to increment them properly. |
||||
* Actually, for output to a stdio stream you needn't worry, because |
||||
* then jpeg_write_scanlines will write all the lines passed (or else exit |
||||
* with a fatal error). Partial writes can only occur if you use a data |
||||
* destination module that can demand suspension of the compressor. |
||||
* (If you don't know what that's for, you don't need it.) |
||||
* |
||||
* If the compressor requires full-image buffers (for entropy-coding |
||||
* optimization or a multi-scan JPEG file), it will create temporary |
||||
* files for anything that doesn't fit within the maximum-memory setting. |
||||
* (Note that temp files are NOT needed if you use the default parameters.) |
||||
* On some systems you may need to set up a signal handler to ensure that |
||||
* temporary files are deleted if the program is interrupted. See libjpeg.txt. |
||||
* |
||||
* Scanlines MUST be supplied in top-to-bottom order if you want your JPEG |
||||
* files to be compatible with everyone else's. If you cannot readily read |
||||
* your data in that order, you'll need an intermediate array to hold the |
||||
* image. See rdtarga.c or rdbmp.c for examples of handling bottom-to-top |
||||
* source data using the JPEG code's internal virtual-array mechanisms. |
||||
*/ |
||||
|
||||
|
||||
|
||||
/******************** JPEG DECOMPRESSION SAMPLE INTERFACE *******************/ |
||||
|
||||
/* This half of the example shows how to read data from the JPEG decompressor.
|
||||
* It's a bit more refined than the above, in that we show: |
||||
* (a) how to modify the JPEG library's standard error-reporting behavior; |
||||
* (b) how to allocate workspace using the library's memory manager. |
||||
* |
||||
* Just to make this example a little different from the first one, we'll |
||||
* assume that we do not intend to put the whole image into an in-memory |
||||
* buffer, but to send it line-by-line someplace else. We need a one- |
||||
* scanline-high JSAMPLE array as a work buffer, and we will let the JPEG |
||||
* memory manager allocate it for us. This approach is actually quite useful |
||||
* because we don't need to remember to deallocate the buffer separately: it |
||||
* will go away automatically when the JPEG object is cleaned up. |
||||
*/ |
||||
|
||||
|
||||
/*
|
||||
* ERROR HANDLING: |
||||
* |
||||
* The JPEG library's standard error handler (jerror.c) is divided into |
||||
* several "methods" which you can override individually. This lets you |
||||
* adjust the behavior without duplicating a lot of code, which you might |
||||
* have to update with each future release. |
||||
* |
||||
* Our example here shows how to override the "error_exit" method so that |
||||
* control is returned to the library's caller when a fatal error occurs, |
||||
* rather than calling exit() as the standard error_exit method does. |
||||
* |
||||
* We use C's setjmp/longjmp facility to return control. This means that the |
||||
* routine which calls the JPEG library must first execute a setjmp() call to |
||||
* establish the return point. We want the replacement error_exit to do a |
||||
* longjmp(). But we need to make the setjmp buffer accessible to the |
||||
* error_exit routine. To do this, we make a private extension of the |
||||
* standard JPEG error handler object. (If we were using C++, we'd say we |
||||
* were making a subclass of the regular error handler.) |
||||
* |
||||
* Here's the extended error handler struct: |
||||
*/ |
||||
|
||||
struct my_error_mgr { |
||||
struct jpeg_error_mgr pub; /* "public" fields */ |
||||
|
||||
jmp_buf setjmp_buffer; /* for return to caller */ |
||||
}; |
||||
|
||||
typedef struct my_error_mgr * my_error_ptr; |
||||
|
||||
/*
|
||||
* Here's the routine that will replace the standard error_exit method: |
||||
*/ |
||||
|
||||
METHODDEF(void) |
||||
my_error_exit (j_common_ptr cinfo) |
||||
{ |
||||
/* cinfo->err really points to a my_error_mgr struct, so coerce pointer */ |
||||
my_error_ptr myerr = (my_error_ptr) cinfo->err; |
||||
|
||||
/* Always display the message. */ |
||||
/* We could postpone this until after returning, if we chose. */ |
||||
(*cinfo->err->output_message) (cinfo); |
||||
|
||||
/* Return control to the setjmp point */ |
||||
longjmp(myerr->setjmp_buffer, 1); |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Sample routine for JPEG decompression. We assume that the source file name |
||||
* is passed in. We want to return 1 on success, 0 on error. |
||||
*/ |
||||
|
||||
|
||||
GLOBAL(int) |
||||
read_JPEG_file (char * filename) |
||||
{ |
||||
/* This struct contains the JPEG decompression parameters and pointers to
|
||||
* working space (which is allocated as needed by the JPEG library). |
||||
*/ |
||||
struct jpeg_decompress_struct cinfo; |
||||
/* We use our private extension JPEG error handler.
|
||||
* Note that this struct must live as long as the main JPEG parameter |
||||
* struct, to avoid dangling-pointer problems. |
||||
*/ |
||||
struct my_error_mgr jerr; |
||||
/* More stuff */ |
||||
FILE * infile; /* source file */ |
||||
JSAMPARRAY buffer; /* Output row buffer */ |
||||
int row_stride; /* physical row width in output buffer */ |
||||
|
||||
/* In this example we want to open the input file before doing anything else,
|
||||
* so that the setjmp() error recovery below can assume the file is open. |
||||
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that |
||||
* requires it in order to read binary files. |
||||
*/ |
||||
|
||||
if ((infile = fopen(filename, "rb")) == NULL) { |
||||
fprintf(stderr, "can't open %s\n", filename); |
||||
return 0; |
||||
} |
||||
|
||||
/* Step 1: allocate and initialize JPEG decompression object */ |
||||
|
||||
/* We set up the normal JPEG error routines, then override error_exit. */ |
||||
cinfo.err = jpeg_std_error(&jerr.pub); |
||||
jerr.pub.error_exit = my_error_exit; |
||||
/* Establish the setjmp return context for my_error_exit to use. */ |
||||
if (setjmp(jerr.setjmp_buffer)) { |
||||
/* If we get here, the JPEG code has signaled an error.
|
||||
* We need to clean up the JPEG object, close the input file, and return. |
||||
*/ |
||||
jpeg_destroy_decompress(&cinfo); |
||||
fclose(infile); |
||||
return 0; |
||||
} |
||||
/* Now we can initialize the JPEG decompression object. */ |
||||
jpeg_create_decompress(&cinfo); |
||||
|
||||
/* Step 2: specify data source (eg, a file) */ |
||||
|
||||
jpeg_stdio_src(&cinfo, infile); |
||||
|
||||
/* Step 3: read file parameters with jpeg_read_header() */ |
||||
|
||||
(void) jpeg_read_header(&cinfo, TRUE); |
||||
/* We can ignore the return value from jpeg_read_header since
|
||||
* (a) suspension is not possible with the stdio data source, and |
||||
* (b) we passed TRUE to reject a tables-only JPEG file as an error. |
||||
* See libjpeg.txt for more info. |
||||
*/ |
||||
|
||||
/* Step 4: set parameters for decompression */ |
||||
|
||||
/* In this example, we don't need to change any of the defaults set by
|
||||
* jpeg_read_header(), so we do nothing here. |
||||
*/ |
||||
|
||||
/* Step 5: Start decompressor */ |
||||
|
||||
(void) jpeg_start_decompress(&cinfo); |
||||
/* We can ignore the return value since suspension is not possible
|
||||
* with the stdio data source. |
||||
*/ |
||||
|
||||
/* We may need to do some setup of our own at this point before reading
|
||||
* the data. After jpeg_start_decompress() we have the correct scaled |
||||
* output image dimensions available, as well as the output colormap |
||||
* if we asked for color quantization. |
||||
* In this example, we need to make an output work buffer of the right size. |
||||
*/
|
||||
/* JSAMPLEs per row in output buffer */ |
||||
row_stride = cinfo.output_width * cinfo.output_components; |
||||
/* Make a one-row-high sample array that will go away when done with image */ |
||||
buffer = (*cinfo.mem->alloc_sarray) |
||||
((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1); |
||||
|
||||
/* Step 6: while (scan lines remain to be read) */ |
||||
/* jpeg_read_scanlines(...); */ |
||||
|
||||
/* Here we use the library's state variable cinfo.output_scanline as the
|
||||
* loop counter, so that we don't have to keep track ourselves. |
||||
*/ |
||||
while (cinfo.output_scanline < cinfo.output_height) { |
||||
/* jpeg_read_scanlines expects an array of pointers to scanlines.
|
||||
* Here the array is only one element long, but you could ask for |
||||
* more than one scanline at a time if that's more convenient. |
||||
*/ |
||||
(void) jpeg_read_scanlines(&cinfo, buffer, 1); |
||||
/* Assume put_scanline_someplace wants a pointer and sample count. */ |
||||
put_scanline_someplace(buffer[0], row_stride); |
||||
} |
||||
|
||||
/* Step 7: Finish decompression */ |
||||
|
||||
(void) jpeg_finish_decompress(&cinfo); |
||||
/* We can ignore the return value since suspension is not possible
|
||||
* with the stdio data source. |
||||
*/ |
||||
|
||||
/* Step 8: Release JPEG decompression object */ |
||||
|
||||
/* This is an important step since it will release a good deal of memory. */ |
||||
jpeg_destroy_decompress(&cinfo); |
||||
|
||||
/* After finish_decompress, we can close the input file.
|
||||
* Here we postpone it until after no more JPEG errors are possible, |
||||
* so as to simplify the setjmp error logic above. (Actually, I don't |
||||
* think that jpeg_destroy can do an error exit, but why assume anything...) |
||||
*/ |
||||
fclose(infile); |
||||
|
||||
/* At this point you may want to check to see whether any corrupt-data
|
||||
* warnings occurred (test whether jerr.pub.num_warnings is nonzero). |
||||
*/ |
||||
|
||||
/* And we're done! */ |
||||
return 1; |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* SOME FINE POINTS: |
||||
* |
||||
* In the above code, we ignored the return value of jpeg_read_scanlines, |
||||
* which is the number of scanlines actually read. We could get away with |
||||
* this because we asked for only one line at a time and we weren't using |
||||
* a suspending data source. See libjpeg.txt for more info. |
||||
* |
||||
* We cheated a bit by calling alloc_sarray() after jpeg_start_decompress(); |
||||
* we should have done it beforehand to ensure that the space would be |
||||
* counted against the JPEG max_memory setting. In some systems the above |
||||
* code would risk an out-of-memory error. However, in general we don't |
||||
* know the output image dimensions before jpeg_start_decompress(), unless we |
||||
* call jpeg_calc_output_dimensions(). See libjpeg.txt for more about this. |
||||
* |
||||
* Scanlines are returned in the same order as they appear in the JPEG file, |
||||
* which is standardly top-to-bottom. If you must emit data bottom-to-top, |
||||
* you can use one of the virtual arrays provided by the JPEG memory manager |
||||
* to invert the data. See wrbmp.c for an example. |
||||
* |
||||
* As with compression, some operating modes may require temporary files. |
||||
* On some systems you may need to set up a signal handler to ensure that |
||||
* temporary files are deleted if the program is interrupted. See libjpeg.txt. |
||||
*/ |
@ -1,215 +0,0 @@
|
||||
IJG JPEG LIBRARY: FILE LIST |
||||
|
||||
Copyright (C) 1994-2009, Thomas G. Lane, Guido Vollbeding. |
||||
This file is part of the Independent JPEG Group's software. |
||||
For conditions of distribution and use, see the accompanying README file. |
||||
|
||||
|
||||
Here is a road map to the files in the IJG JPEG distribution. The |
||||
distribution includes the JPEG library proper, plus two application |
||||
programs ("cjpeg" and "djpeg") which use the library to convert JPEG |
||||
files to and from some other popular image formats. A third application |
||||
"jpegtran" uses the library to do lossless conversion between different |
||||
variants of JPEG. There are also two stand-alone applications, |
||||
"rdjpgcom" and "wrjpgcom". |
||||
|
||||
|
||||
THE JPEG LIBRARY |
||||
================ |
||||
|
||||
Include files: |
||||
|
||||
jpeglib.h JPEG library's exported data and function declarations. |
||||
jconfig.h Configuration declarations. Note: this file is not present |
||||
in the distribution; it is generated during installation. |
||||
jmorecfg.h Additional configuration declarations; need not be changed |
||||
for a standard installation. |
||||
jerror.h Declares JPEG library's error and trace message codes. |
||||
jinclude.h Central include file used by all IJG .c files to reference |
||||
system include files. |
||||
jpegint.h JPEG library's internal data structures. |
||||
jdct.h Private declarations for forward & reverse DCT subsystems. |
||||
jmemsys.h Private declarations for memory management subsystem. |
||||
jversion.h Version information. |
||||
|
||||
Applications using the library should include jpeglib.h (which in turn |
||||
includes jconfig.h and jmorecfg.h). Optionally, jerror.h may be included |
||||
if the application needs to reference individual JPEG error codes. The |
||||
other include files are intended for internal use and would not normally |
||||
be included by an application program. (cjpeg/djpeg/etc do use jinclude.h, |
||||
since its function is to improve portability of the whole IJG distribution. |
||||
Most other applications will directly include the system include files they |
||||
want, and hence won't need jinclude.h.) |
||||
|
||||
|
||||
C source code files: |
||||
|
||||
These files contain most of the functions intended to be called directly by |
||||
an application program: |
||||
|
||||
jcapimin.c Application program interface: core routines for compression. |
||||
jcapistd.c Application program interface: standard compression. |
||||
jdapimin.c Application program interface: core routines for decompression. |
||||
jdapistd.c Application program interface: standard decompression. |
||||
jcomapi.c Application program interface routines common to compression |
||||
and decompression. |
||||
jcparam.c Compression parameter setting helper routines. |
||||
jctrans.c API and library routines for transcoding compression. |
||||
jdtrans.c API and library routines for transcoding decompression. |
||||
|
||||
Compression side of the library: |
||||
|
||||
jcinit.c Initialization: determines which other modules to use. |
||||
jcmaster.c Master control: setup and inter-pass sequencing logic. |
||||
jcmainct.c Main buffer controller (preprocessor => JPEG compressor). |
||||
jcprepct.c Preprocessor buffer controller. |
||||
jccoefct.c Buffer controller for DCT coefficient buffer. |
||||
jccolor.c Color space conversion. |
||||
jcsample.c Downsampling. |
||||
jcdctmgr.c DCT manager (DCT implementation selection & control). |
||||
jfdctint.c Forward DCT using slow-but-accurate integer method. |
||||
jfdctfst.c Forward DCT using faster, less accurate integer method. |
||||
jfdctflt.c Forward DCT using floating-point arithmetic. |
||||
jchuff.c Huffman entropy coding. |
||||
jcarith.c Arithmetic entropy coding. |
||||
jcmarker.c JPEG marker writing. |
||||
jdatadst.c Data destination managers for memory and stdio output. |
||||
|
||||
Decompression side of the library: |
||||
|
||||
jdmaster.c Master control: determines which other modules to use. |
||||
jdinput.c Input controller: controls input processing modules. |
||||
jdmainct.c Main buffer controller (JPEG decompressor => postprocessor). |
||||
jdcoefct.c Buffer controller for DCT coefficient buffer. |
||||
jdpostct.c Postprocessor buffer controller. |
||||
jdmarker.c JPEG marker reading. |
||||
jdhuff.c Huffman entropy decoding. |
||||
jdarith.c Arithmetic entropy decoding. |
||||
jddctmgr.c IDCT manager (IDCT implementation selection & control). |
||||
jidctint.c Inverse DCT using slow-but-accurate integer method. |
||||
jidctfst.c Inverse DCT using faster, less accurate integer method. |
||||
jidctflt.c Inverse DCT using floating-point arithmetic. |
||||
jdsample.c Upsampling. |
||||
jdcolor.c Color space conversion. |
||||
jdmerge.c Merged upsampling/color conversion (faster, lower quality). |
||||
jquant1.c One-pass color quantization using a fixed-spacing colormap. |
||||
jquant2.c Two-pass color quantization using a custom-generated colormap. |
||||
Also handles one-pass quantization to an externally given map. |
||||
jdatasrc.c Data source managers for memory and stdio input. |
||||
|
||||
Support files for both compression and decompression: |
||||
|
||||
jaricom.c Tables for common use in arithmetic entropy encoding and |
||||
decoding routines. |
||||
jerror.c Standard error handling routines (application replaceable). |
||||
jmemmgr.c System-independent (more or less) memory management code. |
||||
jutils.c Miscellaneous utility routines. |
||||
|
||||
jmemmgr.c relies on a system-dependent memory management module. The IJG |
||||
distribution includes the following implementations of the system-dependent |
||||
module: |
||||
|
||||
jmemnobs.c "No backing store": assumes adequate virtual memory exists. |
||||
jmemansi.c Makes temporary files with ANSI-standard routine tmpfile(). |
||||
jmemname.c Makes temporary files with program-generated file names. |
||||
jmemdos.c Custom implementation for MS-DOS (16-bit environment only): |
||||
can use extended and expanded memory as well as temp files. |
||||
jmemmac.c Custom implementation for Apple Macintosh. |
||||
|
||||
Exactly one of the system-dependent modules should be configured into an |
||||
installed JPEG library (see install.txt for hints about which one to use). |
||||
On unusual systems you may find it worthwhile to make a special |
||||
system-dependent memory manager. |
||||
|
||||
|
||||
Non-C source code files: |
||||
|
||||
jmemdosa.asm 80x86 assembly code support for jmemdos.c; used only in |
||||
MS-DOS-specific configurations of the JPEG library. |
||||
|
||||
|
||||
CJPEG/DJPEG/JPEGTRAN |
||||
==================== |
||||
|
||||
Include files: |
||||
|
||||
cdjpeg.h Declarations shared by cjpeg/djpeg/jpegtran modules. |
||||
cderror.h Additional error and trace message codes for cjpeg et al. |
||||
transupp.h Declarations for jpegtran support routines in transupp.c. |
||||
|
||||
C source code files: |
||||
|
||||
cjpeg.c Main program for cjpeg. |
||||
djpeg.c Main program for djpeg. |
||||
jpegtran.c Main program for jpegtran. |
||||
cdjpeg.c Utility routines used by all three programs. |
||||
rdcolmap.c Code to read a colormap file for djpeg's "-map" switch. |
||||
rdswitch.c Code to process some of cjpeg's more complex switches. |
||||
Also used by jpegtran. |
||||
transupp.c Support code for jpegtran: lossless image manipulations. |
||||
|
||||
Image file reader modules for cjpeg: |
||||
|
||||
rdbmp.c BMP file input. |
||||
rdgif.c GIF file input (now just a stub). |
||||
rdppm.c PPM/PGM file input. |
||||
rdrle.c Utah RLE file input. |
||||
rdtarga.c Targa file input. |
||||
|
||||
Image file writer modules for djpeg: |
||||
|
||||
wrbmp.c BMP file output. |
||||
wrgif.c GIF file output (a mere shadow of its former self). |
||||
wrppm.c PPM/PGM file output. |
||||
wrrle.c Utah RLE file output. |
||||
wrtarga.c Targa file output. |
||||
|
||||
|
||||
RDJPGCOM/WRJPGCOM |
||||
================= |
||||
|
||||
C source code files: |
||||
|
||||
rdjpgcom.c Stand-alone rdjpgcom application. |
||||
wrjpgcom.c Stand-alone wrjpgcom application. |
||||
|
||||
These programs do not depend on the IJG library. They do use |
||||
jconfig.h and jinclude.h, only to improve portability. |
||||
|
||||
|
||||
ADDITIONAL FILES |
||||
================ |
||||
|
||||
Documentation (see README for a guide to the documentation files): |
||||
|
||||
README Master documentation file. |
||||
*.txt Other documentation files. |
||||
*.1 Documentation in Unix man page format. |
||||
change.log Version-to-version change highlights. |
||||
example.c Sample code for calling JPEG library. |
||||
|
||||
Configuration/installation files and programs (see install.txt for more info): |
||||
|
||||
configure Unix shell script to perform automatic configuration. |
||||
configure.ac Source file for use with Autoconf to generate configure. |
||||
ltmain.sh Support scripts for configure (from GNU libtool). |
||||
config.guess |
||||
config.sub |
||||
depcomp |
||||
missing |
||||
install-sh Install shell script for those Unix systems lacking one. |
||||
Makefile.in Makefile input for configure. |
||||
Makefile.am Source file for use with Automake to generate Makefile.in. |
||||
ckconfig.c Program to generate jconfig.h on non-Unix systems. |
||||
jconfig.txt Template for making jconfig.h by hand. |
||||
mak*.* Sample makefiles for particular systems. |
||||
jconfig.* Sample jconfig.h for particular systems. |
||||
libjpeg.map Script to generate shared library with versioned symbols. |
||||
aclocal.m4 M4 macro definitions for use with Autoconf. |
||||
ansi2knr.c De-ANSIfier for pre-ANSI C compilers (courtesy of |
||||
L. Peter Deutsch and Aladdin Enterprises). |
||||
|
||||
Test files (see install.txt for test procedure): |
||||
|
||||
test*.* Source and comparison files for confidence test. |
||||
These are binary image files, NOT text files. |
@ -1,520 +0,0 @@
|
||||
#!/bin/sh |
||||
# install - install a program, script, or datafile |
||||
|
||||
scriptversion=2009-04-28.21; # UTC |
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was |
||||
# later released in X11R6 (xc/config/util/install.sh) with the |
||||
# following copyright and license. |
||||
# |
||||
# Copyright (C) 1994 X Consortium |
||||
# |
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
# of this software and associated documentation files (the "Software"), to |
||||
# deal in the Software without restriction, including without limitation the |
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
||||
# sell copies of the Software, and to permit persons to whom the Software is |
||||
# furnished to do so, subject to the following conditions: |
||||
# |
||||
# The above copyright notice and this permission notice shall be included in |
||||
# all copies or substantial portions of the Software. |
||||
# |
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- |
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||||
# |
||||
# Except as contained in this notice, the name of the X Consortium shall not |
||||
# be used in advertising or otherwise to promote the sale, use or other deal- |
||||
# ings in this Software without prior written authorization from the X Consor- |
||||
# tium. |
||||
# |
||||
# |
||||
# FSF changes to this file are in the public domain. |
||||
# |
||||
# Calling this script install-sh is preferred over install.sh, to prevent |
||||
# `make' implicit rules from creating a file called install from it |
||||
# when there is no Makefile. |
||||
# |
||||
# This script is compatible with the BSD install script, but was written |
||||
# from scratch. |
||||
|
||||
nl=' |
||||
' |
||||
IFS=" "" $nl" |
||||
|
||||
# set DOITPROG to echo to test this script |
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it. |
||||
doit=${DOITPROG-} |
||||
if test -z "$doit"; then |
||||
doit_exec=exec |
||||
else |
||||
doit_exec=$doit |
||||
fi |
||||
|
||||
# Put in absolute file names if you don't have them in your path; |
||||
# or use environment vars. |
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp} |
||||
chmodprog=${CHMODPROG-chmod} |
||||
chownprog=${CHOWNPROG-chown} |
||||
cmpprog=${CMPPROG-cmp} |
||||
cpprog=${CPPROG-cp} |
||||
mkdirprog=${MKDIRPROG-mkdir} |
||||
mvprog=${MVPROG-mv} |
||||
rmprog=${RMPROG-rm} |
||||
stripprog=${STRIPPROG-strip} |
||||
|
||||
posix_glob='?' |
||||
initialize_posix_glob=' |
||||
test "$posix_glob" != "?" || { |
||||
if (set -f) 2>/dev/null; then |
||||
posix_glob= |
||||
else |
||||
posix_glob=: |
||||
fi |
||||
} |
||||
' |
||||
|
||||
posix_mkdir= |
||||
|
||||
# Desired mode of installed file. |
||||
mode=0755 |
||||
|
||||
chgrpcmd= |
||||
chmodcmd=$chmodprog |
||||
chowncmd= |
||||
mvcmd=$mvprog |
||||
rmcmd="$rmprog -f" |
||||
stripcmd= |
||||
|
||||
src= |
||||
dst= |
||||
dir_arg= |
||||
dst_arg= |
||||
|
||||
copy_on_change=false |
||||
no_target_directory= |
||||
|
||||
usage="\ |
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE |
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY |
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES... |
||||
or: $0 [OPTION]... -d DIRECTORIES... |
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE. |
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. |
||||
In the 4th, create DIRECTORIES. |
||||
|
||||
Options: |
||||
--help display this help and exit. |
||||
--version display version info and exit. |
||||
|
||||
-c (ignored) |
||||
-C install only if different (preserve the last data modification time) |
||||
-d create directories instead of installing files. |
||||
-g GROUP $chgrpprog installed files to GROUP. |
||||
-m MODE $chmodprog installed files to MODE. |
||||
-o USER $chownprog installed files to USER. |
||||
-s $stripprog installed files. |
||||
-t DIRECTORY install into DIRECTORY. |
||||
-T report an error if DSTFILE is a directory. |
||||
|
||||
Environment variables override the default commands: |
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG |
||||
RMPROG STRIPPROG |
||||
" |
||||
|
||||
while test $# -ne 0; do |
||||
case $1 in |
||||
-c) ;; |
||||
|
||||
-C) copy_on_change=true;; |
||||
|
||||
-d) dir_arg=true;; |
||||
|
||||
-g) chgrpcmd="$chgrpprog $2" |
||||
shift;; |
||||
|
||||
--help) echo "$usage"; exit $?;; |
||||
|
||||
-m) mode=$2 |
||||
case $mode in |
||||
*' '* | *' '* | *' |
||||
'* | *'*'* | *'?'* | *'['*) |
||||
echo "$0: invalid mode: $mode" >&2 |
||||
exit 1;; |
||||
esac |
||||
shift;; |
||||
|
||||
-o) chowncmd="$chownprog $2" |
||||
shift;; |
||||
|
||||
-s) stripcmd=$stripprog;; |
||||
|
||||
-t) dst_arg=$2 |
||||
shift;; |
||||
|
||||
-T) no_target_directory=true;; |
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;; |
||||
|
||||
--) shift |
||||
break;; |
||||
|
||||
-*) echo "$0: invalid option: $1" >&2 |
||||
exit 1;; |
||||
|
||||
*) break;; |
||||
esac |
||||
shift |
||||
done |
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then |
||||
# When -d is used, all remaining arguments are directories to create. |
||||
# When -t is used, the destination is already specified. |
||||
# Otherwise, the last argument is the destination. Remove it from $@. |
||||
for arg |
||||
do |
||||
if test -n "$dst_arg"; then |
||||
# $@ is not empty: it contains at least $arg. |
||||
set fnord "$@" "$dst_arg" |
||||
shift # fnord |
||||
fi |
||||
shift # arg |
||||
dst_arg=$arg |
||||
done |
||||
fi |
||||
|
||||
if test $# -eq 0; then |
||||
if test -z "$dir_arg"; then |
||||
echo "$0: no input file specified." >&2 |
||||
exit 1 |
||||
fi |
||||
# It's OK to call `install-sh -d' without argument. |
||||
# This can happen when creating conditional directories. |
||||
exit 0 |
||||
fi |
||||
|
||||
if test -z "$dir_arg"; then |
||||
trap '(exit $?); exit' 1 2 13 15 |
||||
|
||||
# Set umask so as not to create temps with too-generous modes. |
||||
# However, 'strip' requires both read and write access to temps. |
||||
case $mode in |
||||
# Optimize common cases. |
||||
*644) cp_umask=133;; |
||||
*755) cp_umask=22;; |
||||
|
||||
*[0-7]) |
||||
if test -z "$stripcmd"; then |
||||
u_plus_rw= |
||||
else |
||||
u_plus_rw='% 200' |
||||
fi |
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; |
||||
*) |
||||
if test -z "$stripcmd"; then |
||||
u_plus_rw= |
||||
else |
||||
u_plus_rw=,u+rw |
||||
fi |
||||
cp_umask=$mode$u_plus_rw;; |
||||
esac |
||||
fi |
||||
|
||||
for src |
||||
do |
||||
# Protect names starting with `-'. |
||||
case $src in |
||||
-*) src=./$src;; |
||||
esac |
||||
|
||||
if test -n "$dir_arg"; then |
||||
dst=$src |
||||
dstdir=$dst |
||||
test -d "$dstdir" |
||||
dstdir_status=$? |
||||
else |
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command |
||||
# might cause directories to be created, which would be especially bad |
||||
# if $src (and thus $dsttmp) contains '*'. |
||||
if test ! -f "$src" && test ! -d "$src"; then |
||||
echo "$0: $src does not exist." >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
if test -z "$dst_arg"; then |
||||
echo "$0: no destination specified." >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
dst=$dst_arg |
||||
# Protect names starting with `-'. |
||||
case $dst in |
||||
-*) dst=./$dst;; |
||||
esac |
||||
|
||||
# If destination is a directory, append the input filename; won't work |
||||
# if double slashes aren't ignored. |
||||
if test -d "$dst"; then |
||||
if test -n "$no_target_directory"; then |
||||
echo "$0: $dst_arg: Is a directory" >&2 |
||||
exit 1 |
||||
fi |
||||
dstdir=$dst |
||||
dst=$dstdir/`basename "$src"` |
||||
dstdir_status=0 |
||||
else |
||||
# Prefer dirname, but fall back on a substitute if dirname fails. |
||||
dstdir=` |
||||
(dirname "$dst") 2>/dev/null || |
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ |
||||
X"$dst" : 'X\(//\)[^/]' \| \ |
||||
X"$dst" : 'X\(//\)$' \| \ |
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null || |
||||
echo X"$dst" | |
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ |
||||
s//\1/ |
||||
q |
||||
} |
||||
/^X\(\/\/\)[^/].*/{ |
||||
s//\1/ |
||||
q |
||||
} |
||||
/^X\(\/\/\)$/{ |
||||
s//\1/ |
||||
q |
||||
} |
||||
/^X\(\/\).*/{ |
||||
s//\1/ |
||||
q |
||||
} |
||||
s/.*/./; q' |
||||
` |
||||
|
||||
test -d "$dstdir" |
||||
dstdir_status=$? |
||||
fi |
||||
fi |
||||
|
||||
obsolete_mkdir_used=false |
||||
|
||||
if test $dstdir_status != 0; then |
||||
case $posix_mkdir in |
||||
'') |
||||
# Create intermediate dirs using mode 755 as modified by the umask. |
||||
# This is like FreeBSD 'install' as of 1997-10-28. |
||||
umask=`umask` |
||||
case $stripcmd.$umask in |
||||
# Optimize common cases. |
||||
*[2367][2367]) mkdir_umask=$umask;; |
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; |
||||
|
||||
*[0-7]) |
||||
mkdir_umask=`expr $umask + 22 \ |
||||
- $umask % 100 % 40 + $umask % 20 \ |
||||
- $umask % 10 % 4 + $umask % 2 |
||||
`;; |
||||
*) mkdir_umask=$umask,go-w;; |
||||
esac |
||||
|
||||
# With -d, create the new directory with the user-specified mode. |
||||
# Otherwise, rely on $mkdir_umask. |
||||
if test -n "$dir_arg"; then |
||||
mkdir_mode=-m$mode |
||||
else |
||||
mkdir_mode= |
||||
fi |
||||
|
||||
posix_mkdir=false |
||||
case $umask in |
||||
*[123567][0-7][0-7]) |
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which |
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0. |
||||
;; |
||||
*) |
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ |
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 |
||||
|
||||
if (umask $mkdir_umask && |
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 |
||||
then |
||||
if test -z "$dir_arg" || { |
||||
# Check for POSIX incompatibilities with -m. |
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or |
||||
# other-writeable bit of parent directory when it shouldn't. |
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory. |
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"` |
||||
case $ls_ld_tmpdir in |
||||
d????-?r-*) different_mode=700;; |
||||
d????-?--*) different_mode=755;; |
||||
*) false;; |
||||
esac && |
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && { |
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"` |
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" |
||||
} |
||||
} |
||||
then posix_mkdir=: |
||||
fi |
||||
rmdir "$tmpdir/d" "$tmpdir" |
||||
else |
||||
# Remove any dirs left behind by ancient mkdir implementations. |
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null |
||||
fi |
||||
trap '' 0;; |
||||
esac;; |
||||
esac |
||||
|
||||
if |
||||
$posix_mkdir && ( |
||||
umask $mkdir_umask && |
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" |
||||
) |
||||
then : |
||||
else |
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX, |
||||
# or it failed possibly due to a race condition. Create the |
||||
# directory the slow way, step by step, checking for races as we go. |
||||
|
||||
case $dstdir in |
||||
/*) prefix='/';; |
||||
-*) prefix='./';; |
||||
*) prefix='';; |
||||
esac |
||||
|
||||
eval "$initialize_posix_glob" |
||||
|
||||
oIFS=$IFS |
||||
IFS=/ |
||||
$posix_glob set -f |
||||
set fnord $dstdir |
||||
shift |
||||
$posix_glob set +f |
||||
IFS=$oIFS |
||||
|
||||
prefixes= |
||||
|
||||
for d |
||||
do |
||||
test -z "$d" && continue |
||||
|
||||
prefix=$prefix$d |
||||
if test -d "$prefix"; then |
||||
prefixes= |
||||
else |
||||
if $posix_mkdir; then |
||||
(umask=$mkdir_umask && |
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break |
||||
# Don't fail if two instances are running concurrently. |
||||
test -d "$prefix" || exit 1 |
||||
else |
||||
case $prefix in |
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; |
||||
*) qprefix=$prefix;; |
||||
esac |
||||
prefixes="$prefixes '$qprefix'" |
||||
fi |
||||
fi |
||||
prefix=$prefix/ |
||||
done |
||||
|
||||
if test -n "$prefixes"; then |
||||
# Don't fail if two instances are running concurrently. |
||||
(umask $mkdir_umask && |
||||
eval "\$doit_exec \$mkdirprog $prefixes") || |
||||
test -d "$dstdir" || exit 1 |
||||
obsolete_mkdir_used=true |
||||
fi |
||||
fi |
||||
fi |
||||
|
||||
if test -n "$dir_arg"; then |
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } && |
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && |
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || |
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 |
||||
else |
||||
|
||||
# Make a couple of temp file names in the proper directory. |
||||
dsttmp=$dstdir/_inst.$$_ |
||||
rmtmp=$dstdir/_rm.$$_ |
||||
|
||||
# Trap to clean up those temp files at exit. |
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 |
||||
|
||||
# Copy the file name to the temp name. |
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && |
||||
|
||||
# and set any options; do chmod last to preserve setuid bits. |
||||
# |
||||
# If any of these fail, we abort the whole thing. If we want to |
||||
# ignore errors from any of these, just make sure not to ignore |
||||
# errors from the above "$doit $cpprog $src $dsttmp" command. |
||||
# |
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && |
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && |
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && |
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && |
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file. |
||||
if $copy_on_change && |
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && |
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && |
||||
|
||||
eval "$initialize_posix_glob" && |
||||
$posix_glob set -f && |
||||
set X $old && old=:$2:$4:$5:$6 && |
||||
set X $new && new=:$2:$4:$5:$6 && |
||||
$posix_glob set +f && |
||||
|
||||
test "$old" = "$new" && |
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 |
||||
then |
||||
rm -f "$dsttmp" |
||||
else |
||||
# Rename the file to the real destination. |
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || |
||||
|
||||
# The rename failed, perhaps because mv can't rename something else |
||||
# to itself, or perhaps because mv is so ancient that it does not |
||||
# support -f. |
||||
{ |
||||
# Now remove or move aside any old file at destination location. |
||||
# We try this two ways since rm can't unlink itself on some |
||||
# systems and the destination file might be busy for other |
||||
# reasons. In this case, the final cleanup might fail but the new |
||||
# file should still install successfully. |
||||
{ |
||||
test ! -f "$dst" || |
||||
$doit $rmcmd -f "$dst" 2>/dev/null || |
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && |
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } |
||||
} || |
||||
{ echo "$0: cannot unlink or rename $dst" >&2 |
||||
(exit 1); exit 1 |
||||
} |
||||
} && |
||||
|
||||
# Now rename the file to the real destination. |
||||
$doit $mvcmd "$dsttmp" "$dst" |
||||
} |
||||
fi || exit 1 |
||||
|
||||
trap '' 0 |
||||
fi |
||||
done |
||||
|
||||
# Local variables: |
||||
# eval: (add-hook 'write-file-hooks 'time-stamp) |
||||
# time-stamp-start: "scriptversion=" |
||||
# time-stamp-format: "%:y-%02m-%02d.%02H" |
||||
# time-stamp-time-zone: "UTC" |
||||
# time-stamp-end: "; # UTC" |
||||
# End: |
File diff suppressed because it is too large
Load Diff
@ -1,153 +0,0 @@
|
||||
/*
|
||||
* jaricom.c |
||||
* |
||||
* Developed 1997-2009 by Guido Vollbeding. |
||||
* This file is part of the Independent JPEG Group's software. |
||||
* For conditions of distribution and use, see the accompanying README file. |
||||
* |
||||
* This file contains probability estimation tables for common use in |
||||
* arithmetic entropy encoding and decoding routines. |
||||
* |
||||
* This data represents Table D.2 in the JPEG spec (ISO/IEC IS 10918-1 |
||||
* and CCITT Recommendation ITU-T T.81) and Table 24 in the JBIG spec |
||||
* (ISO/IEC IS 11544 and CCITT Recommendation ITU-T T.82). |
||||
*/ |
||||
|
||||
#define JPEG_INTERNALS |
||||
#include "jinclude.h" |
||||
#include "jpeglib.h" |
||||
|
||||
/* The following #define specifies the packing of the four components
|
||||
* into the compact INT32 representation. |
||||
* Note that this formula must match the actual arithmetic encoder |
||||
* and decoder implementation. The implementation has to be changed |
||||
* if this formula is changed. |
||||
* The current organization is leaned on Markus Kuhn's JBIG |
||||
* implementation (jbig_tab.c). |
||||
*/ |
||||
|
||||
#define V(i,a,b,c,d) (((INT32)a << 16) | ((INT32)c << 8) | ((INT32)d << 7) | b) |
||||
|
||||
const INT32 jpeg_aritab[113+1] = { |
||||
/*
|
||||
* Index, Qe_Value, Next_Index_LPS, Next_Index_MPS, Switch_MPS |
||||
*/ |
||||
V( 0, 0x5a1d, 1, 1, 1 ), |
||||
V( 1, 0x2586, 14, 2, 0 ), |
||||
V( 2, 0x1114, 16, 3, 0 ), |
||||
V( 3, 0x080b, 18, 4, 0 ), |
||||
V( 4, 0x03d8, 20, 5, 0 ), |
||||
V( 5, 0x01da, 23, 6, 0 ), |
||||
V( 6, 0x00e5, 25, 7, 0 ), |
||||
V( 7, 0x006f, 28, 8, 0 ), |
||||
V( 8, 0x0036, 30, 9, 0 ), |
||||
V( 9, 0x001a, 33, 10, 0 ), |
||||
V( 10, 0x000d, 35, 11, 0 ), |
||||
V( 11, 0x0006, 9, 12, 0 ), |
||||
V( 12, 0x0003, 10, 13, 0 ), |
||||
V( 13, 0x0001, 12, 13, 0 ), |
||||
V( 14, 0x5a7f, 15, 15, 1 ), |
||||
V( 15, 0x3f25, 36, 16, 0 ), |
||||
V( 16, 0x2cf2, 38, 17, 0 ), |
||||
V( 17, 0x207c, 39, 18, 0 ), |
||||
V( 18, 0x17b9, 40, 19, 0 ), |
||||
V( 19, 0x1182, 42, 20, 0 ), |
||||
V( 20, 0x0cef, 43, 21, 0 ), |
||||
V( 21, 0x09a1, 45, 22, 0 ), |
||||
V( 22, 0x072f, 46, 23, 0 ), |
||||
V( 23, 0x055c, 48, 24, 0 ), |
||||
V( 24, 0x0406, 49, 25, 0 ), |
||||
V( 25, 0x0303, 51, 26, 0 ), |
||||
V( 26, 0x0240, 52, 27, 0 ), |
||||
V( 27, 0x01b1, 54, 28, 0 ), |
||||
V( 28, 0x0144, 56, 29, 0 ), |
||||
V( 29, 0x00f5, 57, 30, 0 ), |
||||
V( 30, 0x00b7, 59, 31, 0 ), |
||||
V( 31, 0x008a, 60, 32, 0 ), |
||||
V( 32, 0x0068, 62, 33, 0 ), |
||||
V( 33, 0x004e, 63, 34, 0 ), |
||||
V( 34, 0x003b, 32, 35, 0 ), |
||||
V( 35, 0x002c, 33, 9, 0 ), |
||||
V( 36, 0x5ae1, 37, 37, 1 ), |
||||
V( 37, 0x484c, 64, 38, 0 ), |
||||
V( 38, 0x3a0d, 65, 39, 0 ), |
||||
V( 39, 0x2ef1, 67, 40, 0 ), |
||||
V( 40, 0x261f, 68, 41, 0 ), |
||||
V( 41, 0x1f33, 69, 42, 0 ), |
||||
V( 42, 0x19a8, 70, 43, 0 ), |
||||
V( 43, 0x1518, 72, 44, 0 ), |
||||
V( 44, 0x1177, 73, 45, 0 ), |
||||
V( 45, 0x0e74, 74, 46, 0 ), |
||||
V( 46, 0x0bfb, 75, 47, 0 ), |
||||
V( 47, 0x09f8, 77, 48, 0 ), |
||||
V( 48, 0x0861, 78, 49, 0 ), |
||||
V( 49, 0x0706, 79, 50, 0 ), |
||||
V( 50, 0x05cd, 48, 51, 0 ), |
||||
V( 51, 0x04de, 50, 52, 0 ), |
||||
V( 52, 0x040f, 50, 53, 0 ), |
||||
V( 53, 0x0363, 51, 54, 0 ), |
||||
V( 54, 0x02d4, 52, 55, 0 ), |
||||
V( 55, 0x025c, 53, 56, 0 ), |
||||
V( 56, 0x01f8, 54, 57, 0 ), |
||||
V( 57, 0x01a4, 55, 58, 0 ), |
||||
V( 58, 0x0160, 56, 59, 0 ), |
||||
V( 59, 0x0125, 57, 60, 0 ), |
||||
V( 60, 0x00f6, 58, 61, 0 ), |
||||
V( 61, 0x00cb, 59, 62, 0 ), |
||||
V( 62, 0x00ab, 61, 63, 0 ), |
||||
V( 63, 0x008f, 61, 32, 0 ), |
||||
V( 64, 0x5b12, 65, 65, 1 ), |
||||
V( 65, 0x4d04, 80, 66, 0 ), |
||||
V( 66, 0x412c, 81, 67, 0 ), |
||||
V( 67, 0x37d8, 82, 68, 0 ), |
||||
V( 68, 0x2fe8, 83, 69, 0 ), |
||||
V( 69, 0x293c, 84, 70, 0 ), |
||||
V( 70, 0x2379, 86, 71, 0 ), |
||||
V( 71, 0x1edf, 87, 72, 0 ), |
||||
V( 72, 0x1aa9, 87, 73, 0 ), |
||||
V( 73, 0x174e, 72, 74, 0 ), |
||||
V( 74, 0x1424, 72, 75, 0 ), |
||||
V( 75, 0x119c, 74, 76, 0 ), |
||||
V( 76, 0x0f6b, 74, 77, 0 ), |
||||
V( 77, 0x0d51, 75, 78, 0 ), |
||||
V( 78, 0x0bb6, 77, 79, 0 ), |
||||
V( 79, 0x0a40, 77, 48, 0 ), |
||||
V( 80, 0x5832, 80, 81, 1 ), |
||||
V( 81, 0x4d1c, 88, 82, 0 ), |
||||
V( 82, 0x438e, 89, 83, 0 ), |
||||
V( 83, 0x3bdd, 90, 84, 0 ), |
||||
V( 84, 0x34ee, 91, 85, 0 ), |
||||
V( 85, 0x2eae, 92, 86, 0 ), |
||||
V( 86, 0x299a, 93, 87, 0 ), |
||||
V( 87, 0x2516, 86, 71, 0 ), |
||||
V( 88, 0x5570, 88, 89, 1 ), |
||||
V( 89, 0x4ca9, 95, 90, 0 ), |
||||
V( 90, 0x44d9, 96, 91, 0 ), |
||||
V( 91, 0x3e22, 97, 92, 0 ), |
||||
V( 92, 0x3824, 99, 93, 0 ), |
||||
V( 93, 0x32b4, 99, 94, 0 ), |
||||
V( 94, 0x2e17, 93, 86, 0 ), |
||||
V( 95, 0x56a8, 95, 96, 1 ), |
||||
V( 96, 0x4f46, 101, 97, 0 ), |
||||
V( 97, 0x47e5, 102, 98, 0 ), |
||||
V( 98, 0x41cf, 103, 99, 0 ), |
||||
V( 99, 0x3c3d, 104, 100, 0 ), |
||||
V( 100, 0x375e, 99, 93, 0 ), |
||||
V( 101, 0x5231, 105, 102, 0 ), |
||||
V( 102, 0x4c0f, 106, 103, 0 ), |
||||
V( 103, 0x4639, 107, 104, 0 ), |
||||
V( 104, 0x415e, 103, 99, 0 ), |
||||
V( 105, 0x5627, 105, 106, 1 ), |
||||
V( 106, 0x50e7, 108, 107, 0 ), |
||||
V( 107, 0x4b85, 109, 103, 0 ), |
||||
V( 108, 0x5597, 110, 109, 0 ), |
||||
V( 109, 0x504f, 111, 107, 0 ), |
||||
V( 110, 0x5a10, 110, 111, 1 ), |
||||
V( 111, 0x5522, 112, 109, 0 ), |
||||
V( 112, 0x59eb, 112, 111, 1 ), |
||||
/*
|
||||
* This last entry is used for fixed probability estimate of 0.5 |
||||
* as recommended in Section 10.3 Table 5 of ITU-T Rec. T.851. |
||||
*/ |
||||
V( 113, 0x5a1d, 113, 113, 0 ) |
||||
}; |
@ -1,288 +0,0 @@
|
||||
/*
|
||||
* jcapimin.c |
||||
* |
||||
* Copyright (C) 1994-1998, Thomas G. Lane. |
||||
* Modified 2003-2010 by Guido Vollbeding. |
||||
* This file is part of the Independent JPEG Group's software. |
||||
* For conditions of distribution and use, see the accompanying README file. |
||||
* |
||||
* This file contains application interface code for the compression half |
||||
* of the JPEG library. These are the "minimum" API routines that may be |
||||
* needed in either the normal full-compression case or the transcoding-only |
||||
* case. |
||||
* |
||||
* Most of the routines intended to be called directly by an application |
||||
* are in this file or in jcapistd.c. But also see jcparam.c for |
||||
* parameter-setup helper routines, jcomapi.c for routines shared by |
||||
* compression and decompression, and jctrans.c for the transcoding case. |
||||
*/ |
||||
|
||||
#define JPEG_INTERNALS |
||||
#include "jinclude.h" |
||||
#include "jpeglib.h" |
||||
|
||||
|
||||
/*
|
||||
* Initialization of a JPEG compression object. |
||||
* The error manager must already be set up (in case memory manager fails). |
||||
*/ |
||||
|
||||
GLOBAL(void) |
||||
jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) |
||||
{ |
||||
int i; |
||||
|
||||
/* Guard against version mismatches between library and caller. */ |
||||
cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ |
||||
if (version != JPEG_LIB_VERSION) |
||||
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); |
||||
if (structsize != SIZEOF(struct jpeg_compress_struct)) |
||||
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
|
||||
(int) SIZEOF(struct jpeg_compress_struct), (int) structsize); |
||||
|
||||
/* For debugging purposes, we zero the whole master structure.
|
||||
* But the application has already set the err pointer, and may have set |
||||
* client_data, so we have to save and restore those fields. |
||||
* Note: if application hasn't set client_data, tools like Purify may |
||||
* complain here. |
||||
*/ |
||||
{ |
||||
struct jpeg_error_mgr * err = cinfo->err; |
||||
void * client_data = cinfo->client_data; /* ignore Purify complaint here */ |
||||
MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct)); |
||||
cinfo->err = err; |
||||
cinfo->client_data = client_data; |
||||
} |
||||
cinfo->is_decompressor = FALSE; |
||||
|
||||
/* Initialize a memory manager instance for this object */ |
||||
jinit_memory_mgr((j_common_ptr) cinfo); |
||||
|
||||
/* Zero out pointers to permanent structures. */ |
||||
cinfo->progress = NULL; |
||||
cinfo->dest = NULL; |
||||
|
||||
cinfo->comp_info = NULL; |
||||
|
||||
for (i = 0; i < NUM_QUANT_TBLS; i++) { |
||||
cinfo->quant_tbl_ptrs[i] = NULL; |
||||
cinfo->q_scale_factor[i] = 100; |
||||
} |
||||
|
||||
for (i = 0; i < NUM_HUFF_TBLS; i++) { |
||||
cinfo->dc_huff_tbl_ptrs[i] = NULL; |
||||
cinfo->ac_huff_tbl_ptrs[i] = NULL; |
||||
} |
||||
|
||||
/* Must do it here for emit_dqt in case jpeg_write_tables is used */ |
||||
cinfo->block_size = DCTSIZE; |
||||
cinfo->natural_order = jpeg_natural_order; |
||||
cinfo->lim_Se = DCTSIZE2-1; |
||||
|
||||
cinfo->script_space = NULL; |
||||
|
||||
cinfo->input_gamma = 1.0; /* in case application forgets */ |
||||
|
||||
/* OK, I'm ready */ |
||||
cinfo->global_state = CSTATE_START; |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Destruction of a JPEG compression object |
||||
*/ |
||||
|
||||
GLOBAL(void) |
||||
jpeg_destroy_compress (j_compress_ptr cinfo) |
||||
{ |
||||
jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Abort processing of a JPEG compression operation, |
||||
* but don't destroy the object itself. |
||||
*/ |
||||
|
||||
GLOBAL(void) |
||||
jpeg_abort_compress (j_compress_ptr cinfo) |
||||
{ |
||||
jpeg_abort((j_common_ptr) cinfo); /* use common routine */ |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Forcibly suppress or un-suppress all quantization and Huffman tables. |
||||
* Marks all currently defined tables as already written (if suppress) |
||||
* or not written (if !suppress). This will control whether they get emitted |
||||
* by a subsequent jpeg_start_compress call. |
||||
* |
||||
* This routine is exported for use by applications that want to produce |
||||
* abbreviated JPEG datastreams. It logically belongs in jcparam.c, but |
||||
* since it is called by jpeg_start_compress, we put it here --- otherwise |
||||
* jcparam.o would be linked whether the application used it or not. |
||||
*/ |
||||
|
||||
GLOBAL(void) |
||||
jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress) |
||||
{ |
||||
int i; |
||||
JQUANT_TBL * qtbl; |
||||
JHUFF_TBL * htbl; |
||||
|
||||
for (i = 0; i < NUM_QUANT_TBLS; i++) { |
||||
if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL) |
||||
qtbl->sent_table = suppress; |
||||
} |
||||
|
||||
for (i = 0; i < NUM_HUFF_TBLS; i++) { |
||||
if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL) |
||||
htbl->sent_table = suppress; |
||||
if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL) |
||||
htbl->sent_table = suppress; |
||||
} |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Finish JPEG compression. |
||||
* |
||||
* If a multipass operating mode was selected, this may do a great deal of |
||||
* work including most of the actual output. |
||||
*/ |
||||
|
||||
GLOBAL(void) |
||||
jpeg_finish_compress (j_compress_ptr cinfo) |
||||
{ |
||||
JDIMENSION iMCU_row; |
||||
|
||||
if (cinfo->global_state == CSTATE_SCANNING || |
||||
cinfo->global_state == CSTATE_RAW_OK) { |
||||
/* Terminate first pass */ |
||||
if (cinfo->next_scanline < cinfo->image_height) |
||||
ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); |
||||
(*cinfo->master->finish_pass) (cinfo); |
||||
} else if (cinfo->global_state != CSTATE_WRCOEFS) |
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
||||
/* Perform any remaining passes */ |
||||
while (! cinfo->master->is_last_pass) { |
||||
(*cinfo->master->prepare_for_pass) (cinfo); |
||||
for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) { |
||||
if (cinfo->progress != NULL) { |
||||
cinfo->progress->pass_counter = (long) iMCU_row; |
||||
cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows; |
||||
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); |
||||
} |
||||
/* We bypass the main controller and invoke coef controller directly;
|
||||
* all work is being done from the coefficient buffer. |
||||
*/ |
||||
if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL)) |
||||
ERREXIT(cinfo, JERR_CANT_SUSPEND); |
||||
} |
||||
(*cinfo->master->finish_pass) (cinfo); |
||||
} |
||||
/* Write EOI, do final cleanup */ |
||||
(*cinfo->marker->write_file_trailer) (cinfo); |
||||
(*cinfo->dest->term_destination) (cinfo); |
||||
/* We can use jpeg_abort to release memory and reset global_state */ |
||||
jpeg_abort((j_common_ptr) cinfo); |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Write a special marker. |
||||
* This is only recommended for writing COM or APPn markers. |
||||
* Must be called after jpeg_start_compress() and before |
||||
* first call to jpeg_write_scanlines() or jpeg_write_raw_data(). |
||||
*/ |
||||
|
||||
GLOBAL(void) |
||||
jpeg_write_marker (j_compress_ptr cinfo, int marker, |
||||
const JOCTET *dataptr, unsigned int datalen) |
||||
{ |
||||
JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val)); |
||||
|
||||
if (cinfo->next_scanline != 0 || |
||||
(cinfo->global_state != CSTATE_SCANNING && |
||||
cinfo->global_state != CSTATE_RAW_OK && |
||||
cinfo->global_state != CSTATE_WRCOEFS)) |
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
||||
|
||||
(*cinfo->marker->write_marker_header) (cinfo, marker, datalen); |
||||
write_marker_byte = cinfo->marker->write_marker_byte; /* copy for speed */ |
||||
while (datalen--) { |
||||
(*write_marker_byte) (cinfo, *dataptr); |
||||
dataptr++; |
||||
} |
||||
} |
||||
|
||||
/* Same, but piecemeal. */ |
||||
|
||||
GLOBAL(void) |
||||
jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen) |
||||
{ |
||||
if (cinfo->next_scanline != 0 || |
||||
(cinfo->global_state != CSTATE_SCANNING && |
||||
cinfo->global_state != CSTATE_RAW_OK && |
||||
cinfo->global_state != CSTATE_WRCOEFS)) |
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
||||
|
||||
(*cinfo->marker->write_marker_header) (cinfo, marker, datalen); |
||||
} |
||||
|
||||
GLOBAL(void) |
||||
jpeg_write_m_byte (j_compress_ptr cinfo, int val) |
||||
{ |
||||
(*cinfo->marker->write_marker_byte) (cinfo, val); |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Alternate compression function: just write an abbreviated table file. |
||||
* Before calling this, all parameters and a data destination must be set up. |
||||
* |
||||
* To produce a pair of files containing abbreviated tables and abbreviated |
||||
* image data, one would proceed as follows: |
||||
* |
||||
* initialize JPEG object |
||||
* set JPEG parameters |
||||
* set destination to table file |
||||
* jpeg_write_tables(cinfo); |
||||
* set destination to image file |
||||
* jpeg_start_compress(cinfo, FALSE); |
||||
* write data... |
||||
* jpeg_finish_compress(cinfo); |
||||
* |
||||
* jpeg_write_tables has the side effect of marking all tables written |
||||
* (same as jpeg_suppress_tables(..., TRUE)). Thus a subsequent start_compress |
||||
* will not re-emit the tables unless it is passed write_all_tables=TRUE. |
||||
*/ |
||||
|
||||
GLOBAL(void) |
||||
jpeg_write_tables (j_compress_ptr cinfo) |
||||
{ |
||||
if (cinfo->global_state != CSTATE_START) |
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
||||
|
||||
/* (Re)initialize error mgr and destination modules */ |
||||
(*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); |
||||
(*cinfo->dest->init_destination) (cinfo); |
||||
/* Initialize the marker writer ... bit of a crock to do it here. */ |
||||
jinit_marker_writer(cinfo); |
||||
/* Write them tables! */ |
||||
(*cinfo->marker->write_tables_only) (cinfo); |
||||
/* And clean up. */ |
||||
(*cinfo->dest->term_destination) (cinfo); |
||||
/*
|
||||
* In library releases up through v6a, we called jpeg_abort() here to free |
||||
* any working memory allocated by the destination manager and marker |
||||
* writer. Some applications had a problem with that: they allocated space |
||||
* of their own from the library memory manager, and didn't want it to go |
||||
* away during write_tables. So now we do nothing. This will cause a |
||||
* memory leak if an app calls write_tables repeatedly without doing a full |
||||
* compression cycle or otherwise resetting the JPEG object. However, that |
||||
* seems less bad than unexpectedly freeing memory in the normal case. |
||||
* An app that prefers the old behavior can call jpeg_abort for itself after |
||||
* each call to jpeg_write_tables(). |
||||
*/ |
||||
} |
@ -1,161 +0,0 @@
|
||||
/*
|
||||
* jcapistd.c |
||||
* |
||||
* Copyright (C) 1994-1996, Thomas G. Lane. |
||||
* This file is part of the Independent JPEG Group's software. |
||||
* For conditions of distribution and use, see the accompanying README file. |
||||
* |
||||
* This file contains application interface code for the compression half |
||||
* of the JPEG library. These are the "standard" API routines that are |
||||
* used in the normal full-compression case. They are not used by a |
||||
* transcoding-only application. Note that if an application links in |
||||
* jpeg_start_compress, it will end up linking in the entire compressor. |
||||
* We thus must separate this file from jcapimin.c to avoid linking the |
||||
* whole compression library into a transcoder. |
||||
*/ |
||||
|
||||
#define JPEG_INTERNALS |
||||
#include "jinclude.h" |
||||
#include "jpeglib.h" |
||||
|
||||
|
||||
/*
|
||||
* Compression initialization. |
||||
* Before calling this, all parameters and a data destination must be set up. |
||||
* |
||||
* We require a write_all_tables parameter as a failsafe check when writing |
||||
* multiple datastreams from the same compression object. Since prior runs |
||||
* will have left all the tables marked sent_table=TRUE, a subsequent run |
||||
* would emit an abbreviated stream (no tables) by default. This may be what |
||||
* is wanted, but for safety's sake it should not be the default behavior: |
||||
* programmers should have to make a deliberate choice to emit abbreviated |
||||
* images. Therefore the documentation and examples should encourage people |
||||
* to pass write_all_tables=TRUE; then it will take active thought to do the |
||||
* wrong thing. |
||||
*/ |
||||
|
||||
GLOBAL(void) |
||||
jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables) |
||||
{ |
||||
if (cinfo->global_state != CSTATE_START) |
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
||||
|
||||
if (write_all_tables) |
||||
jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */ |
||||
|
||||
/* (Re)initialize error mgr and destination modules */ |
||||
(*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); |
||||
(*cinfo->dest->init_destination) (cinfo); |
||||
/* Perform master selection of active modules */ |
||||
jinit_compress_master(cinfo); |
||||
/* Set up for the first pass */ |
||||
(*cinfo->master->prepare_for_pass) (cinfo); |
||||
/* Ready for application to drive first pass through jpeg_write_scanlines
|
||||
* or jpeg_write_raw_data. |
||||
*/ |
||||
cinfo->next_scanline = 0; |
||||
cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING); |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Write some scanlines of data to the JPEG compressor. |
||||
* |
||||
* The return value will be the number of lines actually written. |
||||
* This should be less than the supplied num_lines only in case that |
||||
* the data destination module has requested suspension of the compressor, |
||||
* or if more than image_height scanlines are passed in. |
||||
* |
||||
* Note: we warn about excess calls to jpeg_write_scanlines() since |
||||
* this likely signals an application programmer error. However, |
||||
* excess scanlines passed in the last valid call are *silently* ignored, |
||||
* so that the application need not adjust num_lines for end-of-image |
||||
* when using a multiple-scanline buffer. |
||||
*/ |
||||
|
||||
GLOBAL(JDIMENSION) |
||||
jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, |
||||
JDIMENSION num_lines) |
||||
{ |
||||
JDIMENSION row_ctr, rows_left; |
||||
|
||||
if (cinfo->global_state != CSTATE_SCANNING) |
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
||||
if (cinfo->next_scanline >= cinfo->image_height) |
||||
WARNMS(cinfo, JWRN_TOO_MUCH_DATA); |
||||
|
||||
/* Call progress monitor hook if present */ |
||||
if (cinfo->progress != NULL) { |
||||
cinfo->progress->pass_counter = (long) cinfo->next_scanline; |
||||
cinfo->progress->pass_limit = (long) cinfo->image_height; |
||||
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); |
||||
} |
||||
|
||||
/* Give master control module another chance if this is first call to
|
||||
* jpeg_write_scanlines. This lets output of the frame/scan headers be |
||||
* delayed so that application can write COM, etc, markers between |
||||
* jpeg_start_compress and jpeg_write_scanlines. |
||||
*/ |
||||
if (cinfo->master->call_pass_startup) |
||||
(*cinfo->master->pass_startup) (cinfo); |
||||
|
||||
/* Ignore any extra scanlines at bottom of image. */ |
||||
rows_left = cinfo->image_height - cinfo->next_scanline; |
||||
if (num_lines > rows_left) |
||||
num_lines = rows_left; |
||||
|
||||
row_ctr = 0; |
||||
(*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines); |
||||
cinfo->next_scanline += row_ctr; |
||||
return row_ctr; |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Alternate entry point to write raw data. |
||||
* Processes exactly one iMCU row per call, unless suspended. |
||||
*/ |
||||
|
||||
GLOBAL(JDIMENSION) |
||||
jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, |
||||
JDIMENSION num_lines) |
||||
{ |
||||
JDIMENSION lines_per_iMCU_row; |
||||
|
||||
if (cinfo->global_state != CSTATE_RAW_OK) |
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
||||
if (cinfo->next_scanline >= cinfo->image_height) { |
||||
WARNMS(cinfo, JWRN_TOO_MUCH_DATA); |
||||
return 0; |
||||
} |
||||
|
||||
/* Call progress monitor hook if present */ |
||||
if (cinfo->progress != NULL) { |
||||
cinfo->progress->pass_counter = (long) cinfo->next_scanline; |
||||
cinfo->progress->pass_limit = (long) cinfo->image_height; |
||||
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); |
||||
} |
||||
|
||||
/* Give master control module another chance if this is first call to
|
||||
* jpeg_write_raw_data. This lets output of the frame/scan headers be |
||||
* delayed so that application can write COM, etc, markers between |
||||
* jpeg_start_compress and jpeg_write_raw_data. |
||||
*/ |
||||
if (cinfo->master->call_pass_startup) |
||||
(*cinfo->master->pass_startup) (cinfo); |
||||
|
||||
/* Verify that at least one iMCU row has been passed. */ |
||||
lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE; |
||||
if (num_lines < lines_per_iMCU_row) |
||||
ERREXIT(cinfo, JERR_BUFFER_SIZE); |
||||
|
||||
/* Directly compress the row. */ |
||||
if (! (*cinfo->coef->compress_data) (cinfo, data)) { |
||||
/* If compressor did not consume the whole row, suspend processing. */ |
||||
return 0; |
||||
} |
||||
|
||||
/* OK, we processed one iMCU row. */ |
||||
cinfo->next_scanline += lines_per_iMCU_row; |
||||
return lines_per_iMCU_row; |
||||
} |
@ -1,934 +0,0 @@
|
||||
/*
|
||||
* jcarith.c |
||||
* |
||||
* Developed 1997-2009 by Guido Vollbeding. |
||||
* This file is part of the Independent JPEG Group's software. |
||||
* For conditions of distribution and use, see the accompanying README file. |
||||
* |
||||
* This file contains portable arithmetic entropy encoding routines for JPEG |
||||
* (implementing the ISO/IEC IS 10918-1 and CCITT Recommendation ITU-T T.81). |
||||
* |
||||
* Both sequential and progressive modes are supported in this single module. |
||||
* |
||||
* Suspension is not currently supported in this module. |
||||
*/ |
||||
|
||||
#define JPEG_INTERNALS |
||||
#include "jinclude.h" |
||||
#include "jpeglib.h" |
||||
|
||||
|
||||
/* Expanded entropy encoder object for arithmetic encoding. */ |
||||
|
||||
typedef struct { |
||||
struct jpeg_entropy_encoder pub; /* public fields */ |
||||
|
||||
INT32 c; /* C register, base of coding interval, layout as in sec. D.1.3 */ |
||||
INT32 a; /* A register, normalized size of coding interval */ |
||||
INT32 sc; /* counter for stacked 0xFF values which might overflow */ |
||||
INT32 zc; /* counter for pending 0x00 output values which might *
|
||||
* be discarded at the end ("Pacman" termination) */ |
||||
int ct; /* bit shift counter, determines when next byte will be written */ |
||||
int buffer; /* buffer for most recent output byte != 0xFF */ |
||||
|
||||
int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ |
||||
int dc_context[MAX_COMPS_IN_SCAN]; /* context index for DC conditioning */ |
||||
|
||||
unsigned int restarts_to_go; /* MCUs left in this restart interval */ |
||||
int next_restart_num; /* next restart number to write (0-7) */ |
||||
|
||||
/* Pointers to statistics areas (these workspaces have image lifespan) */ |
||||
unsigned char * dc_stats[NUM_ARITH_TBLS]; |
||||
unsigned char * ac_stats[NUM_ARITH_TBLS]; |
||||
|
||||
/* Statistics bin for coding with fixed probability 0.5 */ |
||||
unsigned char fixed_bin[4]; |
||||
} arith_entropy_encoder; |
||||
|
||||
typedef arith_entropy_encoder * arith_entropy_ptr; |
||||
|
||||
/* The following two definitions specify the allocation chunk size
|
||||
* for the statistics area. |
||||
* According to sections F.1.4.4.1.3 and F.1.4.4.2, we need at least |
||||
* 49 statistics bins for DC, and 245 statistics bins for AC coding. |
||||
* |
||||
* We use a compact representation with 1 byte per statistics bin, |
||||
* thus the numbers directly represent byte sizes. |
||||
* This 1 byte per statistics bin contains the meaning of the MPS |
||||
* (more probable symbol) in the highest bit (mask 0x80), and the |
||||
* index into the probability estimation state machine table |
||||
* in the lower bits (mask 0x7F). |
||||
*/ |
||||
|
||||
#define DC_STAT_BINS 64 |
||||
#define AC_STAT_BINS 256 |
||||
|
||||
/* NOTE: Uncomment the following #define if you want to use the
|
||||
* given formula for calculating the AC conditioning parameter Kx |
||||
* for spectral selection progressive coding in section G.1.3.2 |
||||
* of the spec (Kx = Kmin + SRL (8 + Se - Kmin) 4). |
||||
* Although the spec and P&M authors claim that this "has proven |
||||
* to give good results for 8 bit precision samples", I'm not |
||||
* convinced yet that this is really beneficial. |
||||
* Early tests gave only very marginal compression enhancements |
||||
* (a few - around 5 or so - bytes even for very large files), |
||||
* which would turn out rather negative if we'd suppress the |
||||
* DAC (Define Arithmetic Conditioning) marker segments for |
||||
* the default parameters in the future. |
||||
* Note that currently the marker writing module emits 12-byte |
||||
* DAC segments for a full-component scan in a color image. |
||||
* This is not worth worrying about IMHO. However, since the |
||||
* spec defines the default values to be used if the tables |
||||
* are omitted (unlike Huffman tables, which are required |
||||
* anyway), one might optimize this behaviour in the future, |
||||
* and then it would be disadvantageous to use custom tables if |
||||
* they don't provide sufficient gain to exceed the DAC size. |
||||
* |
||||
* On the other hand, I'd consider it as a reasonable result |
||||
* that the conditioning has no significant influence on the |
||||
* compression performance. This means that the basic |
||||
* statistical model is already rather stable. |
||||
* |
||||
* Thus, at the moment, we use the default conditioning values |
||||
* anyway, and do not use the custom formula. |
||||
* |
||||
#define CALCULATE_SPECTRAL_CONDITIONING |
||||
*/ |
||||
|
||||
/* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32.
|
||||
* We assume that int right shift is unsigned if INT32 right shift is, |
||||
* which should be safe. |
||||
*/ |
||||
|
||||
#ifdef RIGHT_SHIFT_IS_UNSIGNED |
||||
#define ISHIFT_TEMPS int ishift_temp; |
||||
#define IRIGHT_SHIFT(x,shft) \ |
||||
((ishift_temp = (x)) < 0 ? \
|
||||
(ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \
|
||||
(ishift_temp >> (shft))) |
||||
#else |
||||
#define ISHIFT_TEMPS |
||||
#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) |
||||
#endif |
||||
|
||||
|
||||
LOCAL(void) |
||||
emit_byte (int val, j_compress_ptr cinfo) |
||||
/* Write next output byte; we do not support suspension in this module. */ |
||||
{ |
||||
struct jpeg_destination_mgr * dest = cinfo->dest; |
||||
|
||||
*dest->next_output_byte++ = (JOCTET) val; |
||||
if (--dest->free_in_buffer == 0) |
||||
if (! (*dest->empty_output_buffer) (cinfo)) |
||||
ERREXIT(cinfo, JERR_CANT_SUSPEND); |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Finish up at the end of an arithmetic-compressed scan. |
||||
*/ |
||||
|
||||
METHODDEF(void) |
||||
finish_pass (j_compress_ptr cinfo) |
||||
{ |
||||
arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy; |
||||
INT32 temp; |
||||
|
||||
/* Section D.1.8: Termination of encoding */ |
||||
|
||||
/* Find the e->c in the coding interval with the largest
|
||||
* number of trailing zero bits */ |
||||
if ((temp = (e->a - 1 + e->c) & 0xFFFF0000L) < e->c) |
||||
e->c = temp + 0x8000L; |
||||
else |
||||
e->c = temp; |
||||
/* Send remaining bytes to output */ |
||||
e->c <<= e->ct; |
||||
if (e->c & 0xF8000000L) { |
||||
/* One final overflow has to be handled */ |
||||
if (e->buffer >= 0) { |
||||
if (e->zc) |
||||
do emit_byte(0x00, cinfo); |
||||
while (--e->zc); |
||||
emit_byte(e->buffer + 1, cinfo); |
||||
if (e->buffer + 1 == 0xFF) |
||||
emit_byte(0x00, cinfo); |
||||
} |
||||
e->zc += e->sc; /* carry-over converts stacked 0xFF bytes to 0x00 */ |
||||
e->sc = 0; |
||||
} else { |
||||
if (e->buffer == 0) |
||||
++e->zc; |
||||
else if (e->buffer >= 0) { |
||||
if (e->zc) |
||||
do emit_byte(0x00, cinfo); |
||||
while (--e->zc); |
||||
emit_byte(e->buffer, cinfo); |
||||
} |
||||
if (e->sc) { |
||||
if (e->zc) |
||||
do emit_byte(0x00, cinfo); |
||||
while (--e->zc); |
||||
do { |
||||
emit_byte(0xFF, cinfo); |
||||
emit_byte(0x00, cinfo); |
||||
} while (--e->sc); |
||||
} |
||||
} |
||||
/* Output final bytes only if they are not 0x00 */ |
||||
if (e->c & 0x7FFF800L) { |
||||
if (e->zc) /* output final pending zero bytes */ |
||||
do emit_byte(0x00, cinfo); |
||||
while (--e->zc); |
||||
emit_byte((e->c >> 19) & 0xFF, cinfo); |
||||
if (((e->c >> 19) & 0xFF) == 0xFF) |
||||
emit_byte(0x00, cinfo); |
||||
if (e->c & 0x7F800L) { |
||||
emit_byte((e->c >> 11) & 0xFF, cinfo); |
||||
if (((e->c >> 11) & 0xFF) == 0xFF) |
||||
emit_byte(0x00, cinfo); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* The core arithmetic encoding routine (common in JPEG and JBIG). |
||||
* This needs to go as fast as possible. |
||||
* Machine-dependent optimization facilities |
||||
* are not utilized in this portable implementation. |
||||
* However, this code should be fairly efficient and |
||||
* may be a good base for further optimizations anyway. |
||||
* |
||||
* Parameter 'val' to be encoded may be 0 or 1 (binary decision). |
||||
* |
||||
* Note: I've added full "Pacman" termination support to the |
||||
* byte output routines, which is equivalent to the optional |
||||
* Discard_final_zeros procedure (Figure D.15) in the spec. |
||||
* Thus, we always produce the shortest possible output |
||||
* stream compliant to the spec (no trailing zero bytes, |
||||
* except for FF stuffing). |
||||
* |
||||
* I've also introduced a new scheme for accessing |
||||
* the probability estimation state machine table, |
||||
* derived from Markus Kuhn's JBIG implementation. |
||||
*/ |
||||
|
||||
LOCAL(void) |
||||
arith_encode (j_compress_ptr cinfo, unsigned char *st, int val)
|
||||
{ |
||||
register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy; |
||||
register unsigned char nl, nm; |
||||
register INT32 qe, temp; |
||||
register int sv; |
||||
|
||||
/* Fetch values from our compact representation of Table D.2:
|
||||
* Qe values and probability estimation state machine |
||||
*/ |
||||
sv = *st; |
||||
qe = jpeg_aritab[sv & 0x7F]; /* => Qe_Value */ |
||||
nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */ |
||||
nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */ |
||||
|
||||
/* Encode & estimation procedures per sections D.1.4 & D.1.5 */ |
||||
e->a -= qe; |
||||
if (val != (sv >> 7)) { |
||||
/* Encode the less probable symbol */ |
||||
if (e->a >= qe) { |
||||
/* If the interval size (qe) for the less probable symbol (LPS)
|
||||
* is larger than the interval size for the MPS, then exchange |
||||
* the two symbols for coding efficiency, otherwise code the LPS |
||||
* as usual: */ |
||||
e->c += e->a; |
||||
e->a = qe; |
||||
} |
||||
*st = (sv & 0x80) ^ nl; /* Estimate_after_LPS */ |
||||
} else { |
||||
/* Encode the more probable symbol */ |
||||
if (e->a >= 0x8000L) |
||||
return; /* A >= 0x8000 -> ready, no renormalization required */ |
||||
if (e->a < qe) { |
||||
/* If the interval size (qe) for the less probable symbol (LPS)
|
||||
* is larger than the interval size for the MPS, then exchange |
||||
* the two symbols for coding efficiency: */ |
||||
e->c += e->a; |
||||
e->a = qe; |
||||
} |
||||
*st = (sv & 0x80) ^ nm; /* Estimate_after_MPS */ |
||||
} |
||||
|
||||
/* Renormalization & data output per section D.1.6 */ |
||||
do { |
||||
e->a <<= 1; |
||||
e->c <<= 1; |
||||
if (--e->ct == 0) { |
||||
/* Another byte is ready for output */ |
||||
temp = e->c >> 19; |
||||
if (temp > 0xFF) { |
||||
/* Handle overflow over all stacked 0xFF bytes */ |
||||
if (e->buffer >= 0) { |
||||
if (e->zc) |
||||
do emit_byte(0x00, cinfo); |
||||
while (--e->zc); |
||||
emit_byte(e->buffer + 1, cinfo); |
||||
if (e->buffer + 1 == 0xFF) |
||||
emit_byte(0x00, cinfo); |
||||
} |
||||
e->zc += e->sc; /* carry-over converts stacked 0xFF bytes to 0x00 */ |
||||
e->sc = 0; |
||||
/* Note: The 3 spacer bits in the C register guarantee
|
||||
* that the new buffer byte can't be 0xFF here |
||||
* (see page 160 in the P&M JPEG book). */ |
||||
e->buffer = temp & 0xFF; /* new output byte, might overflow later */ |
||||
} else if (temp == 0xFF) { |
||||
++e->sc; /* stack 0xFF byte (which might overflow later) */ |
||||
} else { |
||||
/* Output all stacked 0xFF bytes, they will not overflow any more */ |
||||
if (e->buffer == 0) |
||||
++e->zc; |
||||
else if (e->buffer >= 0) { |
||||
if (e->zc) |
||||
do emit_byte(0x00, cinfo); |
||||
while (--e->zc); |
||||
emit_byte(e->buffer, cinfo); |
||||
} |
||||
if (e->sc) { |
||||
if (e->zc) |
||||
do emit_byte(0x00, cinfo); |
||||
while (--e->zc); |
||||
do { |
||||
emit_byte(0xFF, cinfo); |
||||
emit_byte(0x00, cinfo); |
||||
} while (--e->sc); |
||||
} |
||||
e->buffer = temp & 0xFF; /* new output byte (can still overflow) */ |
||||
} |
||||
e->c &= 0x7FFFFL; |
||||
e->ct += 8; |
||||
} |
||||
} while (e->a < 0x8000L); |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Emit a restart marker & resynchronize predictions. |
||||
*/ |
||||
|
||||
LOCAL(void) |
||||
emit_restart (j_compress_ptr cinfo, int restart_num) |
||||
{ |
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; |
||||
int ci; |
||||
jpeg_component_info * compptr; |
||||
|
||||
finish_pass(cinfo); |
||||
|
||||
emit_byte(0xFF, cinfo); |
||||
emit_byte(JPEG_RST0 + restart_num, cinfo); |
||||
|
||||
/* Re-initialize statistics areas */ |
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) { |
||||
compptr = cinfo->cur_comp_info[ci]; |
||||
/* DC needs no table for refinement scan */ |
||||
if (cinfo->Ss == 0 && cinfo->Ah == 0) { |
||||
MEMZERO(entropy->dc_stats[compptr->dc_tbl_no], DC_STAT_BINS); |
||||
/* Reset DC predictions to 0 */ |
||||
entropy->last_dc_val[ci] = 0; |
||||
entropy->dc_context[ci] = 0; |
||||
} |
||||
/* AC needs no table when not present */ |
||||
if (cinfo->Se) { |
||||
MEMZERO(entropy->ac_stats[compptr->ac_tbl_no], AC_STAT_BINS); |
||||
} |
||||
} |
||||
|
||||
/* Reset arithmetic encoding variables */ |
||||
entropy->c = 0; |
||||
entropy->a = 0x10000L; |
||||
entropy->sc = 0; |
||||
entropy->zc = 0; |
||||
entropy->ct = 11; |
||||
entropy->buffer = -1; /* empty */ |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* MCU encoding for DC initial scan (either spectral selection, |
||||
* or first pass of successive approximation). |
||||
*/ |
||||
|
||||
METHODDEF(boolean) |
||||
encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) |
||||
{ |
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; |
||||
JBLOCKROW block; |
||||
unsigned char *st; |
||||
int blkn, ci, tbl; |
||||
int v, v2, m; |
||||
ISHIFT_TEMPS |
||||
|
||||
/* Emit restart marker if needed */ |
||||
if (cinfo->restart_interval) { |
||||
if (entropy->restarts_to_go == 0) { |
||||
emit_restart(cinfo, entropy->next_restart_num); |
||||
entropy->restarts_to_go = cinfo->restart_interval; |
||||
entropy->next_restart_num++; |
||||
entropy->next_restart_num &= 7; |
||||
} |
||||
entropy->restarts_to_go--; |
||||
} |
||||
|
||||
/* Encode the MCU data blocks */ |
||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { |
||||
block = MCU_data[blkn]; |
||||
ci = cinfo->MCU_membership[blkn]; |
||||
tbl = cinfo->cur_comp_info[ci]->dc_tbl_no; |
||||
|
||||
/* Compute the DC value after the required point transform by Al.
|
||||
* This is simply an arithmetic right shift. |
||||
*/ |
||||
m = IRIGHT_SHIFT((int) ((*block)[0]), cinfo->Al); |
||||
|
||||
/* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */ |
||||
|
||||
/* Table F.4: Point to statistics bin S0 for DC coefficient coding */ |
||||
st = entropy->dc_stats[tbl] + entropy->dc_context[ci]; |
||||
|
||||
/* Figure F.4: Encode_DC_DIFF */ |
||||
if ((v = m - entropy->last_dc_val[ci]) == 0) { |
||||
arith_encode(cinfo, st, 0); |
||||
entropy->dc_context[ci] = 0; /* zero diff category */ |
||||
} else { |
||||
entropy->last_dc_val[ci] = m; |
||||
arith_encode(cinfo, st, 1); |
||||
/* Figure F.6: Encoding nonzero value v */ |
||||
/* Figure F.7: Encoding the sign of v */ |
||||
if (v > 0) { |
||||
arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */ |
||||
st += 2; /* Table F.4: SP = S0 + 2 */ |
||||
entropy->dc_context[ci] = 4; /* small positive diff category */ |
||||
} else { |
||||
v = -v; |
||||
arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */ |
||||
st += 3; /* Table F.4: SN = S0 + 3 */ |
||||
entropy->dc_context[ci] = 8; /* small negative diff category */ |
||||
} |
||||
/* Figure F.8: Encoding the magnitude category of v */ |
||||
m = 0; |
||||
if (v -= 1) { |
||||
arith_encode(cinfo, st, 1); |
||||
m = 1; |
||||
v2 = v; |
||||
st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */ |
||||
while (v2 >>= 1) { |
||||
arith_encode(cinfo, st, 1); |
||||
m <<= 1; |
||||
st += 1; |
||||
} |
||||
} |
||||
arith_encode(cinfo, st, 0); |
||||
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */ |
||||
if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1)) |
||||
entropy->dc_context[ci] = 0; /* zero diff category */ |
||||
else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1)) |
||||
entropy->dc_context[ci] += 8; /* large diff category */ |
||||
/* Figure F.9: Encoding the magnitude bit pattern of v */ |
||||
st += 14; |
||||
while (m >>= 1) |
||||
arith_encode(cinfo, st, (m & v) ? 1 : 0); |
||||
} |
||||
} |
||||
|
||||
return TRUE; |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* MCU encoding for AC initial scan (either spectral selection, |
||||
* or first pass of successive approximation). |
||||
*/ |
||||
|
||||
METHODDEF(boolean) |
||||
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) |
||||
{ |
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; |
||||
JBLOCKROW block; |
||||
unsigned char *st; |
||||
int tbl, k, ke; |
||||
int v, v2, m; |
||||
const int * natural_order; |
||||
|
||||
/* Emit restart marker if needed */ |
||||
if (cinfo->restart_interval) { |
||||
if (entropy->restarts_to_go == 0) { |
||||
emit_restart(cinfo, entropy->next_restart_num); |
||||
entropy->restarts_to_go = cinfo->restart_interval; |
||||
entropy->next_restart_num++; |
||||
entropy->next_restart_num &= 7; |
||||
} |
||||
entropy->restarts_to_go--; |
||||
} |
||||
|
||||
natural_order = cinfo->natural_order; |
||||
|
||||
/* Encode the MCU data block */ |
||||
block = MCU_data[0]; |
||||
tbl = cinfo->cur_comp_info[0]->ac_tbl_no; |
||||
|
||||
/* Sections F.1.4.2 & F.1.4.4.2: Encoding of AC coefficients */ |
||||
|
||||
/* Establish EOB (end-of-block) index */ |
||||
for (ke = cinfo->Se; ke > 0; ke--) |
||||
/* We must apply the point transform by Al. For AC coefficients this
|
||||
* is an integer division with rounding towards 0. To do this portably |
||||
* in C, we shift after obtaining the absolute value. |
||||
*/ |
||||
if ((v = (*block)[natural_order[ke]]) >= 0) { |
||||
if (v >>= cinfo->Al) break; |
||||
} else { |
||||
v = -v; |
||||
if (v >>= cinfo->Al) break; |
||||
} |
||||
|
||||
/* Figure F.5: Encode_AC_Coefficients */ |
||||
for (k = cinfo->Ss; k <= ke; k++) { |
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1); |
||||
arith_encode(cinfo, st, 0); /* EOB decision */ |
||||
for (;;) { |
||||
if ((v = (*block)[natural_order[k]]) >= 0) { |
||||
if (v >>= cinfo->Al) { |
||||
arith_encode(cinfo, st + 1, 1); |
||||
arith_encode(cinfo, entropy->fixed_bin, 0); |
||||
break; |
||||
} |
||||
} else { |
||||
v = -v; |
||||
if (v >>= cinfo->Al) { |
||||
arith_encode(cinfo, st + 1, 1); |
||||
arith_encode(cinfo, entropy->fixed_bin, 1); |
||||
break; |
||||
} |
||||
} |
||||
arith_encode(cinfo, st + 1, 0); st += 3; k++; |
||||
} |
||||
st += 2; |
||||
/* Figure F.8: Encoding the magnitude category of v */ |
||||
m = 0; |
||||
if (v -= 1) { |
||||
arith_encode(cinfo, st, 1); |
||||
m = 1; |
||||
v2 = v; |
||||
if (v2 >>= 1) { |
||||
arith_encode(cinfo, st, 1); |
||||
m <<= 1; |
||||
st = entropy->ac_stats[tbl] + |
||||
(k <= cinfo->arith_ac_K[tbl] ? 189 : 217); |
||||
while (v2 >>= 1) { |
||||
arith_encode(cinfo, st, 1); |
||||
m <<= 1; |
||||
st += 1; |
||||
} |
||||
} |
||||
} |
||||
arith_encode(cinfo, st, 0); |
||||
/* Figure F.9: Encoding the magnitude bit pattern of v */ |
||||
st += 14; |
||||
while (m >>= 1) |
||||
arith_encode(cinfo, st, (m & v) ? 1 : 0); |
||||
} |
||||
/* Encode EOB decision only if k <= cinfo->Se */ |
||||
if (k <= cinfo->Se) { |
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1); |
||||
arith_encode(cinfo, st, 1); |
||||
} |
||||
|
||||
return TRUE; |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* MCU encoding for DC successive approximation refinement scan. |
||||
*/ |
||||
|
||||
METHODDEF(boolean) |
||||
encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) |
||||
{ |
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; |
||||
unsigned char *st; |
||||
int Al, blkn; |
||||
|
||||
/* Emit restart marker if needed */ |
||||
if (cinfo->restart_interval) { |
||||
if (entropy->restarts_to_go == 0) { |
||||
emit_restart(cinfo, entropy->next_restart_num); |
||||
entropy->restarts_to_go = cinfo->restart_interval; |
||||
entropy->next_restart_num++; |
||||
entropy->next_restart_num &= 7; |
||||
} |
||||
entropy->restarts_to_go--; |
||||
} |
||||
|
||||
st = entropy->fixed_bin; /* use fixed probability estimation */ |
||||
Al = cinfo->Al; |
||||
|
||||
/* Encode the MCU data blocks */ |
||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { |
||||
/* We simply emit the Al'th bit of the DC coefficient value. */ |
||||
arith_encode(cinfo, st, (MCU_data[blkn][0][0] >> Al) & 1); |
||||
} |
||||
|
||||
return TRUE; |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* MCU encoding for AC successive approximation refinement scan. |
||||
*/ |
||||
|
||||
METHODDEF(boolean) |
||||
encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) |
||||
{ |
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; |
||||
JBLOCKROW block; |
||||
unsigned char *st; |
||||
int tbl, k, ke, kex; |
||||
int v; |
||||
const int * natural_order; |
||||
|
||||
/* Emit restart marker if needed */ |
||||
if (cinfo->restart_interval) { |
||||
if (entropy->restarts_to_go == 0) { |
||||
emit_restart(cinfo, entropy->next_restart_num); |
||||
entropy->restarts_to_go = cinfo->restart_interval; |
||||
entropy->next_restart_num++; |
||||
entropy->next_restart_num &= 7; |
||||
} |
||||
entropy->restarts_to_go--; |
||||
} |
||||
|
||||
natural_order = cinfo->natural_order; |
||||
|
||||
/* Encode the MCU data block */ |
||||
block = MCU_data[0]; |
||||
tbl = cinfo->cur_comp_info[0]->ac_tbl_no; |
||||
|
||||
/* Section G.1.3.3: Encoding of AC coefficients */ |
||||
|
||||
/* Establish EOB (end-of-block) index */ |
||||
for (ke = cinfo->Se; ke > 0; ke--) |
||||
/* We must apply the point transform by Al. For AC coefficients this
|
||||
* is an integer division with rounding towards 0. To do this portably |
||||
* in C, we shift after obtaining the absolute value. |
||||
*/ |
||||
if ((v = (*block)[natural_order[ke]]) >= 0) { |
||||
if (v >>= cinfo->Al) break; |
||||
} else { |
||||
v = -v; |
||||
if (v >>= cinfo->Al) break; |
||||
} |
||||
|
||||
/* Establish EOBx (previous stage end-of-block) index */ |
||||
for (kex = ke; kex > 0; kex--) |
||||
if ((v = (*block)[natural_order[kex]]) >= 0) { |
||||
if (v >>= cinfo->Ah) break; |
||||
} else { |
||||
v = -v; |
||||
if (v >>= cinfo->Ah) break; |
||||
} |
||||
|
||||
/* Figure G.10: Encode_AC_Coefficients_SA */ |
||||
for (k = cinfo->Ss; k <= ke; k++) { |
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1); |
||||
if (k > kex) |
||||
arith_encode(cinfo, st, 0); /* EOB decision */ |
||||
for (;;) { |
||||
if ((v = (*block)[natural_order[k]]) >= 0) { |
||||
if (v >>= cinfo->Al) { |
||||
if (v >> 1) /* previously nonzero coef */ |
||||
arith_encode(cinfo, st + 2, (v & 1)); |
||||
else { /* newly nonzero coef */ |
||||
arith_encode(cinfo, st + 1, 1); |
||||
arith_encode(cinfo, entropy->fixed_bin, 0); |
||||
} |
||||
break; |
||||
} |
||||
} else { |
||||
v = -v; |
||||
if (v >>= cinfo->Al) { |
||||
if (v >> 1) /* previously nonzero coef */ |
||||
arith_encode(cinfo, st + 2, (v & 1)); |
||||
else { /* newly nonzero coef */ |
||||
arith_encode(cinfo, st + 1, 1); |
||||
arith_encode(cinfo, entropy->fixed_bin, 1); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
arith_encode(cinfo, st + 1, 0); st += 3; k++; |
||||
} |
||||
} |
||||
/* Encode EOB decision only if k <= cinfo->Se */ |
||||
if (k <= cinfo->Se) { |
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1); |
||||
arith_encode(cinfo, st, 1); |
||||
} |
||||
|
||||
return TRUE; |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Encode and output one MCU's worth of arithmetic-compressed coefficients. |
||||
*/ |
||||
|
||||
METHODDEF(boolean) |
||||
encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data) |
||||
{ |
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; |
||||
jpeg_component_info * compptr; |
||||
JBLOCKROW block; |
||||
unsigned char *st; |
||||
int blkn, ci, tbl, k, ke; |
||||
int v, v2, m; |
||||
const int * natural_order; |
||||
|
||||
/* Emit restart marker if needed */ |
||||
if (cinfo->restart_interval) { |
||||
if (entropy->restarts_to_go == 0) { |
||||
emit_restart(cinfo, entropy->next_restart_num); |
||||
entropy->restarts_to_go = cinfo->restart_interval; |
||||
entropy->next_restart_num++; |
||||
entropy->next_restart_num &= 7; |
||||
} |
||||
entropy->restarts_to_go--; |
||||
} |
||||
|
||||
natural_order = cinfo->natural_order; |
||||
|
||||
/* Encode the MCU data blocks */ |
||||
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { |
||||
block = MCU_data[blkn]; |
||||
ci = cinfo->MCU_membership[blkn]; |
||||
compptr = cinfo->cur_comp_info[ci]; |
||||
|
||||
/* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */ |
||||
|
||||
tbl = compptr->dc_tbl_no; |
||||
|
||||
/* Table F.4: Point to statistics bin S0 for DC coefficient coding */ |
||||
st = entropy->dc_stats[tbl] + entropy->dc_context[ci]; |
||||
|
||||
/* Figure F.4: Encode_DC_DIFF */ |
||||
if ((v = (*block)[0] - entropy->last_dc_val[ci]) == 0) { |
||||
arith_encode(cinfo, st, 0); |
||||
entropy->dc_context[ci] = 0; /* zero diff category */ |
||||
} else { |
||||
entropy->last_dc_val[ci] = (*block)[0]; |
||||
arith_encode(cinfo, st, 1); |
||||
/* Figure F.6: Encoding nonzero value v */ |
||||
/* Figure F.7: Encoding the sign of v */ |
||||
if (v > 0) { |
||||
arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */ |
||||
st += 2; /* Table F.4: SP = S0 + 2 */ |
||||
entropy->dc_context[ci] = 4; /* small positive diff category */ |
||||
} else { |
||||
v = -v; |
||||
arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */ |
||||
st += 3; /* Table F.4: SN = S0 + 3 */ |
||||
entropy->dc_context[ci] = 8; /* small negative diff category */ |
||||
} |
||||
/* Figure F.8: Encoding the magnitude category of v */ |
||||
m = 0; |
||||
if (v -= 1) { |
||||
arith_encode(cinfo, st, 1); |
||||
m = 1; |
||||
v2 = v; |
||||
st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */ |
||||
while (v2 >>= 1) { |
||||
arith_encode(cinfo, st, 1); |
||||
m <<= 1; |
||||
st += 1; |
||||
} |
||||
} |
||||
arith_encode(cinfo, st, 0); |
||||
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */ |
||||
if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1)) |
||||
entropy->dc_context[ci] = 0; /* zero diff category */ |
||||
else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1)) |
||||
entropy->dc_context[ci] += 8; /* large diff category */ |
||||
/* Figure F.9: Encoding the magnitude bit pattern of v */ |
||||
st += 14; |
||||
while (m >>= 1) |
||||
arith_encode(cinfo, st, (m & v) ? 1 : 0); |
||||
} |
||||
|
||||
/* Sections F.1.4.2 & F.1.4.4.2: Encoding of AC coefficients */ |
||||
|
||||
tbl = compptr->ac_tbl_no; |
||||
|
||||
/* Establish EOB (end-of-block) index */ |
||||
for (ke = cinfo->lim_Se; ke > 0; ke--) |
||||
if ((*block)[natural_order[ke]]) break; |
||||
|
||||
/* Figure F.5: Encode_AC_Coefficients */ |
||||
for (k = 1; k <= ke; k++) { |
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1); |
||||
arith_encode(cinfo, st, 0); /* EOB decision */ |
||||
while ((v = (*block)[natural_order[k]]) == 0) { |
||||
arith_encode(cinfo, st + 1, 0); st += 3; k++; |
||||
} |
||||
arith_encode(cinfo, st + 1, 1); |
||||
/* Figure F.6: Encoding nonzero value v */ |
||||
/* Figure F.7: Encoding the sign of v */ |
||||
if (v > 0) { |
||||
arith_encode(cinfo, entropy->fixed_bin, 0); |
||||
} else { |
||||
v = -v; |
||||
arith_encode(cinfo, entropy->fixed_bin, 1); |
||||
} |
||||
st += 2; |
||||
/* Figure F.8: Encoding the magnitude category of v */ |
||||
m = 0; |
||||
if (v -= 1) { |
||||
arith_encode(cinfo, st, 1); |
||||
m = 1; |
||||
v2 = v; |
||||
if (v2 >>= 1) { |
||||
arith_encode(cinfo, st, 1); |
||||
m <<= 1; |
||||
st = entropy->ac_stats[tbl] + |
||||
(k <= cinfo->arith_ac_K[tbl] ? 189 : 217); |
||||
while (v2 >>= 1) { |
||||
arith_encode(cinfo, st, 1); |
||||
m <<= 1; |
||||
st += 1; |
||||
} |
||||
} |
||||
} |
||||
arith_encode(cinfo, st, 0); |
||||
/* Figure F.9: Encoding the magnitude bit pattern of v */ |
||||
st += 14; |
||||
while (m >>= 1) |
||||
arith_encode(cinfo, st, (m & v) ? 1 : 0); |
||||
} |
||||
/* Encode EOB decision only if k <= cinfo->lim_Se */ |
||||
if (k <= cinfo->lim_Se) { |
||||
st = entropy->ac_stats[tbl] + 3 * (k - 1); |
||||
arith_encode(cinfo, st, 1); |
||||
} |
||||
} |
||||
|
||||
return TRUE; |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Initialize for an arithmetic-compressed scan. |
||||
*/ |
||||
|
||||
METHODDEF(void) |
||||
start_pass (j_compress_ptr cinfo, boolean gather_statistics) |
||||
{ |
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; |
||||
int ci, tbl; |
||||
jpeg_component_info * compptr; |
||||
|
||||
if (gather_statistics) |
||||
/* Make sure to avoid that in the master control logic!
|
||||
* We are fully adaptive here and need no extra |
||||
* statistics gathering pass! |
||||
*/ |
||||
ERREXIT(cinfo, JERR_NOT_COMPILED); |
||||
|
||||
/* We assume jcmaster.c already validated the progressive scan parameters. */ |
||||
|
||||
/* Select execution routines */ |
||||
if (cinfo->progressive_mode) { |
||||
if (cinfo->Ah == 0) { |
||||
if (cinfo->Ss == 0) |
||||
entropy->pub.encode_mcu = encode_mcu_DC_first; |
||||
else |
||||
entropy->pub.encode_mcu = encode_mcu_AC_first; |
||||
} else { |
||||
if (cinfo->Ss == 0) |
||||
entropy->pub.encode_mcu = encode_mcu_DC_refine; |
||||
else |
||||
entropy->pub.encode_mcu = encode_mcu_AC_refine; |
||||
} |
||||
} else |
||||
entropy->pub.encode_mcu = encode_mcu; |
||||
|
||||
/* Allocate & initialize requested statistics areas */ |
||||
for (ci = 0; ci < cinfo->comps_in_scan; ci++) { |
||||
compptr = cinfo->cur_comp_info[ci]; |
||||
/* DC needs no table for refinement scan */ |
||||
if (cinfo->Ss == 0 && cinfo->Ah == 0) { |
||||
tbl = compptr->dc_tbl_no; |
||||
if (tbl < 0 || tbl >= NUM_ARITH_TBLS) |
||||
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl); |
||||
if (entropy->dc_stats[tbl] == NULL) |
||||
entropy->dc_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small) |
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, DC_STAT_BINS); |
||||
MEMZERO(entropy->dc_stats[tbl], DC_STAT_BINS); |
||||
/* Initialize DC predictions to 0 */ |
||||
entropy->last_dc_val[ci] = 0; |
||||
entropy->dc_context[ci] = 0; |
||||
} |
||||
/* AC needs no table when not present */ |
||||
if (cinfo->Se) { |
||||
tbl = compptr->ac_tbl_no; |
||||
if (tbl < 0 || tbl >= NUM_ARITH_TBLS) |
||||
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl); |
||||
if (entropy->ac_stats[tbl] == NULL) |
||||
entropy->ac_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small) |
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, AC_STAT_BINS); |
||||
MEMZERO(entropy->ac_stats[tbl], AC_STAT_BINS); |
||||
#ifdef CALCULATE_SPECTRAL_CONDITIONING |
||||
if (cinfo->progressive_mode) |
||||
/* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */ |
||||
cinfo->arith_ac_K[tbl] = cinfo->Ss + ((8 + cinfo->Se - cinfo->Ss) >> 4); |
||||
#endif |
||||
} |
||||
} |
||||
|
||||
/* Initialize arithmetic encoding variables */ |
||||
entropy->c = 0; |
||||
entropy->a = 0x10000L; |
||||
entropy->sc = 0; |
||||
entropy->zc = 0; |
||||
entropy->ct = 11; |
||||
entropy->buffer = -1; /* empty */ |
||||
|
||||
/* Initialize restart stuff */ |
||||
entropy->restarts_to_go = cinfo->restart_interval; |
||||
entropy->next_restart_num = 0; |
||||
} |
||||
|
||||
|
||||
/*
|
||||
* Module initialization routine for arithmetic entropy encoding. |
||||
*/ |
||||
|
||||
GLOBAL(void) |
||||
jinit_arith_encoder (j_compress_ptr cinfo) |
||||
{ |
||||
arith_entropy_ptr entropy; |
||||
int i; |
||||
|
||||
entropy = (arith_entropy_ptr) |
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, |
||||
SIZEOF(arith_entropy_encoder)); |
||||
cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; |
||||
entropy->pub.start_pass = start_pass; |
||||
entropy->pub.finish_pass = finish_pass; |
||||
|
||||
/* Mark tables unallocated */ |
||||
for (i = 0; i < NUM_ARITH_TBLS; i++) { |
||||
entropy->dc_stats[i] = NULL; |
||||
entropy->ac_stats[i] = NULL; |
||||
} |
||||
|
||||
/* Initialize index for fixed probability estimation */ |
||||
entropy->fixed_bin[0] = 113; |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue