Removed redundant libraries that should be in the developer's compiler directory anyway...
This commit is contained in:
parent
6a2f00e193
commit
348e8d14bf
18
VBA.sln
18
VBA.sln
|
@ -2,15 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
# Visual Studio 2005
|
# Visual Studio 2005
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VisualBoyAdvance", "VBA.vcproj", "{6D4C5EC8-933F-4C05-A1BF-498E658576DF}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VisualBoyAdvance", "VBA.vcproj", "{6D4C5EC8-933F-4C05-A1BF-498E658576DF}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{B938FBD9-C7F9-4BF7-8C27-68865D1FA092} = {B938FBD9-C7F9-4BF7-8C27-68865D1FA092}
|
|
||||||
{DB5C12E9-BCD3-4517-8708-475C0D1D88CE} = {DB5C12E9-BCD3-4517-8708-475C0D1D88CE}
|
{DB5C12E9-BCD3-4517-8708-475C0D1D88CE} = {DB5C12E9-BCD3-4517-8708-475C0D1D88CE}
|
||||||
{96E945F7-0377-48DA-A5F8-1C192DE9F25F} = {96E945F7-0377-48DA-A5F8-1C192DE9F25F}
|
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "src\win32\dependencies\zlib\zlib.vcproj", "{B938FBD9-C7F9-4BF7-8C27-68865D1FA092}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "src\win32\dependencies\libpng\libpng.vcproj", "{96E945F7-0377-48DA-A5F8-1C192DE9F25F}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cximage", "src\win32\dependencies\cximage\cximage.vcproj", "{DB5C12E9-BCD3-4517-8708-475C0D1D88CE}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cximage", "src\win32\dependencies\cximage\cximage.vcproj", "{DB5C12E9-BCD3-4517-8708-475C0D1D88CE}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
|
@ -26,18 +20,6 @@ Global
|
||||||
{6D4C5EC8-933F-4C05-A1BF-498E658576DF}.Optimized|Win32.Build.0 = Optimized|Win32
|
{6D4C5EC8-933F-4C05-A1BF-498E658576DF}.Optimized|Win32.Build.0 = Optimized|Win32
|
||||||
{6D4C5EC8-933F-4C05-A1BF-498E658576DF}.Release|Win32.ActiveCfg = Release|Win32
|
{6D4C5EC8-933F-4C05-A1BF-498E658576DF}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{6D4C5EC8-933F-4C05-A1BF-498E658576DF}.Release|Win32.Build.0 = Release|Win32
|
{6D4C5EC8-933F-4C05-A1BF-498E658576DF}.Release|Win32.Build.0 = Release|Win32
|
||||||
{B938FBD9-C7F9-4BF7-8C27-68865D1FA092}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{B938FBD9-C7F9-4BF7-8C27-68865D1FA092}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{B938FBD9-C7F9-4BF7-8C27-68865D1FA092}.Optimized|Win32.ActiveCfg = Release|Win32
|
|
||||||
{B938FBD9-C7F9-4BF7-8C27-68865D1FA092}.Optimized|Win32.Build.0 = Release|Win32
|
|
||||||
{B938FBD9-C7F9-4BF7-8C27-68865D1FA092}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{B938FBD9-C7F9-4BF7-8C27-68865D1FA092}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{96E945F7-0377-48DA-A5F8-1C192DE9F25F}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{96E945F7-0377-48DA-A5F8-1C192DE9F25F}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{96E945F7-0377-48DA-A5F8-1C192DE9F25F}.Optimized|Win32.ActiveCfg = Release|Win32
|
|
||||||
{96E945F7-0377-48DA-A5F8-1C192DE9F25F}.Optimized|Win32.Build.0 = Release|Win32
|
|
||||||
{96E945F7-0377-48DA-A5F8-1C192DE9F25F}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{96E945F7-0377-48DA-A5F8-1C192DE9F25F}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{DB5C12E9-BCD3-4517-8708-475C0D1D88CE}.Debug|Win32.ActiveCfg = Debug|Win32
|
{DB5C12E9-BCD3-4517-8708-475C0D1D88CE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{DB5C12E9-BCD3-4517-8708-475C0D1D88CE}.Debug|Win32.Build.0 = Debug|Win32
|
{DB5C12E9-BCD3-4517-8708-475C0D1D88CE}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{DB5C12E9-BCD3-4517-8708-475C0D1D88CE}.Optimized|Win32.ActiveCfg = Release|Win32
|
{DB5C12E9-BCD3-4517-8708-475C0D1D88CE}.Optimized|Win32.ActiveCfg = Release|Win32
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
/info.txt/1.1/Fri May 12 21:26:37 2006//
|
|
||||||
D/cximage////
|
|
||||||
D/libpng////
|
|
||||||
D/sdl////
|
|
||||||
D/zlib////
|
|
|
@ -1 +0,0 @@
|
||||||
VisualBoyAdvance/win32/dependencies
|
|
|
@ -1 +0,0 @@
|
||||||
:pserver:anonymous@vba.cvs.sourceforge.net:/cvsroot/vba
|
|
|
@ -1,55 +0,0 @@
|
||||||
/cximage.vcproj/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/license.txt/1.1/Wed Aug 23 22:16:02 2006//
|
|
||||||
/tif_xfile.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/xfile.h/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximabmp.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximabmp.h/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximacfg.h/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximadef.h/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximadsp.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximaenc.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximaexif.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximage.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximage.h/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximagif.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximagif.h/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximahist.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximaico.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximaico.h/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximainfo.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximaint.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximaiter.h/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximaj2k.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximaj2k.h/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximajas.cpp/1.3/Wed Aug 23 22:16:02 2006//
|
|
||||||
/ximajas.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximajbg.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximajbg.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximajpg.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximajpg.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximalpha.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximalyr.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximamng.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximamng.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximapal.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximapcx.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximapcx.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximapng.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximapng.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximasel.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximatga.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximatga.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximath.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximath.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximatif.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximatif.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximatran.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximawbmp.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximawbmp.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximawmf.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximawmf.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/ximawnd.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/xiofile.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/xmemfile.cpp/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
/xmemfile.h/1.3/Wed Aug 23 22:16:03 2006//
|
|
||||||
D
|
|
|
@ -1 +0,0 @@
|
||||||
VisualBoyAdvance/win32/dependencies/cximage
|
|
|
@ -1 +0,0 @@
|
||||||
:pserver:anonymous@vba.cvs.sourceforge.net:/cvsroot/vba
|
|
|
@ -1,3 +0,0 @@
|
||||||
release
|
|
||||||
libpng.vcproj.A2.Spacy.user
|
|
||||||
debug
|
|
|
@ -1,20 +0,0 @@
|
||||||
/.cvsignore/1.1/Sat May 13 16:41:48 2006//
|
|
||||||
/libpng.vcproj/1.5/Wed Aug 23 22:13:29 2006//
|
|
||||||
/png.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/png.h/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngconf.h/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngerror.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngget.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngmem.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngpread.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngread.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngrio.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngrtran.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngrutil.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngset.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngtrans.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngwio.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngwrite.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngwtran.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
/pngwutil.c/1.1/Fri May 12 21:27:07 2006//
|
|
||||||
D
|
|
|
@ -1 +0,0 @@
|
||||||
VisualBoyAdvance/win32/dependencies/libpng
|
|
|
@ -1 +0,0 @@
|
||||||
:pserver:anonymous@vba.cvs.sourceforge.net:/cvsroot/vba
|
|
|
@ -1,238 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="8,00"
|
|
||||||
Name="libpng"
|
|
||||||
ProjectGUID="{96E945F7-0377-48DA-A5F8-1C192DE9F25F}"
|
|
||||||
RootNamespace="libpng"
|
|
||||||
Keyword="Win32Proj"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
CharacterSet="0"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="..\zlib"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
EnableEnhancedInstructionSet="1"
|
|
||||||
DisableLanguageExtensions="true"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="1"
|
|
||||||
Detect64BitPortabilityProblems="false"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
CompileAs="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
AdditionalOptions="/MACHINE:X86"
|
|
||||||
AdditionalLibraryDirectories=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
CharacterSet="0"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories="..\zlib"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableEnhancedInstructionSet="1"
|
|
||||||
DisableLanguageExtensions="true"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="1"
|
|
||||||
Detect64BitPortabilityProblems="false"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
CompileAs="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
AdditionalOptions="/MACHINE:X86"
|
|
||||||
AdditionalLibraryDirectories=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<Filter
|
|
||||||
Name="Header Files"
|
|
||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
|
||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
|
||||||
>
|
|
||||||
<File
|
|
||||||
RelativePath=".\png.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngconf.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Source Files"
|
|
||||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
|
||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
|
||||||
>
|
|
||||||
<File
|
|
||||||
RelativePath=".\png.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngerror.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngget.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngmem.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngpread.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngread.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngrio.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngrtran.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngrutil.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngset.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngtrans.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngwio.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngwrite.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngwtran.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\pngwutil.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
|
@ -1,847 +0,0 @@
|
||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
|
||||||
*
|
|
||||||
* Last changed in libpng 1.2.9 April 14, 2006
|
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#define PNG_NO_EXTERN
|
|
||||||
#include "png.h"
|
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
|
||||||
typedef version_1_2_10 Your_png_h_is_not_version_1_2_10;
|
|
||||||
|
|
||||||
/* Version information for C files. This had better match the version
|
|
||||||
* string defined in png.h. */
|
|
||||||
|
|
||||||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
|
||||||
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
|
||||||
const char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING;
|
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
|
||||||
|
|
||||||
/* png_sig was changed to a function in version 1.0.5c */
|
|
||||||
/* Place to hold the signature string for a PNG file. */
|
|
||||||
const png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
|
||||||
|
|
||||||
/* Invoke global declarations for constant strings for known chunk types */
|
|
||||||
PNG_IHDR;
|
|
||||||
PNG_IDAT;
|
|
||||||
PNG_IEND;
|
|
||||||
PNG_PLTE;
|
|
||||||
PNG_bKGD;
|
|
||||||
PNG_cHRM;
|
|
||||||
PNG_gAMA;
|
|
||||||
PNG_hIST;
|
|
||||||
PNG_iCCP;
|
|
||||||
PNG_iTXt;
|
|
||||||
PNG_oFFs;
|
|
||||||
PNG_pCAL;
|
|
||||||
PNG_sCAL;
|
|
||||||
PNG_pHYs;
|
|
||||||
PNG_sBIT;
|
|
||||||
PNG_sPLT;
|
|
||||||
PNG_sRGB;
|
|
||||||
PNG_tEXt;
|
|
||||||
PNG_tIME;
|
|
||||||
PNG_tRNS;
|
|
||||||
PNG_zTXt;
|
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
|
||||||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
|
||||||
|
|
||||||
/* start of interlace block */
|
|
||||||
const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
|
||||||
|
|
||||||
/* offset to next interlace block */
|
|
||||||
const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
|
||||||
|
|
||||||
/* start of interlace block in the y direction */
|
|
||||||
const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
|
||||||
|
|
||||||
/* offset to next interlace block in the y direction */
|
|
||||||
const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
|
||||||
|
|
||||||
/* width of interlace block (used in assembler routines only) */
|
|
||||||
#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
|
||||||
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Height of interlace block. This is not currently used - if you need
|
|
||||||
* it, uncomment it here and in png.h
|
|
||||||
const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Mask to determine which pixels are valid in a pass */
|
|
||||||
const int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
|
||||||
|
|
||||||
/* Mask to determine which pixels to overwrite while displaying */
|
|
||||||
const int FARDATA png_pass_dsp_mask[]
|
|
||||||
= {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
|
||||||
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
|
||||||
#endif /* PNG_USE_GLOBAL_ARRAYS */
|
|
||||||
|
|
||||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
|
||||||
* of the PNG file signature. If the PNG data is embedded into another
|
|
||||||
* stream we can set num_bytes = 8 so that libpng will not attempt to read
|
|
||||||
* or write any of the magic bytes before it starts on the IHDR.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
|
||||||
void PNGAPI
|
|
||||||
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_sig_bytes\n");
|
|
||||||
if (num_bytes > 8)
|
|
||||||
png_error(png_ptr, "Too many bytes for PNG signature.");
|
|
||||||
|
|
||||||
png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Checks whether the supplied bytes match the PNG signature. We allow
|
|
||||||
* checking less than the full 8-byte signature so that those apps that
|
|
||||||
* already read the first few bytes of a file to determine the file type
|
|
||||||
* can simply check the remaining bytes for extra assurance. Returns
|
|
||||||
* an integer less than, equal to, or greater than zero if sig is found,
|
|
||||||
* respectively, to be less than, to match, or be greater than the correct
|
|
||||||
* PNG signature (this is the same behaviour as strcmp, memcmp, etc).
|
|
||||||
*/
|
|
||||||
int PNGAPI
|
|
||||||
png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
|
|
||||||
{
|
|
||||||
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
|
||||||
if (num_to_check > 8)
|
|
||||||
num_to_check = 8;
|
|
||||||
else if (num_to_check < 1)
|
|
||||||
return (-1);
|
|
||||||
|
|
||||||
if (start > 7)
|
|
||||||
return (-1);
|
|
||||||
|
|
||||||
if (start + num_to_check > 8)
|
|
||||||
num_to_check = 8 - start;
|
|
||||||
|
|
||||||
return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check)));
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
|
|
||||||
/* (Obsolete) function to check signature bytes. It does not allow one
|
|
||||||
* to check a partial signature. This function might be removed in the
|
|
||||||
* future - use png_sig_cmp(). Returns true (nonzero) if the file is a PNG.
|
|
||||||
*/
|
|
||||||
int PNGAPI
|
|
||||||
png_check_sig(png_bytep sig, int num)
|
|
||||||
{
|
|
||||||
return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
|
||||||
/* Function to allocate memory for zlib and clear it to 0. */
|
|
||||||
#ifdef PNG_1_0_X
|
|
||||||
voidpf PNGAPI
|
|
||||||
#else
|
|
||||||
voidpf /* private */
|
|
||||||
#endif
|
|
||||||
png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
|
||||||
{
|
|
||||||
png_voidp ptr;
|
|
||||||
png_structp p=png_ptr;
|
|
||||||
png_uint_32 save_flags=p->flags;
|
|
||||||
png_uint_32 num_bytes;
|
|
||||||
|
|
||||||
if (items > PNG_UINT_32_MAX/size)
|
|
||||||
{
|
|
||||||
png_warning (png_ptr, "Potential overflow in png_zalloc()");
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
num_bytes = (png_uint_32)items * size;
|
|
||||||
|
|
||||||
p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
|
||||||
ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
|
|
||||||
p->flags=save_flags;
|
|
||||||
|
|
||||||
#if defined(PNG_1_0_X) && !defined(PNG_NO_ZALLOC_ZERO)
|
|
||||||
if (ptr == NULL)
|
|
||||||
return ((voidpf)ptr);
|
|
||||||
|
|
||||||
if (num_bytes > (png_uint_32)0x8000L)
|
|
||||||
{
|
|
||||||
png_memset(ptr, 0, (png_size_t)0x8000L);
|
|
||||||
png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0,
|
|
||||||
(png_size_t)(num_bytes - (png_uint_32)0x8000L));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_memset(ptr, 0, (png_size_t)num_bytes);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return ((voidpf)ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* function to free memory for zlib */
|
|
||||||
#ifdef PNG_1_0_X
|
|
||||||
void PNGAPI
|
|
||||||
#else
|
|
||||||
void /* private */
|
|
||||||
#endif
|
|
||||||
png_zfree(voidpf png_ptr, voidpf ptr)
|
|
||||||
{
|
|
||||||
png_free((png_structp)png_ptr, (png_voidp)ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset the CRC variable to 32 bits of 1's. Care must be taken
|
|
||||||
* in case CRC is > 32 bits to leave the top bits 0.
|
|
||||||
*/
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_reset_crc(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_ptr->crc = crc32(0, Z_NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Calculate the CRC over a section of data. We can only pass as
|
|
||||||
* much data to this routine as the largest single buffer size. We
|
|
||||||
* also check that this data will actually be used before going to the
|
|
||||||
* trouble of calculating it.
|
|
||||||
*/
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length)
|
|
||||||
{
|
|
||||||
int need_crc = 1;
|
|
||||||
|
|
||||||
if (png_ptr->chunk_name[0] & 0x20) /* ancillary */
|
|
||||||
{
|
|
||||||
if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
|
|
||||||
(PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
|
|
||||||
need_crc = 0;
|
|
||||||
}
|
|
||||||
else /* critical */
|
|
||||||
{
|
|
||||||
if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE)
|
|
||||||
need_crc = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (need_crc)
|
|
||||||
png_ptr->crc = crc32(png_ptr->crc, ptr, (uInt)length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate the memory for an info_struct for the application. We don't
|
|
||||||
* really need the png_ptr, but it could potentially be useful in the
|
|
||||||
* future. This should be used in favour of malloc(png_sizeof(png_info))
|
|
||||||
* and png_info_init() so that applications that want to use a shared
|
|
||||||
* libpng don't have to be recompiled if png_info changes size.
|
|
||||||
*/
|
|
||||||
png_infop PNGAPI
|
|
||||||
png_create_info_struct(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_infop info_ptr;
|
|
||||||
|
|
||||||
png_debug(1, "in png_create_info_struct\n");
|
|
||||||
if(png_ptr == NULL) return (NULL);
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
|
|
||||||
png_ptr->malloc_fn, png_ptr->mem_ptr);
|
|
||||||
#else
|
|
||||||
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
|
|
||||||
#endif
|
|
||||||
if (info_ptr != NULL)
|
|
||||||
png_info_init_3(&info_ptr, png_sizeof(png_info));
|
|
||||||
|
|
||||||
return (info_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function frees the memory associated with a single info struct.
|
|
||||||
* Normally, one would use either png_destroy_read_struct() or
|
|
||||||
* png_destroy_write_struct() to free an info struct, but this may be
|
|
||||||
* useful for some applications.
|
|
||||||
*/
|
|
||||||
void PNGAPI
|
|
||||||
png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
|
||||||
{
|
|
||||||
png_infop info_ptr = NULL;
|
|
||||||
|
|
||||||
png_debug(1, "in png_destroy_info_struct\n");
|
|
||||||
if (info_ptr_ptr != NULL)
|
|
||||||
info_ptr = *info_ptr_ptr;
|
|
||||||
|
|
||||||
if (info_ptr != NULL)
|
|
||||||
{
|
|
||||||
png_info_destroy(png_ptr, info_ptr);
|
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
png_destroy_struct_2((png_voidp)info_ptr, png_ptr->free_fn,
|
|
||||||
png_ptr->mem_ptr);
|
|
||||||
#else
|
|
||||||
png_destroy_struct((png_voidp)info_ptr);
|
|
||||||
#endif
|
|
||||||
*info_ptr_ptr = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the info structure. This is now an internal function (0.89)
|
|
||||||
* and applications using it are urged to use png_create_info_struct()
|
|
||||||
* instead.
|
|
||||||
*/
|
|
||||||
#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
|
|
||||||
#undef png_info_init
|
|
||||||
void PNGAPI
|
|
||||||
png_info_init(png_infop info_ptr)
|
|
||||||
{
|
|
||||||
/* We only come here via pre-1.0.12-compiled applications */
|
|
||||||
png_info_init_3(&info_ptr, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void PNGAPI
|
|
||||||
png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
|
|
||||||
{
|
|
||||||
png_infop info_ptr = *ptr_ptr;
|
|
||||||
|
|
||||||
png_debug(1, "in png_info_init_3\n");
|
|
||||||
|
|
||||||
if(png_sizeof(png_info) > png_info_struct_size)
|
|
||||||
{
|
|
||||||
png_destroy_struct(info_ptr);
|
|
||||||
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
|
|
||||||
*ptr_ptr = info_ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set everything to 0 */
|
|
||||||
png_memset(info_ptr, 0, png_sizeof (png_info));
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
void PNGAPI
|
|
||||||
png_data_freer(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
int freer, png_uint_32 mask)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_data_freer\n");
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
|
||||||
return;
|
|
||||||
if(freer == PNG_DESTROY_WILL_FREE_DATA)
|
|
||||||
info_ptr->free_me |= mask;
|
|
||||||
else if(freer == PNG_USER_WILL_FREE_DATA)
|
|
||||||
info_ptr->free_me &= ~mask;
|
|
||||||
else
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"Unknown freer parameter in png_data_freer.");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void PNGAPI
|
|
||||||
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
|
|
||||||
int num)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_free_data\n");
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if defined(PNG_TEXT_SUPPORTED)
|
|
||||||
/* free text item num or (if num == -1) all text items */
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
if ((mask & PNG_FREE_TEXT) & info_ptr->free_me)
|
|
||||||
#else
|
|
||||||
if (mask & PNG_FREE_TEXT)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (num != -1)
|
|
||||||
{
|
|
||||||
if (info_ptr->text && info_ptr->text[num].key)
|
|
||||||
{
|
|
||||||
png_free(png_ptr, info_ptr->text[num].key);
|
|
||||||
info_ptr->text[num].key = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < info_ptr->num_text; i++)
|
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, i);
|
|
||||||
png_free(png_ptr, info_ptr->text);
|
|
||||||
info_ptr->text = NULL;
|
|
||||||
info_ptr->num_text=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_tRNS_SUPPORTED)
|
|
||||||
/* free any tRNS entry */
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
if ((mask & PNG_FREE_TRNS) & info_ptr->free_me)
|
|
||||||
#else
|
|
||||||
if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS))
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
png_free(png_ptr, info_ptr->trans);
|
|
||||||
info_ptr->valid &= ~PNG_INFO_tRNS;
|
|
||||||
#ifndef PNG_FREE_ME_SUPPORTED
|
|
||||||
png_ptr->flags &= ~PNG_FLAG_FREE_TRNS;
|
|
||||||
#endif
|
|
||||||
info_ptr->trans = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_sCAL_SUPPORTED)
|
|
||||||
/* free any sCAL entry */
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
if ((mask & PNG_FREE_SCAL) & info_ptr->free_me)
|
|
||||||
#else
|
|
||||||
if (mask & PNG_FREE_SCAL)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
|
|
||||||
png_free(png_ptr, info_ptr->scal_s_width);
|
|
||||||
png_free(png_ptr, info_ptr->scal_s_height);
|
|
||||||
info_ptr->scal_s_width = NULL;
|
|
||||||
info_ptr->scal_s_height = NULL;
|
|
||||||
#endif
|
|
||||||
info_ptr->valid &= ~PNG_INFO_sCAL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_pCAL_SUPPORTED)
|
|
||||||
/* free any pCAL entry */
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
if ((mask & PNG_FREE_PCAL) & info_ptr->free_me)
|
|
||||||
#else
|
|
||||||
if (mask & PNG_FREE_PCAL)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
png_free(png_ptr, info_ptr->pcal_purpose);
|
|
||||||
png_free(png_ptr, info_ptr->pcal_units);
|
|
||||||
info_ptr->pcal_purpose = NULL;
|
|
||||||
info_ptr->pcal_units = NULL;
|
|
||||||
if (info_ptr->pcal_params != NULL)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < (int)info_ptr->pcal_nparams; i++)
|
|
||||||
{
|
|
||||||
png_free(png_ptr, info_ptr->pcal_params[i]);
|
|
||||||
info_ptr->pcal_params[i]=NULL;
|
|
||||||
}
|
|
||||||
png_free(png_ptr, info_ptr->pcal_params);
|
|
||||||
info_ptr->pcal_params = NULL;
|
|
||||||
}
|
|
||||||
info_ptr->valid &= ~PNG_INFO_pCAL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_iCCP_SUPPORTED)
|
|
||||||
/* free any iCCP entry */
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
if ((mask & PNG_FREE_ICCP) & info_ptr->free_me)
|
|
||||||
#else
|
|
||||||
if (mask & PNG_FREE_ICCP)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
png_free(png_ptr, info_ptr->iccp_name);
|
|
||||||
png_free(png_ptr, info_ptr->iccp_profile);
|
|
||||||
info_ptr->iccp_name = NULL;
|
|
||||||
info_ptr->iccp_profile = NULL;
|
|
||||||
info_ptr->valid &= ~PNG_INFO_iCCP;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_sPLT_SUPPORTED)
|
|
||||||
/* free a given sPLT entry, or (if num == -1) all sPLT entries */
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
if ((mask & PNG_FREE_SPLT) & info_ptr->free_me)
|
|
||||||
#else
|
|
||||||
if (mask & PNG_FREE_SPLT)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (num != -1)
|
|
||||||
{
|
|
||||||
if(info_ptr->splt_palettes)
|
|
||||||
{
|
|
||||||
png_free(png_ptr, info_ptr->splt_palettes[num].name);
|
|
||||||
png_free(png_ptr, info_ptr->splt_palettes[num].entries);
|
|
||||||
info_ptr->splt_palettes[num].name = NULL;
|
|
||||||
info_ptr->splt_palettes[num].entries = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(info_ptr->splt_palettes_num)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
|
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_SPLT, i);
|
|
||||||
|
|
||||||
png_free(png_ptr, info_ptr->splt_palettes);
|
|
||||||
info_ptr->splt_palettes = NULL;
|
|
||||||
info_ptr->splt_palettes_num = 0;
|
|
||||||
}
|
|
||||||
info_ptr->valid &= ~PNG_INFO_sPLT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
|
|
||||||
#else
|
|
||||||
if (mask & PNG_FREE_UNKN)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (num != -1)
|
|
||||||
{
|
|
||||||
if(info_ptr->unknown_chunks)
|
|
||||||
{
|
|
||||||
png_free(png_ptr, info_ptr->unknown_chunks[num].data);
|
|
||||||
info_ptr->unknown_chunks[num].data = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if(info_ptr->unknown_chunks_num)
|
|
||||||
{
|
|
||||||
for (i = 0; i < (int)info_ptr->unknown_chunks_num; i++)
|
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_UNKN, i);
|
|
||||||
|
|
||||||
png_free(png_ptr, info_ptr->unknown_chunks);
|
|
||||||
info_ptr->unknown_chunks = NULL;
|
|
||||||
info_ptr->unknown_chunks_num = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_hIST_SUPPORTED)
|
|
||||||
/* free any hIST entry */
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
if ((mask & PNG_FREE_HIST) & info_ptr->free_me)
|
|
||||||
#else
|
|
||||||
if ((mask & PNG_FREE_HIST) && (png_ptr->flags & PNG_FLAG_FREE_HIST))
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
png_free(png_ptr, info_ptr->hist);
|
|
||||||
info_ptr->hist = NULL;
|
|
||||||
info_ptr->valid &= ~PNG_INFO_hIST;
|
|
||||||
#ifndef PNG_FREE_ME_SUPPORTED
|
|
||||||
png_ptr->flags &= ~PNG_FLAG_FREE_HIST;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* free any PLTE entry that was internally allocated */
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
if ((mask & PNG_FREE_PLTE) & info_ptr->free_me)
|
|
||||||
#else
|
|
||||||
if ((mask & PNG_FREE_PLTE) && (png_ptr->flags & PNG_FLAG_FREE_PLTE))
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
png_zfree(png_ptr, info_ptr->palette);
|
|
||||||
info_ptr->palette = NULL;
|
|
||||||
info_ptr->valid &= ~PNG_INFO_PLTE;
|
|
||||||
#ifndef PNG_FREE_ME_SUPPORTED
|
|
||||||
png_ptr->flags &= ~PNG_FLAG_FREE_PLTE;
|
|
||||||
#endif
|
|
||||||
info_ptr->num_palette = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_INFO_IMAGE_SUPPORTED)
|
|
||||||
/* free any image bits attached to the info structure */
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
if ((mask & PNG_FREE_ROWS) & info_ptr->free_me)
|
|
||||||
#else
|
|
||||||
if (mask & PNG_FREE_ROWS)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if(info_ptr->row_pointers)
|
|
||||||
{
|
|
||||||
int row;
|
|
||||||
for (row = 0; row < (int)info_ptr->height; row++)
|
|
||||||
{
|
|
||||||
png_free(png_ptr, info_ptr->row_pointers[row]);
|
|
||||||
info_ptr->row_pointers[row]=NULL;
|
|
||||||
}
|
|
||||||
png_free(png_ptr, info_ptr->row_pointers);
|
|
||||||
info_ptr->row_pointers=NULL;
|
|
||||||
}
|
|
||||||
info_ptr->valid &= ~PNG_INFO_IDAT;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
if(num == -1)
|
|
||||||
info_ptr->free_me &= ~mask;
|
|
||||||
else
|
|
||||||
info_ptr->free_me &= ~(mask & ~PNG_FREE_MUL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is an internal routine to free any memory that the info struct is
|
|
||||||
* pointing to before re-using it or freeing the struct itself. Recall
|
|
||||||
* that png_free() checks for NULL pointers for us.
|
|
||||||
*/
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_info_destroy\n");
|
|
||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
|
||||||
|
|
||||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
|
||||||
if (png_ptr->num_chunk_list)
|
|
||||||
{
|
|
||||||
png_free(png_ptr, png_ptr->chunk_list);
|
|
||||||
png_ptr->chunk_list=NULL;
|
|
||||||
png_ptr->num_chunk_list=0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_info_init_3(&info_ptr, png_sizeof(png_info));
|
|
||||||
}
|
|
||||||
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
|
||||||
|
|
||||||
/* This function returns a pointer to the io_ptr associated with the user
|
|
||||||
* functions. The application should free any memory associated with this
|
|
||||||
* pointer before png_write_destroy() or png_read_destroy() are called.
|
|
||||||
*/
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_get_io_ptr(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return (png_ptr->io_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
|
||||||
/* Initialize the default input/output functions for the PNG file. If you
|
|
||||||
* use your own read or write routines, you can call either png_set_read_fn()
|
|
||||||
* or png_set_write_fn() instead of png_init_io(). If you have defined
|
|
||||||
* PNG_NO_STDIO, you must use a function of your own because "FILE *" isn't
|
|
||||||
* necessarily available.
|
|
||||||
*/
|
|
||||||
void PNGAPI
|
|
||||||
png_init_io(png_structp png_ptr, png_FILE_p fp)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_init_io\n");
|
|
||||||
png_ptr->io_ptr = (png_voidp)fp;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_TIME_RFC1123_SUPPORTED)
|
|
||||||
/* Convert the supplied time into an RFC 1123 string suitable for use in
|
|
||||||
* a "Creation Time" or other text-based time string.
|
|
||||||
*/
|
|
||||||
png_charp PNGAPI
|
|
||||||
png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|
||||||
{
|
|
||||||
static PNG_CONST char short_months[12][4] =
|
|
||||||
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
|
||||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
|
||||||
|
|
||||||
if (png_ptr->time_buffer == NULL)
|
|
||||||
{
|
|
||||||
png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29*
|
|
||||||
png_sizeof(char)));
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
{
|
|
||||||
wchar_t time_buf[29];
|
|
||||||
wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"),
|
|
||||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
|
||||||
ptime->second % 61);
|
|
||||||
WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29,
|
|
||||||
NULL, NULL);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#ifdef USE_FAR_KEYWORD
|
|
||||||
{
|
|
||||||
char near_time_buf[29];
|
|
||||||
sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000",
|
|
||||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
|
||||||
ptime->second % 61);
|
|
||||||
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
|
||||||
29*png_sizeof(char));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
|
|
||||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
|
||||||
ptime->second % 61);
|
|
||||||
#endif
|
|
||||||
#endif /* _WIN32_WCE */
|
|
||||||
return ((png_charp)png_ptr->time_buffer);
|
|
||||||
}
|
|
||||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Signature string for a PNG file. */
|
|
||||||
png_bytep PNGAPI
|
|
||||||
png_sig_bytes(void)
|
|
||||||
{
|
|
||||||
return ((png_bytep)"\211\120\116\107\015\012\032\012");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
|
||||||
|
|
||||||
png_charp PNGAPI
|
|
||||||
png_get_copyright(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
|
||||||
return ((png_charp) "\n libpng version 1.2.10 - April 23, 2006\n\
|
|
||||||
Copyright (c) 1998-2006 Glenn Randers-Pehrson\n\
|
|
||||||
Copyright (c) 1996-1997 Andreas Dilger\n\
|
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
|
|
||||||
return ((png_charp) "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The following return the library version as a short string in the
|
|
||||||
* format 1.0.0 through 99.99.99zz. To get the version of *.h files
|
|
||||||
* used with your application, print out PNG_LIBPNG_VER_STRING, which
|
|
||||||
* is defined in png.h.
|
|
||||||
* Note: now there is no difference between png_get_libpng_ver() and
|
|
||||||
* png_get_header_ver(). Due to the version_nn_nn_nn typedef guard,
|
|
||||||
* it is guaranteed that png.c uses the correct version of png.h.
|
|
||||||
*/
|
|
||||||
png_charp PNGAPI
|
|
||||||
png_get_libpng_ver(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
/* Version of *.c files used when building libpng */
|
|
||||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
|
||||||
return ((png_charp) PNG_LIBPNG_VER_STRING);
|
|
||||||
return ((png_charp) "");
|
|
||||||
}
|
|
||||||
|
|
||||||
png_charp PNGAPI
|
|
||||||
png_get_header_ver(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
/* Version of *.h files used when building libpng */
|
|
||||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
|
||||||
return ((png_charp) PNG_LIBPNG_VER_STRING);
|
|
||||||
return ((png_charp) "");
|
|
||||||
}
|
|
||||||
|
|
||||||
png_charp PNGAPI
|
|
||||||
png_get_header_version(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
/* Returns longer string containing both version and date */
|
|
||||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
|
||||||
return ((png_charp) PNG_HEADER_VERSION_STRING);
|
|
||||||
return ((png_charp) "");
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
|
||||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
|
||||||
int PNGAPI
|
|
||||||
png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
|
|
||||||
{
|
|
||||||
/* check chunk_name and return "keep" value if it's on the list, else 0 */
|
|
||||||
int i;
|
|
||||||
png_bytep p;
|
|
||||||
if((png_ptr == NULL && chunk_name == NULL) || png_ptr->num_chunk_list<=0)
|
|
||||||
return 0;
|
|
||||||
p=png_ptr->chunk_list+png_ptr->num_chunk_list*5-5;
|
|
||||||
for (i = png_ptr->num_chunk_list; i; i--, p-=5)
|
|
||||||
if (!png_memcmp(chunk_name, p, 4))
|
|
||||||
return ((int)*(p+4));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This function, added to libpng-1.0.6g, is untested. */
|
|
||||||
int PNGAPI
|
|
||||||
png_reset_zstream(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return (inflateReset(&png_ptr->zstream));
|
|
||||||
}
|
|
||||||
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
|
||||||
|
|
||||||
/* This function was added to libpng-1.0.7 */
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_access_version_number(void)
|
|
||||||
{
|
|
||||||
/* Version of *.c files used when building libpng */
|
|
||||||
return((png_uint_32) PNG_LIBPNG_VER);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED)
|
|
||||||
#if !defined(PNG_1_0_X)
|
|
||||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
|
||||||
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
|
|
||||||
/* this INTERNAL function was added to libpng 1.2.0 */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_init_mmx_flags (png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_ptr->mmx_rowbytes_threshold = 0;
|
|
||||||
png_ptr->mmx_bitdepth_threshold = 0;
|
|
||||||
|
|
||||||
# if (defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD))
|
|
||||||
|
|
||||||
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_COMPILED;
|
|
||||||
|
|
||||||
if (png_mmx_support() > 0) {
|
|
||||||
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
|
||||||
# ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_COMBINE_ROW
|
|
||||||
# endif
|
|
||||||
# ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_INTERLACE
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
|
||||||
;
|
|
||||||
# else
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_UP
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
|
||||||
|
|
||||||
png_ptr->mmx_rowbytes_threshold = PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT;
|
|
||||||
png_ptr->mmx_bitdepth_threshold = PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT;
|
|
||||||
# endif
|
|
||||||
} else {
|
|
||||||
png_ptr->asm_flags &= ~( PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
|
||||||
| PNG_MMX_READ_FLAGS
|
|
||||||
| PNG_MMX_WRITE_FLAGS );
|
|
||||||
}
|
|
||||||
|
|
||||||
# else /* !((PNGVCRD || PNGGCCRD) && PNG_ASSEMBLER_CODE_SUPPORTED)) */
|
|
||||||
|
|
||||||
/* clear all MMX flags; no support is compiled in */
|
|
||||||
png_ptr->asm_flags &= ~( PNG_MMX_FLAGS );
|
|
||||||
|
|
||||||
# endif /* ?(PNGVCRD || PNGGCCRD) */
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !(PNG_ASSEMBLER_CODE_SUPPORTED) */
|
|
||||||
|
|
||||||
/* this function was added to libpng 1.2.0 */
|
|
||||||
#if !defined(PNG_USE_PNGGCCRD) && \
|
|
||||||
!(defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD))
|
|
||||||
int PNGAPI
|
|
||||||
png_mmx_support(void)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_1_0_X */
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
|
||||||
#ifdef PNG_SIZE_T
|
|
||||||
/* Added at libpng version 1.2.6 */
|
|
||||||
PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));
|
|
||||||
png_size_t PNGAPI
|
|
||||||
png_convert_size(size_t size)
|
|
||||||
{
|
|
||||||
if (size > (png_size_t)-1)
|
|
||||||
PNG_ABORT(); /* We haven't got access to png_ptr, so no png_error() */
|
|
||||||
return ((png_size_t)size);
|
|
||||||
}
|
|
||||||
#endif /* PNG_SIZE_T */
|
|
||||||
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,313 +0,0 @@
|
||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
|
||||||
*
|
|
||||||
* Last changed in libpng 1.2.9 April 14, 2006
|
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*
|
|
||||||
* This file provides a location for all error handling. Users who
|
|
||||||
* need special error handling are expected to write replacement functions
|
|
||||||
* and use png_set_error_fn() to use those functions. See the instructions
|
|
||||||
* at each function.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
|
||||||
static void /* PRIVATE */
|
|
||||||
png_default_error PNGARG((png_structp png_ptr,
|
|
||||||
png_const_charp error_message));
|
|
||||||
static void /* PRIVATE */
|
|
||||||
png_default_warning PNGARG((png_structp png_ptr,
|
|
||||||
png_const_charp warning_message));
|
|
||||||
|
|
||||||
/* This function is called whenever there is a fatal error. This function
|
|
||||||
* should not be changed. If there is a need to handle errors differently,
|
|
||||||
* you should supply a replacement error function and use png_set_error_fn()
|
|
||||||
* to replace the error function at run-time.
|
|
||||||
*/
|
|
||||||
void PNGAPI
|
|
||||||
png_error(png_structp png_ptr, png_const_charp error_message)
|
|
||||||
{
|
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
||||||
char msg[16];
|
|
||||||
if (png_ptr != NULL)
|
|
||||||
{
|
|
||||||
if (png_ptr->flags&
|
|
||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
|
||||||
{
|
|
||||||
if (*error_message == '#')
|
|
||||||
{
|
|
||||||
int offset;
|
|
||||||
for (offset=1; offset<15; offset++)
|
|
||||||
if (*(error_message+offset) == ' ')
|
|
||||||
break;
|
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i=0; i<offset-1; i++)
|
|
||||||
msg[i]=error_message[i+1];
|
|
||||||
msg[i]='\0';
|
|
||||||
error_message=msg;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
error_message+=offset;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
|
||||||
{
|
|
||||||
msg[0]='0';
|
|
||||||
msg[1]='\0';
|
|
||||||
error_message=msg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
|
||||||
(*(png_ptr->error_fn))(png_ptr, error_message);
|
|
||||||
|
|
||||||
/* If the custom handler doesn't exist, or if it returns,
|
|
||||||
use the default handler, which will not return. */
|
|
||||||
png_default_error(png_ptr, error_message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function is called whenever there is a non-fatal error. This function
|
|
||||||
* should not be changed. If there is a need to handle warnings differently,
|
|
||||||
* you should supply a replacement warning function and use
|
|
||||||
* png_set_error_fn() to replace the warning function at run-time.
|
|
||||||
*/
|
|
||||||
void PNGAPI
|
|
||||||
png_warning(png_structp png_ptr, png_const_charp warning_message)
|
|
||||||
{
|
|
||||||
int offset = 0;
|
|
||||||
if (png_ptr != NULL)
|
|
||||||
{
|
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
||||||
if (png_ptr->flags&
|
|
||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (*warning_message == '#')
|
|
||||||
{
|
|
||||||
for (offset=1; offset<15; offset++)
|
|
||||||
if (*(warning_message+offset) == ' ')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
|
||||||
(*(png_ptr->warning_fn))(png_ptr, warning_message+offset);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
png_default_warning(png_ptr, warning_message+offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* These utilities are used internally to build an error message that relates
|
|
||||||
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
|
||||||
* this is used to prefix the message. The message is limited in length
|
|
||||||
* to 63 bytes, the name characters are output as hex digits wrapped in []
|
|
||||||
* if the character is invalid.
|
|
||||||
*/
|
|
||||||
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
|
||||||
static PNG_CONST char png_digit[16] = {
|
|
||||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
|
||||||
'A', 'B', 'C', 'D', 'E', 'F'
|
|
||||||
};
|
|
||||||
|
|
||||||
static void /* PRIVATE */
|
|
||||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
|
||||||
error_message)
|
|
||||||
{
|
|
||||||
int iout = 0, iin = 0;
|
|
||||||
|
|
||||||
while (iin < 4)
|
|
||||||
{
|
|
||||||
int c = png_ptr->chunk_name[iin++];
|
|
||||||
if (isnonalpha(c))
|
|
||||||
{
|
|
||||||
buffer[iout++] = '[';
|
|
||||||
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
|
||||||
buffer[iout++] = png_digit[c & 0x0f];
|
|
||||||
buffer[iout++] = ']';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buffer[iout++] = (png_byte)c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error_message == NULL)
|
|
||||||
buffer[iout] = 0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buffer[iout++] = ':';
|
|
||||||
buffer[iout++] = ' ';
|
|
||||||
png_strncpy(buffer+iout, error_message, 63);
|
|
||||||
buffer[iout+63] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PNGAPI
|
|
||||||
png_chunk_error(png_structp png_ptr, png_const_charp error_message)
|
|
||||||
{
|
|
||||||
char msg[18+64];
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
png_error(png_ptr, error_message);
|
|
||||||
png_format_buffer(png_ptr, msg, error_message);
|
|
||||||
png_error(png_ptr, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PNGAPI
|
|
||||||
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
|
||||||
{
|
|
||||||
char msg[18+64];
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
png_warning(png_ptr, warning_message);
|
|
||||||
png_format_buffer(png_ptr, msg, warning_message);
|
|
||||||
png_warning(png_ptr, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is the default error handling function. Note that replacements for
|
|
||||||
* this function MUST NOT RETURN, or the program will likely crash. This
|
|
||||||
* function is used by default, or if the program supplies NULL for the
|
|
||||||
* error function pointer in png_set_error_fn().
|
|
||||||
*/
|
|
||||||
static void /* PRIVATE */
|
|
||||||
png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|
||||||
{
|
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
||||||
if (*error_message == '#')
|
|
||||||
{
|
|
||||||
int offset;
|
|
||||||
char error_number[16];
|
|
||||||
for (offset=0; offset<15; offset++)
|
|
||||||
{
|
|
||||||
error_number[offset] = *(error_message+offset+1);
|
|
||||||
if (*(error_message+offset) == ' ')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if((offset > 1) && (offset < 15))
|
|
||||||
{
|
|
||||||
error_number[offset-1]='\0';
|
|
||||||
fprintf(stderr, "libpng error no. %s: %s\n", error_number,
|
|
||||||
error_message+offset);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fprintf(stderr, "libpng error: %s, offset=%d\n", error_message,offset);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
fprintf(stderr, "libpng error: %s\n", error_message);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
|
||||||
# ifdef USE_FAR_KEYWORD
|
|
||||||
{
|
|
||||||
jmp_buf jmpbuf;
|
|
||||||
png_memcpy(jmpbuf,png_ptr->jmpbuf,png_sizeof(jmp_buf));
|
|
||||||
longjmp(jmpbuf, 1);
|
|
||||||
}
|
|
||||||
# else
|
|
||||||
longjmp(png_ptr->jmpbuf, 1);
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
/* make compiler happy */ ;
|
|
||||||
if (png_ptr)
|
|
||||||
PNG_ABORT();
|
|
||||||
#endif
|
|
||||||
#ifdef PNG_NO_CONSOLE_IO
|
|
||||||
/* make compiler happy */ ;
|
|
||||||
if (&error_message != NULL)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function is called when there is a warning, but the library thinks
|
|
||||||
* it can continue anyway. Replacement functions don't have to do anything
|
|
||||||
* here if you don't want them to. In the default configuration, png_ptr is
|
|
||||||
* not used, but it is passed in case it may be useful.
|
|
||||||
*/
|
|
||||||
static void /* PRIVATE */
|
|
||||||
png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|
||||||
{
|
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
|
||||||
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
||||||
if (*warning_message == '#')
|
|
||||||
{
|
|
||||||
int offset;
|
|
||||||
char warning_number[16];
|
|
||||||
for (offset=0; offset<15; offset++)
|
|
||||||
{
|
|
||||||
warning_number[offset]=*(warning_message+offset+1);
|
|
||||||
if (*(warning_message+offset) == ' ')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if((offset > 1) && (offset < 15))
|
|
||||||
{
|
|
||||||
warning_number[offset-1]='\0';
|
|
||||||
fprintf(stderr, "libpng warning no. %s: %s\n", warning_number,
|
|
||||||
warning_message+offset);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
|
||||||
#else
|
|
||||||
/* make compiler happy */ ;
|
|
||||||
if (warning_message)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
/* make compiler happy */ ;
|
|
||||||
if (png_ptr)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function is called when the application wants to use another method
|
|
||||||
* of handling errors and warnings. Note that the error function MUST NOT
|
|
||||||
* return to the calling routine or serious problems will occur. The return
|
|
||||||
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1)
|
|
||||||
*/
|
|
||||||
void PNGAPI
|
|
||||||
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
|
||||||
png_error_ptr error_fn, png_error_ptr warning_fn)
|
|
||||||
{
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
png_ptr->error_ptr = error_ptr;
|
|
||||||
png_ptr->error_fn = error_fn;
|
|
||||||
png_ptr->warning_fn = warning_fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* This function returns a pointer to the error_ptr associated with the user
|
|
||||||
* functions. The application should free any memory associated with this
|
|
||||||
* pointer before png_write_destroy and png_read_destroy are called.
|
|
||||||
*/
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_get_error_ptr(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return NULL;
|
|
||||||
return ((png_voidp)png_ptr->error_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
||||||
void PNGAPI
|
|
||||||
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
|
||||||
{
|
|
||||||
if(png_ptr != NULL)
|
|
||||||
{
|
|
||||||
png_ptr->flags &=
|
|
||||||
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
|
|
@ -1,937 +0,0 @@
|
||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
|
||||||
*
|
|
||||||
* Last changed in libpng 1.2.9 April 14, 2006
|
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
return(info_ptr->valid & flag);
|
|
||||||
else
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
return(info_ptr->rowbytes);
|
|
||||||
else
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_INFO_IMAGE_SUPPORTED)
|
|
||||||
png_bytepp PNGAPI
|
|
||||||
png_get_rows(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
return(info_ptr->row_pointers);
|
|
||||||
else
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
|
||||||
/* easy access to info, added in libpng-0.99 */
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_image_width(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
{
|
|
||||||
return info_ptr->width;
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_image_height(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
{
|
|
||||||
return info_ptr->height;
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_byte PNGAPI
|
|
||||||
png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
{
|
|
||||||
return info_ptr->bit_depth;
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_byte PNGAPI
|
|
||||||
png_get_color_type(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
{
|
|
||||||
return info_ptr->color_type;
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_byte PNGAPI
|
|
||||||
png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
{
|
|
||||||
return info_ptr->filter_type;
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_byte PNGAPI
|
|
||||||
png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
{
|
|
||||||
return info_ptr->interlace_type;
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_byte PNGAPI
|
|
||||||
png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
{
|
|
||||||
return info_ptr->compression_type;
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
#if defined(PNG_pHYs_SUPPORTED)
|
|
||||||
if (info_ptr->valid & PNG_INFO_pHYs)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter");
|
|
||||||
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
|
||||||
return (0);
|
|
||||||
else return (info_ptr->x_pixels_per_unit);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return (0);
|
|
||||||
#endif
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
#if defined(PNG_pHYs_SUPPORTED)
|
|
||||||
if (info_ptr->valid & PNG_INFO_pHYs)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
|
|
||||||
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
|
||||||
return (0);
|
|
||||||
else return (info_ptr->y_pixels_per_unit);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return (0);
|
|
||||||
#endif
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
#if defined(PNG_pHYs_SUPPORTED)
|
|
||||||
if (info_ptr->valid & PNG_INFO_pHYs)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter");
|
|
||||||
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
|
|
||||||
info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
|
|
||||||
return (0);
|
|
||||||
else return (info_ptr->x_pixels_per_unit);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return (0);
|
|
||||||
#endif
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
||||||
float PNGAPI
|
|
||||||
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
#if defined(PNG_pHYs_SUPPORTED)
|
|
||||||
if (info_ptr->valid & PNG_INFO_pHYs)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio");
|
|
||||||
if (info_ptr->x_pixels_per_unit == 0)
|
|
||||||
return ((float)0.0);
|
|
||||||
else
|
|
||||||
return ((float)((float)info_ptr->y_pixels_per_unit
|
|
||||||
/(float)info_ptr->x_pixels_per_unit));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return (0.0);
|
|
||||||
#endif
|
|
||||||
return ((float)0.0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_int_32 PNGAPI
|
|
||||||
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
#if defined(PNG_oFFs_SUPPORTED)
|
|
||||||
if (info_ptr->valid & PNG_INFO_oFFs)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
|
|
||||||
if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
|
|
||||||
return (0);
|
|
||||||
else return (info_ptr->x_offset);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return (0);
|
|
||||||
#endif
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_int_32 PNGAPI
|
|
||||||
png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
#if defined(PNG_oFFs_SUPPORTED)
|
|
||||||
if (info_ptr->valid & PNG_INFO_oFFs)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
|
|
||||||
if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
|
|
||||||
return (0);
|
|
||||||
else return (info_ptr->y_offset);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return (0);
|
|
||||||
#endif
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_int_32 PNGAPI
|
|
||||||
png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
#if defined(PNG_oFFs_SUPPORTED)
|
|
||||||
if (info_ptr->valid & PNG_INFO_oFFs)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
|
|
||||||
if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
|
|
||||||
return (0);
|
|
||||||
else return (info_ptr->x_offset);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return (0);
|
|
||||||
#endif
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_int_32 PNGAPI
|
|
||||||
png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
#if defined(PNG_oFFs_SUPPORTED)
|
|
||||||
if (info_ptr->valid & PNG_INFO_oFFs)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
|
|
||||||
if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
|
|
||||||
return (0);
|
|
||||||
else return (info_ptr->y_offset);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return (0);
|
|
||||||
#endif
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr)
|
|
||||||
*.0254 +.5));
|
|
||||||
}
|
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr)
|
|
||||||
*.0254 +.5));
|
|
||||||
}
|
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr)
|
|
||||||
*.0254 +.5));
|
|
||||||
}
|
|
||||||
|
|
||||||
float PNGAPI
|
|
||||||
png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
return ((float)png_get_x_offset_microns(png_ptr, info_ptr)
|
|
||||||
*.00003937);
|
|
||||||
}
|
|
||||||
|
|
||||||
float PNGAPI
|
|
||||||
png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
return ((float)png_get_y_offset_microns(png_ptr, info_ptr)
|
|
||||||
*.00003937);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_pHYs_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
|
||||||
{
|
|
||||||
png_uint_32 retval = 0;
|
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "pHYs");
|
|
||||||
if (res_x != NULL)
|
|
||||||
{
|
|
||||||
*res_x = info_ptr->x_pixels_per_unit;
|
|
||||||
retval |= PNG_INFO_pHYs;
|
|
||||||
}
|
|
||||||
if (res_y != NULL)
|
|
||||||
{
|
|
||||||
*res_y = info_ptr->y_pixels_per_unit;
|
|
||||||
retval |= PNG_INFO_pHYs;
|
|
||||||
}
|
|
||||||
if (unit_type != NULL)
|
|
||||||
{
|
|
||||||
*unit_type = (int)info_ptr->phys_unit_type;
|
|
||||||
retval |= PNG_INFO_pHYs;
|
|
||||||
if(*unit_type == 1)
|
|
||||||
{
|
|
||||||
if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
|
|
||||||
if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (retval);
|
|
||||||
}
|
|
||||||
#endif /* PNG_pHYs_SUPPORTED */
|
|
||||||
#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
|
|
||||||
|
|
||||||
/* png_get_channels really belongs in here, too, but it's been around longer */
|
|
||||||
|
|
||||||
#endif /* PNG_EASY_ACCESS_SUPPORTED */
|
|
||||||
|
|
||||||
png_byte PNGAPI
|
|
||||||
png_get_channels(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
return(info_ptr->channels);
|
|
||||||
else
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_bytep PNGAPI
|
|
||||||
png_get_signature(png_structp png_ptr, png_infop info_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
|
||||||
return(info_ptr->signature);
|
|
||||||
else
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_bKGD_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_color_16p *background)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
|
|
||||||
&& background != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "bKGD");
|
|
||||||
*background = &(info_ptr->background);
|
|
||||||
return (PNG_INFO_bKGD);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_cHRM_SUPPORTED)
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
double *white_x, double *white_y, double *red_x, double *red_y,
|
|
||||||
double *green_x, double *green_y, double *blue_x, double *blue_y)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "cHRM");
|
|
||||||
if (white_x != NULL)
|
|
||||||
*white_x = (double)info_ptr->x_white;
|
|
||||||
if (white_y != NULL)
|
|
||||||
*white_y = (double)info_ptr->y_white;
|
|
||||||
if (red_x != NULL)
|
|
||||||
*red_x = (double)info_ptr->x_red;
|
|
||||||
if (red_y != NULL)
|
|
||||||
*red_y = (double)info_ptr->y_red;
|
|
||||||
if (green_x != NULL)
|
|
||||||
*green_x = (double)info_ptr->x_green;
|
|
||||||
if (green_y != NULL)
|
|
||||||
*green_y = (double)info_ptr->y_green;
|
|
||||||
if (blue_x != NULL)
|
|
||||||
*blue_x = (double)info_ptr->x_blue;
|
|
||||||
if (blue_y != NULL)
|
|
||||||
*blue_y = (double)info_ptr->y_blue;
|
|
||||||
return (PNG_INFO_cHRM);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
|
|
||||||
png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
|
|
||||||
png_fixed_point *blue_x, png_fixed_point *blue_y)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "cHRM");
|
|
||||||
if (white_x != NULL)
|
|
||||||
*white_x = info_ptr->int_x_white;
|
|
||||||
if (white_y != NULL)
|
|
||||||
*white_y = info_ptr->int_y_white;
|
|
||||||
if (red_x != NULL)
|
|
||||||
*red_x = info_ptr->int_x_red;
|
|
||||||
if (red_y != NULL)
|
|
||||||
*red_y = info_ptr->int_y_red;
|
|
||||||
if (green_x != NULL)
|
|
||||||
*green_x = info_ptr->int_x_green;
|
|
||||||
if (green_y != NULL)
|
|
||||||
*green_y = info_ptr->int_y_green;
|
|
||||||
if (blue_x != NULL)
|
|
||||||
*blue_x = info_ptr->int_x_blue;
|
|
||||||
if (blue_y != NULL)
|
|
||||||
*blue_y = info_ptr->int_y_blue;
|
|
||||||
return (PNG_INFO_cHRM);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_gAMA_SUPPORTED)
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
|
|
||||||
&& file_gamma != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "gAMA");
|
|
||||||
*file_gamma = (double)info_ptr->gamma;
|
|
||||||
return (PNG_INFO_gAMA);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_fixed_point *int_file_gamma)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
|
|
||||||
&& int_file_gamma != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "gAMA");
|
|
||||||
*int_file_gamma = info_ptr->int_gamma;
|
|
||||||
return (PNG_INFO_gAMA);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_sRGB_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
|
|
||||||
&& file_srgb_intent != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "sRGB");
|
|
||||||
*file_srgb_intent = (int)info_ptr->srgb_intent;
|
|
||||||
return (PNG_INFO_sRGB);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_iCCP_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_charpp name, int *compression_type,
|
|
||||||
png_charpp profile, png_uint_32 *proflen)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
|
|
||||||
&& name != NULL && profile != NULL && proflen != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "iCCP");
|
|
||||||
*name = info_ptr->iccp_name;
|
|
||||||
*profile = info_ptr->iccp_profile;
|
|
||||||
/* compression_type is a dummy so the API won't have to change
|
|
||||||
if we introduce multiple compression types later. */
|
|
||||||
*proflen = (int)info_ptr->iccp_proflen;
|
|
||||||
*compression_type = (int)info_ptr->iccp_compression;
|
|
||||||
return (PNG_INFO_iCCP);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_sPLT_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_sPLT_tpp spalettes)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
|
|
||||||
*spalettes = info_ptr->splt_palettes;
|
|
||||||
return ((png_uint_32)info_ptr->splt_palettes_num);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_hIST_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
|
|
||||||
&& hist != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "hIST");
|
|
||||||
*hist = info_ptr->hist;
|
|
||||||
return (PNG_INFO_hIST);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_uint_32 *width, png_uint_32 *height, int *bit_depth,
|
|
||||||
int *color_type, int *interlace_type, int *compression_type,
|
|
||||||
int *filter_type)
|
|
||||||
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
|
|
||||||
bit_depth != NULL && color_type != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "IHDR");
|
|
||||||
*width = info_ptr->width;
|
|
||||||
*height = info_ptr->height;
|
|
||||||
*bit_depth = info_ptr->bit_depth;
|
|
||||||
if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16)
|
|
||||||
png_error(png_ptr, "Invalid bit depth");
|
|
||||||
*color_type = info_ptr->color_type;
|
|
||||||
if (info_ptr->color_type > 6)
|
|
||||||
png_error(png_ptr, "Invalid color type");
|
|
||||||
if (compression_type != NULL)
|
|
||||||
*compression_type = info_ptr->compression_type;
|
|
||||||
if (filter_type != NULL)
|
|
||||||
*filter_type = info_ptr->filter_type;
|
|
||||||
if (interlace_type != NULL)
|
|
||||||
*interlace_type = info_ptr->interlace_type;
|
|
||||||
|
|
||||||
/* check for potential overflow of rowbytes */
|
|
||||||
if (*width == 0 || *width > PNG_UINT_31_MAX)
|
|
||||||
png_error(png_ptr, "Invalid image width");
|
|
||||||
if (*height == 0 || *height > PNG_UINT_31_MAX)
|
|
||||||
png_error(png_ptr, "Invalid image height");
|
|
||||||
if (info_ptr->width > (PNG_UINT_32_MAX
|
|
||||||
>> 3) /* 8-byte RGBA pixels */
|
|
||||||
- 64 /* bigrowbuf hack */
|
|
||||||
- 1 /* filter byte */
|
|
||||||
- 7*8 /* rounding of width to multiple of 8 pixels */
|
|
||||||
- 8) /* extra max_pixel_depth pad */
|
|
||||||
{
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"Width too large for libpng to process image data.");
|
|
||||||
}
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_oFFs_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
|
|
||||||
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "oFFs");
|
|
||||||
*offset_x = info_ptr->x_offset;
|
|
||||||
*offset_y = info_ptr->y_offset;
|
|
||||||
*unit_type = (int)info_ptr->offset_unit_type;
|
|
||||||
return (PNG_INFO_oFFs);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_pCAL_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
|
|
||||||
png_charp *units, png_charpp *params)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
|
|
||||||
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
|
|
||||||
nparams != NULL && units != NULL && params != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "pCAL");
|
|
||||||
*purpose = info_ptr->pcal_purpose;
|
|
||||||
*X0 = info_ptr->pcal_X0;
|
|
||||||
*X1 = info_ptr->pcal_X1;
|
|
||||||
*type = (int)info_ptr->pcal_type;
|
|
||||||
*nparams = (int)info_ptr->pcal_nparams;
|
|
||||||
*units = info_ptr->pcal_units;
|
|
||||||
*params = info_ptr->pcal_params;
|
|
||||||
return (PNG_INFO_pCAL);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_sCAL_SUPPORTED)
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
int *unit, double *width, double *height)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
|
||||||
(info_ptr->valid & PNG_INFO_sCAL))
|
|
||||||
{
|
|
||||||
*unit = info_ptr->scal_unit;
|
|
||||||
*width = info_ptr->scal_pixel_width;
|
|
||||||
*height = info_ptr->scal_pixel_height;
|
|
||||||
return (PNG_INFO_sCAL);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
int *unit, png_charpp width, png_charpp height)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
|
||||||
(info_ptr->valid & PNG_INFO_sCAL))
|
|
||||||
{
|
|
||||||
*unit = info_ptr->scal_unit;
|
|
||||||
*width = info_ptr->scal_s_width;
|
|
||||||
*height = info_ptr->scal_s_height;
|
|
||||||
return (PNG_INFO_sCAL);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_pHYs_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
|
||||||
{
|
|
||||||
png_uint_32 retval = 0;
|
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
|
||||||
(info_ptr->valid & PNG_INFO_pHYs))
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "pHYs");
|
|
||||||
if (res_x != NULL)
|
|
||||||
{
|
|
||||||
*res_x = info_ptr->x_pixels_per_unit;
|
|
||||||
retval |= PNG_INFO_pHYs;
|
|
||||||
}
|
|
||||||
if (res_y != NULL)
|
|
||||||
{
|
|
||||||
*res_y = info_ptr->y_pixels_per_unit;
|
|
||||||
retval |= PNG_INFO_pHYs;
|
|
||||||
}
|
|
||||||
if (unit_type != NULL)
|
|
||||||
{
|
|
||||||
*unit_type = (int)info_ptr->phys_unit_type;
|
|
||||||
retval |= PNG_INFO_pHYs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (retval);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
|
|
||||||
int *num_palette)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
|
|
||||||
&& palette != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "PLTE");
|
|
||||||
*palette = info_ptr->palette;
|
|
||||||
*num_palette = info_ptr->num_palette;
|
|
||||||
png_debug1(3, "num_palette = %d\n", *num_palette);
|
|
||||||
return (PNG_INFO_PLTE);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_sBIT_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
|
|
||||||
&& sig_bit != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "sBIT");
|
|
||||||
*sig_bit = &(info_ptr->sig_bit);
|
|
||||||
return (PNG_INFO_sBIT);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_TEXT_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
|
|
||||||
int *num_text)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n",
|
|
||||||
(png_ptr->chunk_name[0] == '\0' ? "text"
|
|
||||||
: (png_const_charp)png_ptr->chunk_name));
|
|
||||||
if (text_ptr != NULL)
|
|
||||||
*text_ptr = info_ptr->text;
|
|
||||||
if (num_text != NULL)
|
|
||||||
*num_text = info_ptr->num_text;
|
|
||||||
return ((png_uint_32)info_ptr->num_text);
|
|
||||||
}
|
|
||||||
if (num_text != NULL)
|
|
||||||
*num_text = 0;
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_tIME_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
|
|
||||||
&& mod_time != NULL)
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "tIME");
|
|
||||||
*mod_time = &(info_ptr->mod_time);
|
|
||||||
return (PNG_INFO_tIME);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_tRNS_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_bytep *trans, int *num_trans, png_color_16p *trans_values)
|
|
||||||
{
|
|
||||||
png_uint_32 retval = 0;
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
|
|
||||||
{
|
|
||||||
png_debug1(1, "in %s retrieval function\n", "tRNS");
|
|
||||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
|
||||||
{
|
|
||||||
if (trans != NULL)
|
|
||||||
{
|
|
||||||
*trans = info_ptr->trans;
|
|
||||||
retval |= PNG_INFO_tRNS;
|
|
||||||
}
|
|
||||||
if (trans_values != NULL)
|
|
||||||
*trans_values = &(info_ptr->trans_values);
|
|
||||||
}
|
|
||||||
else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
|
|
||||||
{
|
|
||||||
if (trans_values != NULL)
|
|
||||||
{
|
|
||||||
*trans_values = &(info_ptr->trans_values);
|
|
||||||
retval |= PNG_INFO_tRNS;
|
|
||||||
}
|
|
||||||
if(trans != NULL)
|
|
||||||
*trans = NULL;
|
|
||||||
}
|
|
||||||
if(num_trans != NULL)
|
|
||||||
{
|
|
||||||
*num_trans = info_ptr->num_trans;
|
|
||||||
retval |= PNG_INFO_tRNS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (retval);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
|
|
||||||
png_unknown_chunkpp unknowns)
|
|
||||||
{
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
|
|
||||||
*unknowns = info_ptr->unknown_chunks;
|
|
||||||
return ((png_uint_32)info_ptr->unknown_chunks_num);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
|
||||||
png_byte PNGAPI
|
|
||||||
png_get_rgb_to_gray_status (png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_USER_CHUNKS_SUPPORTED)
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_get_user_chunk_ptr(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return (png_ptr? png_ptr->user_chunk_ptr : NULL);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_compression_buffer_size(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PNG_1_0_X
|
|
||||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
|
||||||
/* this function was added to libpng 1.2.0 and should exist by default */
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_asm_flags (png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return (png_uint_32)(png_ptr? png_ptr->asm_flags : 0L);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this function was added to libpng 1.2.0 and should exist by default */
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_asm_flagmask (int flag_select)
|
|
||||||
{
|
|
||||||
png_uint_32 settable_asm_flags = 0;
|
|
||||||
|
|
||||||
if (flag_select & PNG_SELECT_READ)
|
|
||||||
settable_asm_flags |=
|
|
||||||
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
|
|
||||||
PNG_ASM_FLAG_MMX_READ_INTERLACE |
|
|
||||||
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
|
|
||||||
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
|
|
||||||
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
|
|
||||||
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
|
||||||
/* no non-MMX flags yet */
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* GRR: no write-flags yet, either, but someday... */
|
|
||||||
if (flag_select & PNG_SELECT_WRITE)
|
|
||||||
settable_asm_flags |=
|
|
||||||
PNG_ASM_FLAG_MMX_WRITE_ [whatever] ;
|
|
||||||
#endif /* 0 */
|
|
||||||
|
|
||||||
return settable_asm_flags; /* _theoretically_ settable capabilities only */
|
|
||||||
}
|
|
||||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
|
||||||
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
|
|
||||||
/* this function was added to libpng 1.2.0 */
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_mmx_flagmask (int flag_select, int *compilerID)
|
|
||||||
{
|
|
||||||
png_uint_32 settable_mmx_flags = 0;
|
|
||||||
|
|
||||||
if (flag_select & PNG_SELECT_READ)
|
|
||||||
settable_mmx_flags |=
|
|
||||||
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
|
|
||||||
PNG_ASM_FLAG_MMX_READ_INTERLACE |
|
|
||||||
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
|
|
||||||
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
|
|
||||||
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
|
|
||||||
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
|
||||||
#if 0
|
|
||||||
/* GRR: no MMX write support yet, but someday... */
|
|
||||||
if (flag_select & PNG_SELECT_WRITE)
|
|
||||||
settable_mmx_flags |=
|
|
||||||
PNG_ASM_FLAG_MMX_WRITE_ [whatever] ;
|
|
||||||
#endif /* 0 */
|
|
||||||
|
|
||||||
if (compilerID != NULL) {
|
|
||||||
#ifdef PNG_USE_PNGVCRD
|
|
||||||
*compilerID = 1; /* MSVC */
|
|
||||||
#else
|
|
||||||
#ifdef PNG_USE_PNGGCCRD
|
|
||||||
*compilerID = 2; /* gcc/gas */
|
|
||||||
#else
|
|
||||||
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return settable_mmx_flags; /* _theoretically_ settable capabilities only */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this function was added to libpng 1.2.0 */
|
|
||||||
png_byte PNGAPI
|
|
||||||
png_get_mmx_bitdepth_threshold (png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return (png_byte)(png_ptr? png_ptr->mmx_bitdepth_threshold : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this function was added to libpng 1.2.0 */
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_mmx_rowbytes_threshold (png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return (png_uint_32)(png_ptr? png_ptr->mmx_rowbytes_threshold : 0L);
|
|
||||||
}
|
|
||||||
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
|
||||||
#endif /* ?PNG_1_0_X */
|
|
||||||
|
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
|
||||||
/* these functions were added to libpng 1.2.6 */
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_user_width_max (png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return (png_ptr? png_ptr->user_width_max : 0);
|
|
||||||
}
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_user_height_max (png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return (png_ptr? png_ptr->user_height_max : 0);
|
|
||||||
}
|
|
||||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
|
||||||
|
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
|
|
@ -1,598 +0,0 @@
|
||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
|
||||||
*
|
|
||||||
* Last changed in libpng 1.2.9 April 14, 2006
|
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*
|
|
||||||
* This file provides a location for all memory allocation. Users who
|
|
||||||
* need special memory handling are expected to supply replacement
|
|
||||||
* functions for png_malloc() and png_free(), and to use
|
|
||||||
* png_create_read_struct_2() and png_create_write_struct_2() to
|
|
||||||
* identify the replacement functions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
|
||||||
|
|
||||||
/* Borland DOS special memory handler */
|
|
||||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
|
||||||
/* if you change this, be sure to change the one in png.h also */
|
|
||||||
|
|
||||||
/* Allocate memory for a png_struct. The malloc and memset can be replaced
|
|
||||||
by a single call to calloc() if this is thought to improve performance. */
|
|
||||||
png_voidp /* PRIVATE */
|
|
||||||
png_create_struct(int type)
|
|
||||||
{
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Alternate version of png_create_struct, for use with user-defined malloc. */
|
|
||||||
png_voidp /* PRIVATE */
|
|
||||||
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
|
||||||
{
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
png_size_t size;
|
|
||||||
png_voidp struct_ptr;
|
|
||||||
|
|
||||||
if (type == PNG_STRUCT_INFO)
|
|
||||||
size = png_sizeof(png_info);
|
|
||||||
else if (type == PNG_STRUCT_PNG)
|
|
||||||
size = png_sizeof(png_struct);
|
|
||||||
else
|
|
||||||
return (png_get_copyright(NULL));
|
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if(malloc_fn != NULL)
|
|
||||||
{
|
|
||||||
png_struct dummy_struct;
|
|
||||||
png_structp png_ptr = &dummy_struct;
|
|
||||||
png_ptr->mem_ptr=mem_ptr;
|
|
||||||
struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
struct_ptr = (png_voidp)farmalloc(size);
|
|
||||||
if (struct_ptr != NULL)
|
|
||||||
png_memset(struct_ptr, 0, size);
|
|
||||||
return (struct_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_destroy_struct(png_voidp struct_ptr)
|
|
||||||
{
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
|
||||||
png_voidp mem_ptr)
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
if (struct_ptr != NULL)
|
|
||||||
{
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if(free_fn != NULL)
|
|
||||||
{
|
|
||||||
png_struct dummy_struct;
|
|
||||||
png_structp png_ptr = &dummy_struct;
|
|
||||||
png_ptr->mem_ptr=mem_ptr;
|
|
||||||
(*(free_fn))(png_ptr, struct_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
farfree (struct_ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate memory. For reasonable files, size should never exceed
|
|
||||||
* 64K. However, zlib may allocate more then 64K if you don't tell
|
|
||||||
* it not to. See zconf.h and png.h for more information. zlib does
|
|
||||||
* need to allocate exactly 64K, so whatever you call here must
|
|
||||||
* have the ability to do that.
|
|
||||||
*
|
|
||||||
* Borland seems to have a problem in DOS mode for exactly 64K.
|
|
||||||
* It gives you a segment with an offset of 8 (perhaps to store its
|
|
||||||
* memory stuff). zlib doesn't like this at all, so we have to
|
|
||||||
* detect and deal with it. This code should not be needed in
|
|
||||||
* Windows or OS/2 modes, and only in 16 bit mode. This code has
|
|
||||||
* been updated by Alexander Lehmann for version 0.89 to waste less
|
|
||||||
* memory.
|
|
||||||
*
|
|
||||||
* Note that we can't use png_size_t for the "size" declaration,
|
|
||||||
* since on some systems a png_size_t is a 16-bit quantity, and as a
|
|
||||||
* result, we would be truncating potentially larger memory requests
|
|
||||||
* (which should cause a fatal error) and introducing major problems.
|
|
||||||
*/
|
|
||||||
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_malloc(png_structp png_ptr, png_uint_32 size)
|
|
||||||
{
|
|
||||||
png_voidp ret;
|
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if(png_ptr->malloc_fn != NULL)
|
|
||||||
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
|
||||||
else
|
|
||||||
ret = (png_malloc_default(png_ptr, size));
|
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out of memory!");
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|
||||||
{
|
|
||||||
png_voidp ret;
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
|
||||||
if (size > (png_uint_32)65536L)
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "Cannot Allocate > 64K");
|
|
||||||
ret = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (size != (size_t)size)
|
|
||||||
ret = NULL;
|
|
||||||
else if (size == (png_uint_32)65536L)
|
|
||||||
{
|
|
||||||
if (png_ptr->offset_table == NULL)
|
|
||||||
{
|
|
||||||
/* try to see if we need to do any of this fancy stuff */
|
|
||||||
ret = farmalloc(size);
|
|
||||||
if (ret == NULL || ((png_size_t)ret & 0xffff))
|
|
||||||
{
|
|
||||||
int num_blocks;
|
|
||||||
png_uint_32 total_size;
|
|
||||||
png_bytep table;
|
|
||||||
int i;
|
|
||||||
png_byte huge * hptr;
|
|
||||||
|
|
||||||
if (ret != NULL)
|
|
||||||
{
|
|
||||||
farfree(ret);
|
|
||||||
ret = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(png_ptr->zlib_window_bits > 14)
|
|
||||||
num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14));
|
|
||||||
else
|
|
||||||
num_blocks = 1;
|
|
||||||
if (png_ptr->zlib_mem_level >= 7)
|
|
||||||
num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7));
|
|
||||||
else
|
|
||||||
num_blocks++;
|
|
||||||
|
|
||||||
total_size = ((png_uint_32)65536L) * (png_uint_32)num_blocks+16;
|
|
||||||
|
|
||||||
table = farmalloc(total_size);
|
|
||||||
|
|
||||||
if (table == NULL)
|
|
||||||
{
|
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */
|
|
||||||
else
|
|
||||||
png_warning(png_ptr, "Out Of Memory.");
|
|
||||||
#endif
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((png_size_t)table & 0xfff0)
|
|
||||||
{
|
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr,
|
|
||||||
"Farmalloc didn't return normalized pointer");
|
|
||||||
else
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"Farmalloc didn't return normalized pointer");
|
|
||||||
#endif
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_ptr->offset_table = table;
|
|
||||||
png_ptr->offset_table_ptr = farmalloc(num_blocks *
|
|
||||||
png_sizeof (png_bytep));
|
|
||||||
|
|
||||||
if (png_ptr->offset_table_ptr == NULL)
|
|
||||||
{
|
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out Of memory."); /* Note "O" and "M" */
|
|
||||||
else
|
|
||||||
png_warning(png_ptr, "Out Of memory.");
|
|
||||||
#endif
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
hptr = (png_byte huge *)table;
|
|
||||||
if ((png_size_t)hptr & 0xf)
|
|
||||||
{
|
|
||||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
|
||||||
hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */
|
|
||||||
}
|
|
||||||
for (i = 0; i < num_blocks; i++)
|
|
||||||
{
|
|
||||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
|
||||||
hptr = hptr + (png_uint_32)65536L; /* "+=" fails on TC++3.0 */
|
|
||||||
}
|
|
||||||
|
|
||||||
png_ptr->offset_table_number = num_blocks;
|
|
||||||
png_ptr->offset_table_count = 0;
|
|
||||||
png_ptr->offset_table_count_free = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
|
|
||||||
{
|
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out of Memory."); /* Note "o" and "M" */
|
|
||||||
else
|
|
||||||
png_warning(png_ptr, "Out of Memory.");
|
|
||||||
#endif
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ret = farmalloc(size);
|
|
||||||
|
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (ret == NULL)
|
|
||||||
{
|
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
|
||||||
else
|
|
||||||
png_warning(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* free a pointer allocated by png_malloc(). In the default
|
|
||||||
configuration, png_ptr is not used, but is passed in case it
|
|
||||||
is needed. If ptr is NULL, return without taking any action. */
|
|
||||||
void PNGAPI
|
|
||||||
png_free(png_structp png_ptr, png_voidp ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (png_ptr->free_fn != NULL)
|
|
||||||
{
|
|
||||||
(*(png_ptr->free_fn))(png_ptr, ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else png_free_default(png_ptr, ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PNGAPI
|
|
||||||
png_free_default(png_structp png_ptr, png_voidp ptr)
|
|
||||||
{
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
|
|
||||||
if (png_ptr->offset_table != NULL)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < png_ptr->offset_table_count; i++)
|
|
||||||
{
|
|
||||||
if (ptr == png_ptr->offset_table_ptr[i])
|
|
||||||
{
|
|
||||||
ptr = NULL;
|
|
||||||
png_ptr->offset_table_count_free++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (png_ptr->offset_table_count_free == png_ptr->offset_table_count)
|
|
||||||
{
|
|
||||||
farfree(png_ptr->offset_table);
|
|
||||||
farfree(png_ptr->offset_table_ptr);
|
|
||||||
png_ptr->offset_table = NULL;
|
|
||||||
png_ptr->offset_table_ptr = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ptr != NULL)
|
|
||||||
{
|
|
||||||
farfree(ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* Not the Borland DOS special memory handler */
|
|
||||||
|
|
||||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
|
||||||
memset can be replaced by a single call to calloc() if this is thought
|
|
||||||
to improve performance noticably. */
|
|
||||||
png_voidp /* PRIVATE */
|
|
||||||
png_create_struct(int type)
|
|
||||||
{
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
|
||||||
memset can be replaced by a single call to calloc() if this is thought
|
|
||||||
to improve performance noticably. */
|
|
||||||
png_voidp /* PRIVATE */
|
|
||||||
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
|
||||||
{
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
png_size_t size;
|
|
||||||
png_voidp struct_ptr;
|
|
||||||
|
|
||||||
if (type == PNG_STRUCT_INFO)
|
|
||||||
size = png_sizeof(png_info);
|
|
||||||
else if (type == PNG_STRUCT_PNG)
|
|
||||||
size = png_sizeof(png_struct);
|
|
||||||
else
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if(malloc_fn != NULL)
|
|
||||||
{
|
|
||||||
png_struct dummy_struct;
|
|
||||||
png_structp png_ptr = &dummy_struct;
|
|
||||||
png_ptr->mem_ptr=mem_ptr;
|
|
||||||
struct_ptr = (*(malloc_fn))(png_ptr, size);
|
|
||||||
if (struct_ptr != NULL)
|
|
||||||
png_memset(struct_ptr, 0, size);
|
|
||||||
return (struct_ptr);
|
|
||||||
}
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
|
||||||
struct_ptr = (png_voidp)farmalloc(size);
|
|
||||||
#else
|
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
||||||
struct_ptr = (png_voidp)halloc(size,1);
|
|
||||||
# else
|
|
||||||
struct_ptr = (png_voidp)malloc(size);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
if (struct_ptr != NULL)
|
|
||||||
png_memset(struct_ptr, 0, size);
|
|
||||||
|
|
||||||
return (struct_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_destroy_struct(png_voidp struct_ptr)
|
|
||||||
{
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
|
||||||
png_voidp mem_ptr)
|
|
||||||
{
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
if (struct_ptr != NULL)
|
|
||||||
{
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if(free_fn != NULL)
|
|
||||||
{
|
|
||||||
png_struct dummy_struct;
|
|
||||||
png_structp png_ptr = &dummy_struct;
|
|
||||||
png_ptr->mem_ptr=mem_ptr;
|
|
||||||
(*(free_fn))(png_ptr, struct_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
|
||||||
farfree(struct_ptr);
|
|
||||||
#else
|
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
||||||
hfree(struct_ptr);
|
|
||||||
# else
|
|
||||||
free(struct_ptr);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate memory. For reasonable files, size should never exceed
|
|
||||||
64K. However, zlib may allocate more then 64K if you don't tell
|
|
||||||
it not to. See zconf.h and png.h for more information. zlib does
|
|
||||||
need to allocate exactly 64K, so whatever you call here must
|
|
||||||
have the ability to do that. */
|
|
||||||
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_malloc(png_structp png_ptr, png_uint_32 size)
|
|
||||||
{
|
|
||||||
png_voidp ret;
|
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (png_ptr == NULL || size == 0)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
if(png_ptr->malloc_fn != NULL)
|
|
||||||
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
|
||||||
else
|
|
||||||
ret = (png_malloc_default(png_ptr, size));
|
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out of Memory!");
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|
||||||
{
|
|
||||||
png_voidp ret;
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
|
||||||
if (size > (png_uint_32)65536L)
|
|
||||||
{
|
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if(png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Cannot Allocate > 64K");
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Check for overflow */
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
|
||||||
if (size != (unsigned long)size)
|
|
||||||
ret = NULL;
|
|
||||||
else
|
|
||||||
ret = farmalloc(size);
|
|
||||||
#else
|
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
||||||
if (size != (unsigned long)size)
|
|
||||||
ret = NULL;
|
|
||||||
else
|
|
||||||
ret = halloc(size, 1);
|
|
||||||
# else
|
|
||||||
if (size != (size_t)size)
|
|
||||||
ret = NULL;
|
|
||||||
else
|
|
||||||
ret = malloc((size_t)size);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out of Memory");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return
|
|
||||||
without taking any action. */
|
|
||||||
void PNGAPI
|
|
||||||
png_free(png_structp png_ptr, png_voidp ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (png_ptr->free_fn != NULL)
|
|
||||||
{
|
|
||||||
(*(png_ptr->free_fn))(png_ptr, ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else png_free_default(png_ptr, ptr);
|
|
||||||
}
|
|
||||||
void PNGAPI
|
|
||||||
png_free_default(png_structp png_ptr, png_voidp ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
|
||||||
farfree(ptr);
|
|
||||||
#else
|
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
||||||
hfree(ptr);
|
|
||||||
# else
|
|
||||||
free(ptr);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* Not Borland DOS special memory handler */
|
|
||||||
|
|
||||||
#if defined(PNG_1_0_X)
|
|
||||||
# define png_malloc_warn png_malloc
|
|
||||||
#else
|
|
||||||
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
|
|
||||||
* function will set up png_malloc() to issue a png_warning and return NULL
|
|
||||||
* instead of issuing a png_error, if it fails to allocate the requested
|
|
||||||
* memory.
|
|
||||||
*/
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_malloc_warn(png_structp png_ptr, png_uint_32 size)
|
|
||||||
{
|
|
||||||
png_voidp ptr;
|
|
||||||
png_uint_32 save_flags=png_ptr->flags;
|
|
||||||
|
|
||||||
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
|
||||||
ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
|
|
||||||
png_ptr->flags=save_flags;
|
|
||||||
return(ptr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
|
|
||||||
png_uint_32 length)
|
|
||||||
{
|
|
||||||
png_size_t size;
|
|
||||||
|
|
||||||
size = (png_size_t)length;
|
|
||||||
if ((png_uint_32)size != length)
|
|
||||||
png_error(png_ptr,"Overflow in png_memcpy_check.");
|
|
||||||
|
|
||||||
return(png_memcpy (s1, s2, size));
|
|
||||||
}
|
|
||||||
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_memset_check (png_structp png_ptr, png_voidp s1, int value,
|
|
||||||
png_uint_32 length)
|
|
||||||
{
|
|
||||||
png_size_t size;
|
|
||||||
|
|
||||||
size = (png_size_t)length;
|
|
||||||
if ((png_uint_32)size != length)
|
|
||||||
png_error(png_ptr,"Overflow in png_memset_check.");
|
|
||||||
|
|
||||||
return (png_memset (s1, value, size));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
/* This function is called when the application wants to use another method
|
|
||||||
* of allocating and freeing memory.
|
|
||||||
*/
|
|
||||||
void PNGAPI
|
|
||||||
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
|
||||||
malloc_fn, png_free_ptr free_fn)
|
|
||||||
{
|
|
||||||
png_ptr->mem_ptr = mem_ptr;
|
|
||||||
png_ptr->malloc_fn = malloc_fn;
|
|
||||||
png_ptr->free_fn = free_fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function returns a pointer to the mem_ptr associated with the user
|
|
||||||
* functions. The application should free any memory associated with this
|
|
||||||
* pointer before png_write_destroy and png_read_destroy are called.
|
|
||||||
*/
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_get_mem_ptr(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return ((png_voidp)png_ptr->mem_ptr);
|
|
||||||
}
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,164 +0,0 @@
|
||||||
|
|
||||||
/* pngrio.c - functions for data input
|
|
||||||
*
|
|
||||||
* Last changed in libpng 1.2.9 April 14, 2006
|
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*
|
|
||||||
* This file provides a location for all input. Users who need
|
|
||||||
* special handling are expected to write a function that has the same
|
|
||||||
* arguments as this and performs a similar function, but that possibly
|
|
||||||
* has a different input method. Note that you shouldn't change this
|
|
||||||
* function, but rather write a replacement function and then make
|
|
||||||
* libpng use it at run time with png_set_read_fn(...).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED)
|
|
||||||
|
|
||||||
/* Read the data from whatever input you are using. The default routine
|
|
||||||
reads from a file pointer. Note that this routine sometimes gets called
|
|
||||||
with very small lengths, so you should implement some kind of simple
|
|
||||||
buffering if you are using unbuffered reads. This should never be asked
|
|
||||||
to read more then 64K on a 16 bit machine. */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|
||||||
{
|
|
||||||
png_debug1(4,"reading %d bytes\n", (int)length);
|
|
||||||
if (png_ptr->read_data_fn != NULL)
|
|
||||||
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
|
||||||
else
|
|
||||||
png_error(png_ptr, "Call to NULL read function");
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
|
||||||
/* This is the function that does the actual reading of data. If you are
|
|
||||||
not reading from a standard C stream, you should create a replacement
|
|
||||||
read_data function and use it at run time with png_set_read_fn(), rather
|
|
||||||
than changing the library. */
|
|
||||||
#ifndef USE_FAR_KEYWORD
|
|
||||||
void PNGAPI
|
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|
||||||
{
|
|
||||||
png_size_t check;
|
|
||||||
|
|
||||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
|
||||||
* instead of an int, which is what fread() actually returns.
|
|
||||||
*/
|
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = (png_size_t)fread(data, (png_size_t)1, length,
|
|
||||||
(png_FILE_p)png_ptr->io_ptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (check != length)
|
|
||||||
png_error(png_ptr, "Read Error");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/* this is the model-independent version. Since the standard I/O library
|
|
||||||
can't handle far buffers in the medium and small models, we have to copy
|
|
||||||
the data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define NEAR_BUF_SIZE 1024
|
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
|
||||||
|
|
||||||
static void PNGAPI
|
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|
||||||
{
|
|
||||||
int check;
|
|
||||||
png_byte *n_data;
|
|
||||||
png_FILE_p io_ptr;
|
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
|
||||||
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
|
||||||
if ((png_bytep)n_data == data)
|
|
||||||
{
|
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = fread(n_data, 1, length, io_ptr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
|
||||||
png_size_t read, remaining, err;
|
|
||||||
check = 0;
|
|
||||||
remaining = length;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
read = MIN(NEAR_BUF_SIZE, remaining);
|
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
|
|
||||||
err = 0;
|
|
||||||
#else
|
|
||||||
err = fread(buf, (png_size_t)1, read, io_ptr);
|
|
||||||
#endif
|
|
||||||
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
|
||||||
if(err != read)
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
check += err;
|
|
||||||
data += read;
|
|
||||||
remaining -= read;
|
|
||||||
}
|
|
||||||
while (remaining != 0);
|
|
||||||
}
|
|
||||||
if ((png_uint_32)check != (png_uint_32)length)
|
|
||||||
png_error(png_ptr, "read Error");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This function allows the application to supply a new input function
|
|
||||||
for libpng if standard C streams aren't being used.
|
|
||||||
|
|
||||||
This function takes as its arguments:
|
|
||||||
png_ptr - pointer to a png input data structure
|
|
||||||
io_ptr - pointer to user supplied structure containing info about
|
|
||||||
the input functions. May be NULL.
|
|
||||||
read_data_fn - pointer to a new input function that takes as its
|
|
||||||
arguments a pointer to a png_struct, a pointer to
|
|
||||||
a location where input data can be stored, and a 32-bit
|
|
||||||
unsigned int that is the number of bytes to be read.
|
|
||||||
To exit and output any fatal error messages the new write
|
|
||||||
function should call png_error(png_ptr, "Error msg"). */
|
|
||||||
void PNGAPI
|
|
||||||
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
|
||||||
png_rw_ptr read_data_fn)
|
|
||||||
{
|
|
||||||
png_ptr->io_ptr = io_ptr;
|
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
|
||||||
if (read_data_fn != NULL)
|
|
||||||
png_ptr->read_data_fn = read_data_fn;
|
|
||||||
else
|
|
||||||
png_ptr->read_data_fn = png_default_read_data;
|
|
||||||
#else
|
|
||||||
png_ptr->read_data_fn = read_data_fn;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* It is an error to write to a read device */
|
|
||||||
if (png_ptr->write_data_fn != NULL)
|
|
||||||
{
|
|
||||||
png_ptr->write_data_fn = NULL;
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"It's an error to set both read_data_fn and write_data_fn in the ");
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"same structure. Resetting write_data_fn to NULL.");
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
|
||||||
png_ptr->output_flush_fn = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
|
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,652 +0,0 @@
|
||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
|
||||||
*
|
|
||||||
* Last changed in libpng 1.2.9 April 14, 2006
|
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
|
||||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
|
||||||
/* turn on BGR-to-RGB mapping */
|
|
||||||
void PNGAPI
|
|
||||||
png_set_bgr(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_bgr\n");
|
|
||||||
png_ptr->transformations |= PNG_BGR;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
|
||||||
/* turn on 16 bit byte swapping */
|
|
||||||
void PNGAPI
|
|
||||||
png_set_swap(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_swap\n");
|
|
||||||
if (png_ptr->bit_depth == 16)
|
|
||||||
png_ptr->transformations |= PNG_SWAP_BYTES;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
|
||||||
/* turn on pixel packing */
|
|
||||||
void PNGAPI
|
|
||||||
png_set_packing(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_packing\n");
|
|
||||||
if (png_ptr->bit_depth < 8)
|
|
||||||
{
|
|
||||||
png_ptr->transformations |= PNG_PACK;
|
|
||||||
png_ptr->usr_bit_depth = 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
|
||||||
/* turn on packed pixel swapping */
|
|
||||||
void PNGAPI
|
|
||||||
png_set_packswap(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_packswap\n");
|
|
||||||
if (png_ptr->bit_depth < 8)
|
|
||||||
png_ptr->transformations |= PNG_PACKSWAP;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
|
||||||
void PNGAPI
|
|
||||||
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_shift\n");
|
|
||||||
png_ptr->transformations |= PNG_SHIFT;
|
|
||||||
png_ptr->shift = *true_bits;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
|
||||||
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
|
||||||
int PNGAPI
|
|
||||||
png_set_interlace_handling(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_interlace handling\n");
|
|
||||||
if (png_ptr->interlaced)
|
|
||||||
{
|
|
||||||
png_ptr->transformations |= PNG_INTERLACE;
|
|
||||||
return (7);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
|
||||||
/* Add a filler byte on read, or remove a filler or alpha byte on write.
|
|
||||||
* The filler type has changed in v0.95 to allow future 2-byte fillers
|
|
||||||
* for 48-bit input data, as well as to avoid problems with some compilers
|
|
||||||
* that don't like bytes as parameters.
|
|
||||||
*/
|
|
||||||
void PNGAPI
|
|
||||||
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_filler\n");
|
|
||||||
png_ptr->transformations |= PNG_FILLER;
|
|
||||||
png_ptr->filler = (png_byte)filler;
|
|
||||||
if (filler_loc == PNG_FILLER_AFTER)
|
|
||||||
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
|
||||||
else
|
|
||||||
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
|
||||||
|
|
||||||
/* This should probably go in the "do_read_filler" routine.
|
|
||||||
* I attempted to do that in libpng-1.0.1a but that caused problems
|
|
||||||
* so I restored it in libpng-1.0.2a
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
|
|
||||||
{
|
|
||||||
png_ptr->usr_channels = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Also I added this in libpng-1.0.2a (what happens when we expand
|
|
||||||
* a less-than-8-bit grayscale to GA? */
|
|
||||||
|
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
|
|
||||||
{
|
|
||||||
png_ptr->usr_channels = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined(PNG_1_0_X)
|
|
||||||
/* Added to libpng-1.2.7 */
|
|
||||||
void PNGAPI
|
|
||||||
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_add_alpha\n");
|
|
||||||
png_set_filler(png_ptr, filler, filler_loc);
|
|
||||||
png_ptr->transformations |= PNG_ADD_ALPHA;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
|
|
||||||
defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
|
|
||||||
void PNGAPI
|
|
||||||
png_set_swap_alpha(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_swap_alpha\n");
|
|
||||||
png_ptr->transformations |= PNG_SWAP_ALPHA;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
|
|
||||||
defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
|
||||||
void PNGAPI
|
|
||||||
png_set_invert_alpha(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_invert_alpha\n");
|
|
||||||
png_ptr->transformations |= PNG_INVERT_ALPHA;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
|
|
||||||
void PNGAPI
|
|
||||||
png_set_invert_mono(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_invert_mono\n");
|
|
||||||
png_ptr->transformations |= PNG_INVERT_MONO;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* invert monochrome grayscale data */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_invert(png_row_infop row_info, png_bytep row)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_invert\n");
|
|
||||||
/* This test removed from libpng version 1.0.13 and 1.2.0:
|
|
||||||
* if (row_info->bit_depth == 1 &&
|
|
||||||
*/
|
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
if (row == NULL || row_info == NULL)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
|
||||||
{
|
|
||||||
png_bytep rp = row;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 istop = row_info->rowbytes;
|
|
||||||
|
|
||||||
for (i = 0; i < istop; i++)
|
|
||||||
{
|
|
||||||
*rp = (png_byte)(~(*rp));
|
|
||||||
rp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
|
||||||
row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_bytep rp = row;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 istop = row_info->rowbytes;
|
|
||||||
|
|
||||||
for (i = 0; i < istop; i+=2)
|
|
||||||
{
|
|
||||||
*rp = (png_byte)(~(*rp));
|
|
||||||
rp+=2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
|
||||||
row_info->bit_depth == 16)
|
|
||||||
{
|
|
||||||
png_bytep rp = row;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 istop = row_info->rowbytes;
|
|
||||||
|
|
||||||
for (i = 0; i < istop; i+=4)
|
|
||||||
{
|
|
||||||
*rp = (png_byte)(~(*rp));
|
|
||||||
*(rp+1) = (png_byte)(~(*(rp+1)));
|
|
||||||
rp+=4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
|
||||||
/* swaps byte order on 16 bit depth images */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_swap(png_row_infop row_info, png_bytep row)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_swap\n");
|
|
||||||
if (
|
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
row_info->bit_depth == 16)
|
|
||||||
{
|
|
||||||
png_bytep rp = row;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 istop= row_info->width * row_info->channels;
|
|
||||||
|
|
||||||
for (i = 0; i < istop; i++, rp += 2)
|
|
||||||
{
|
|
||||||
png_byte t = *rp;
|
|
||||||
*rp = *(rp + 1);
|
|
||||||
*(rp + 1) = t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
|
||||||
static PNG_CONST png_byte onebppswaptable[256] = {
|
|
||||||
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
|
|
||||||
0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
|
|
||||||
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
|
|
||||||
0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
|
|
||||||
0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4,
|
|
||||||
0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
|
|
||||||
0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC,
|
|
||||||
0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
|
|
||||||
0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2,
|
|
||||||
0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
|
|
||||||
0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA,
|
|
||||||
0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
|
|
||||||
0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6,
|
|
||||||
0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
|
|
||||||
0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE,
|
|
||||||
0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
|
|
||||||
0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1,
|
|
||||||
0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
|
|
||||||
0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9,
|
|
||||||
0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
|
|
||||||
0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5,
|
|
||||||
0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
|
|
||||||
0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED,
|
|
||||||
0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
|
|
||||||
0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3,
|
|
||||||
0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
|
|
||||||
0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB,
|
|
||||||
0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
|
|
||||||
0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7,
|
|
||||||
0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
|
|
||||||
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF,
|
|
||||||
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
|
|
||||||
};
|
|
||||||
|
|
||||||
static PNG_CONST png_byte twobppswaptable[256] = {
|
|
||||||
0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0,
|
|
||||||
0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0,
|
|
||||||
0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4,
|
|
||||||
0x24, 0x64, 0xA4, 0xE4, 0x34, 0x74, 0xB4, 0xF4,
|
|
||||||
0x08, 0x48, 0x88, 0xC8, 0x18, 0x58, 0x98, 0xD8,
|
|
||||||
0x28, 0x68, 0xA8, 0xE8, 0x38, 0x78, 0xB8, 0xF8,
|
|
||||||
0x0C, 0x4C, 0x8C, 0xCC, 0x1C, 0x5C, 0x9C, 0xDC,
|
|
||||||
0x2C, 0x6C, 0xAC, 0xEC, 0x3C, 0x7C, 0xBC, 0xFC,
|
|
||||||
0x01, 0x41, 0x81, 0xC1, 0x11, 0x51, 0x91, 0xD1,
|
|
||||||
0x21, 0x61, 0xA1, 0xE1, 0x31, 0x71, 0xB1, 0xF1,
|
|
||||||
0x05, 0x45, 0x85, 0xC5, 0x15, 0x55, 0x95, 0xD5,
|
|
||||||
0x25, 0x65, 0xA5, 0xE5, 0x35, 0x75, 0xB5, 0xF5,
|
|
||||||
0x09, 0x49, 0x89, 0xC9, 0x19, 0x59, 0x99, 0xD9,
|
|
||||||
0x29, 0x69, 0xA9, 0xE9, 0x39, 0x79, 0xB9, 0xF9,
|
|
||||||
0x0D, 0x4D, 0x8D, 0xCD, 0x1D, 0x5D, 0x9D, 0xDD,
|
|
||||||
0x2D, 0x6D, 0xAD, 0xED, 0x3D, 0x7D, 0xBD, 0xFD,
|
|
||||||
0x02, 0x42, 0x82, 0xC2, 0x12, 0x52, 0x92, 0xD2,
|
|
||||||
0x22, 0x62, 0xA2, 0xE2, 0x32, 0x72, 0xB2, 0xF2,
|
|
||||||
0x06, 0x46, 0x86, 0xC6, 0x16, 0x56, 0x96, 0xD6,
|
|
||||||
0x26, 0x66, 0xA6, 0xE6, 0x36, 0x76, 0xB6, 0xF6,
|
|
||||||
0x0A, 0x4A, 0x8A, 0xCA, 0x1A, 0x5A, 0x9A, 0xDA,
|
|
||||||
0x2A, 0x6A, 0xAA, 0xEA, 0x3A, 0x7A, 0xBA, 0xFA,
|
|
||||||
0x0E, 0x4E, 0x8E, 0xCE, 0x1E, 0x5E, 0x9E, 0xDE,
|
|
||||||
0x2E, 0x6E, 0xAE, 0xEE, 0x3E, 0x7E, 0xBE, 0xFE,
|
|
||||||
0x03, 0x43, 0x83, 0xC3, 0x13, 0x53, 0x93, 0xD3,
|
|
||||||
0x23, 0x63, 0xA3, 0xE3, 0x33, 0x73, 0xB3, 0xF3,
|
|
||||||
0x07, 0x47, 0x87, 0xC7, 0x17, 0x57, 0x97, 0xD7,
|
|
||||||
0x27, 0x67, 0xA7, 0xE7, 0x37, 0x77, 0xB7, 0xF7,
|
|
||||||
0x0B, 0x4B, 0x8B, 0xCB, 0x1B, 0x5B, 0x9B, 0xDB,
|
|
||||||
0x2B, 0x6B, 0xAB, 0xEB, 0x3B, 0x7B, 0xBB, 0xFB,
|
|
||||||
0x0F, 0x4F, 0x8F, 0xCF, 0x1F, 0x5F, 0x9F, 0xDF,
|
|
||||||
0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF
|
|
||||||
};
|
|
||||||
|
|
||||||
static PNG_CONST png_byte fourbppswaptable[256] = {
|
|
||||||
0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70,
|
|
||||||
0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0,
|
|
||||||
0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71,
|
|
||||||
0x81, 0x91, 0xA1, 0xB1, 0xC1, 0xD1, 0xE1, 0xF1,
|
|
||||||
0x02, 0x12, 0x22, 0x32, 0x42, 0x52, 0x62, 0x72,
|
|
||||||
0x82, 0x92, 0xA2, 0xB2, 0xC2, 0xD2, 0xE2, 0xF2,
|
|
||||||
0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x73,
|
|
||||||
0x83, 0x93, 0xA3, 0xB3, 0xC3, 0xD3, 0xE3, 0xF3,
|
|
||||||
0x04, 0x14, 0x24, 0x34, 0x44, 0x54, 0x64, 0x74,
|
|
||||||
0x84, 0x94, 0xA4, 0xB4, 0xC4, 0xD4, 0xE4, 0xF4,
|
|
||||||
0x05, 0x15, 0x25, 0x35, 0x45, 0x55, 0x65, 0x75,
|
|
||||||
0x85, 0x95, 0xA5, 0xB5, 0xC5, 0xD5, 0xE5, 0xF5,
|
|
||||||
0x06, 0x16, 0x26, 0x36, 0x46, 0x56, 0x66, 0x76,
|
|
||||||
0x86, 0x96, 0xA6, 0xB6, 0xC6, 0xD6, 0xE6, 0xF6,
|
|
||||||
0x07, 0x17, 0x27, 0x37, 0x47, 0x57, 0x67, 0x77,
|
|
||||||
0x87, 0x97, 0xA7, 0xB7, 0xC7, 0xD7, 0xE7, 0xF7,
|
|
||||||
0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x68, 0x78,
|
|
||||||
0x88, 0x98, 0xA8, 0xB8, 0xC8, 0xD8, 0xE8, 0xF8,
|
|
||||||
0x09, 0x19, 0x29, 0x39, 0x49, 0x59, 0x69, 0x79,
|
|
||||||
0x89, 0x99, 0xA9, 0xB9, 0xC9, 0xD9, 0xE9, 0xF9,
|
|
||||||
0x0A, 0x1A, 0x2A, 0x3A, 0x4A, 0x5A, 0x6A, 0x7A,
|
|
||||||
0x8A, 0x9A, 0xAA, 0xBA, 0xCA, 0xDA, 0xEA, 0xFA,
|
|
||||||
0x0B, 0x1B, 0x2B, 0x3B, 0x4B, 0x5B, 0x6B, 0x7B,
|
|
||||||
0x8B, 0x9B, 0xAB, 0xBB, 0xCB, 0xDB, 0xEB, 0xFB,
|
|
||||||
0x0C, 0x1C, 0x2C, 0x3C, 0x4C, 0x5C, 0x6C, 0x7C,
|
|
||||||
0x8C, 0x9C, 0xAC, 0xBC, 0xCC, 0xDC, 0xEC, 0xFC,
|
|
||||||
0x0D, 0x1D, 0x2D, 0x3D, 0x4D, 0x5D, 0x6D, 0x7D,
|
|
||||||
0x8D, 0x9D, 0xAD, 0xBD, 0xCD, 0xDD, 0xED, 0xFD,
|
|
||||||
0x0E, 0x1E, 0x2E, 0x3E, 0x4E, 0x5E, 0x6E, 0x7E,
|
|
||||||
0x8E, 0x9E, 0xAE, 0xBE, 0xCE, 0xDE, 0xEE, 0xFE,
|
|
||||||
0x0F, 0x1F, 0x2F, 0x3F, 0x4F, 0x5F, 0x6F, 0x7F,
|
|
||||||
0x8F, 0x9F, 0xAF, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF
|
|
||||||
};
|
|
||||||
|
|
||||||
/* swaps pixel packing order within bytes */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_packswap(png_row_infop row_info, png_bytep row)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_packswap\n");
|
|
||||||
if (
|
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
row_info->bit_depth < 8)
|
|
||||||
{
|
|
||||||
png_bytep rp, end, table;
|
|
||||||
|
|
||||||
end = row + row_info->rowbytes;
|
|
||||||
|
|
||||||
if (row_info->bit_depth == 1)
|
|
||||||
table = (png_bytep)onebppswaptable;
|
|
||||||
else if (row_info->bit_depth == 2)
|
|
||||||
table = (png_bytep)twobppswaptable;
|
|
||||||
else if (row_info->bit_depth == 4)
|
|
||||||
table = (png_bytep)fourbppswaptable;
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (rp = row; rp < end; rp++)
|
|
||||||
*rp = table[*rp];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* PNG_READ_PACKSWAP_SUPPORTED or PNG_WRITE_PACKSWAP_SUPPORTED */
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
|
||||||
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
|
||||||
/* remove filler or alpha byte(s) */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_strip_filler\n");
|
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
if (row != NULL && row_info != NULL)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
png_bytep sp=row;
|
|
||||||
png_bytep dp=row;
|
|
||||||
png_uint_32 row_width=row_info->width;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
if ((row_info->color_type == PNG_COLOR_TYPE_RGB ||
|
|
||||||
(row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA &&
|
|
||||||
(flags & PNG_FLAG_STRIP_ALPHA))) &&
|
|
||||||
row_info->channels == 4)
|
|
||||||
{
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
/* This converts from RGBX or RGBA to RGB */
|
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
|
||||||
{
|
|
||||||
dp+=3; sp+=4;
|
|
||||||
for (i = 1; i < row_width; i++)
|
|
||||||
{
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* This converts from XRGB or ARGB to RGB */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
row_info->pixel_depth = 24;
|
|
||||||
row_info->rowbytes = row_width * 3;
|
|
||||||
}
|
|
||||||
else /* if (row_info->bit_depth == 16) */
|
|
||||||
{
|
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
|
||||||
{
|
|
||||||
/* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */
|
|
||||||
sp += 8; dp += 6;
|
|
||||||
for (i = 1; i < row_width; i++)
|
|
||||||
{
|
|
||||||
/* This could be (although png_memcpy is probably slower):
|
|
||||||
png_memcpy(dp, sp, 6);
|
|
||||||
sp += 8;
|
|
||||||
dp += 6;
|
|
||||||
*/
|
|
||||||
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
sp += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
/* This could be (although png_memcpy is probably slower):
|
|
||||||
png_memcpy(dp, sp, 6);
|
|
||||||
sp += 8;
|
|
||||||
dp += 6;
|
|
||||||
*/
|
|
||||||
|
|
||||||
sp+=2;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
row_info->pixel_depth = 48;
|
|
||||||
row_info->rowbytes = row_width * 6;
|
|
||||||
}
|
|
||||||
row_info->channels = 3;
|
|
||||||
}
|
|
||||||
else if ((row_info->color_type == PNG_COLOR_TYPE_GRAY ||
|
|
||||||
(row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
|
||||||
(flags & PNG_FLAG_STRIP_ALPHA))) &&
|
|
||||||
row_info->channels == 2)
|
|
||||||
{
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
/* This converts from GX or GA to G */
|
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
|
||||||
{
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
*dp++ = *sp++;
|
|
||||||
sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* This converts from XG or AG to G */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
row_info->pixel_depth = 8;
|
|
||||||
row_info->rowbytes = row_width;
|
|
||||||
}
|
|
||||||
else /* if (row_info->bit_depth == 16) */
|
|
||||||
{
|
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
|
||||||
{
|
|
||||||
/* This converts from GGXX or GGAA to GG */
|
|
||||||
sp += 4; dp += 2;
|
|
||||||
for (i = 1; i < row_width; i++)
|
|
||||||
{
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
sp += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* This converts from XXGG or AAGG to GG */
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
sp += 2;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
row_info->pixel_depth = 16;
|
|
||||||
row_info->rowbytes = row_width * 2;
|
|
||||||
}
|
|
||||||
row_info->channels = 1;
|
|
||||||
}
|
|
||||||
if (flags & PNG_FLAG_STRIP_ALPHA)
|
|
||||||
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
|
||||||
/* swaps red and blue bytes within a pixel */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_bgr(png_row_infop row_info, png_bytep row)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_bgr\n");
|
|
||||||
if (
|
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
|
||||||
{
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
|
||||||
{
|
|
||||||
png_bytep rp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += 3)
|
|
||||||
{
|
|
||||||
png_byte save = *rp;
|
|
||||||
*rp = *(rp + 2);
|
|
||||||
*(rp + 2) = save;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
|
||||||
{
|
|
||||||
png_bytep rp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += 4)
|
|
||||||
{
|
|
||||||
png_byte save = *rp;
|
|
||||||
*rp = *(rp + 2);
|
|
||||||
*(rp + 2) = save;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (row_info->bit_depth == 16)
|
|
||||||
{
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
|
||||||
{
|
|
||||||
png_bytep rp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += 6)
|
|
||||||
{
|
|
||||||
png_byte save = *rp;
|
|
||||||
*rp = *(rp + 4);
|
|
||||||
*(rp + 4) = save;
|
|
||||||
save = *(rp + 1);
|
|
||||||
*(rp + 1) = *(rp + 5);
|
|
||||||
*(rp + 5) = save;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
|
||||||
{
|
|
||||||
png_bytep rp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += 8)
|
|
||||||
{
|
|
||||||
png_byte save = *rp;
|
|
||||||
*rp = *(rp + 4);
|
|
||||||
*(rp + 4) = save;
|
|
||||||
save = *(rp + 1);
|
|
||||||
*(rp + 1) = *(rp + 5);
|
|
||||||
*(rp + 5) = save;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
|
||||||
|
|
||||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
|
||||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
|
|
||||||
defined(PNG_LEGACY_SUPPORTED)
|
|
||||||
void PNGAPI
|
|
||||||
png_set_user_transform_info(png_structp png_ptr, png_voidp
|
|
||||||
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_user_transform_info\n");
|
|
||||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
|
||||||
png_ptr->user_transform_ptr = user_transform_ptr;
|
|
||||||
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
|
||||||
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
|
||||||
#else
|
|
||||||
if(user_transform_ptr || user_transform_depth || user_transform_channels)
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"This version of libpng does not support user transform info");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This function returns a pointer to the user_transform_ptr associated with
|
|
||||||
* the user transform functions. The application should free any memory
|
|
||||||
* associated with this pointer before png_write_destroy and png_read_destroy
|
|
||||||
* are called.
|
|
||||||
*/
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_get_user_transform_ptr(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
|
||||||
return ((png_voidp)png_ptr->user_transform_ptr);
|
|
||||||
#else
|
|
||||||
if(png_ptr)
|
|
||||||
return (NULL);
|
|
||||||
return (NULL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
|
|
@ -1,228 +0,0 @@
|
||||||
|
|
||||||
/* pngwio.c - functions for data output
|
|
||||||
*
|
|
||||||
* Last changed in libpng 1.2.3 - May 21, 2002
|
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
|
||||||
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*
|
|
||||||
* This file provides a location for all output. Users who need
|
|
||||||
* special handling are expected to write functions that have the same
|
|
||||||
* arguments as these and perform similar functions, but that possibly
|
|
||||||
* use different output methods. Note that you shouldn't change these
|
|
||||||
* functions, but rather write replacement functions and then change
|
|
||||||
* them at run time with png_set_write_fn(...).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
|
||||||
|
|
||||||
/* Write the data to whatever output you are using. The default routine
|
|
||||||
writes to a file pointer. Note that this routine sometimes gets called
|
|
||||||
with very small lengths, so you should implement some kind of simple
|
|
||||||
buffering if you are using unbuffered writes. This should never be asked
|
|
||||||
to write more than 64K on a 16 bit machine. */
|
|
||||||
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|
||||||
{
|
|
||||||
if (png_ptr->write_data_fn != NULL )
|
|
||||||
(*(png_ptr->write_data_fn))(png_ptr, data, length);
|
|
||||||
else
|
|
||||||
png_error(png_ptr, "Call to NULL write function");
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
|
||||||
/* This is the function that does the actual writing of data. If you are
|
|
||||||
not writing to a standard C stream, you should create a replacement
|
|
||||||
write_data function and use it at run time with png_set_write_fn(), rather
|
|
||||||
than changing the library. */
|
|
||||||
#ifndef USE_FAR_KEYWORD
|
|
||||||
void PNGAPI
|
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|
||||||
{
|
|
||||||
png_uint_32 check;
|
|
||||||
|
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
|
||||||
#endif
|
|
||||||
if (check != length)
|
|
||||||
png_error(png_ptr, "Write Error");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/* this is the model-independent version. Since the standard I/O library
|
|
||||||
can't handle far buffers in the medium and small models, we have to copy
|
|
||||||
the data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define NEAR_BUF_SIZE 1024
|
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
|
||||||
|
|
||||||
void PNGAPI
|
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|
||||||
{
|
|
||||||
png_uint_32 check;
|
|
||||||
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
|
||||||
png_FILE_p io_ptr;
|
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
|
||||||
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
|
||||||
if ((png_bytep)near_data == data)
|
|
||||||
{
|
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = fwrite(near_data, 1, length, io_ptr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
|
||||||
png_size_t written, remaining, err;
|
|
||||||
check = 0;
|
|
||||||
remaining = length;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
written = MIN(NEAR_BUF_SIZE, remaining);
|
|
||||||
png_memcpy(buf, data, written); /* copy far buffer to near buffer */
|
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
|
|
||||||
err = 0;
|
|
||||||
#else
|
|
||||||
err = fwrite(buf, 1, written, io_ptr);
|
|
||||||
#endif
|
|
||||||
if (err != written)
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
check += err;
|
|
||||||
data += written;
|
|
||||||
remaining -= written;
|
|
||||||
}
|
|
||||||
while (remaining != 0);
|
|
||||||
}
|
|
||||||
if (check != length)
|
|
||||||
png_error(png_ptr, "Write Error");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This function is called to output any data pending writing (normally
|
|
||||||
to disk). After png_flush is called, there should be no data pending
|
|
||||||
writing in any buffers. */
|
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_flush(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr->output_flush_fn != NULL)
|
|
||||||
(*(png_ptr->output_flush_fn))(png_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
|
||||||
void PNGAPI
|
|
||||||
png_default_flush(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
png_FILE_p io_ptr;
|
|
||||||
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
|
||||||
if (io_ptr != NULL)
|
|
||||||
fflush(io_ptr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This function allows the application to supply new output functions for
|
|
||||||
libpng if standard C streams aren't being used.
|
|
||||||
|
|
||||||
This function takes as its arguments:
|
|
||||||
png_ptr - pointer to a png output data structure
|
|
||||||
io_ptr - pointer to user supplied structure containing info about
|
|
||||||
the output functions. May be NULL.
|
|
||||||
write_data_fn - pointer to a new output function that takes as its
|
|
||||||
arguments a pointer to a png_struct, a pointer to
|
|
||||||
data to be written, and a 32-bit unsigned int that is
|
|
||||||
the number of bytes to be written. The new write
|
|
||||||
function should call png_error(png_ptr, "Error msg")
|
|
||||||
to exit and output any fatal error messages.
|
|
||||||
flush_data_fn - pointer to a new flush function that takes as its
|
|
||||||
arguments a pointer to a png_struct. After a call to
|
|
||||||
the flush function, there should be no data in any buffers
|
|
||||||
or pending transmission. If the output method doesn't do
|
|
||||||
any buffering of ouput, a function prototype must still be
|
|
||||||
supplied although it doesn't have to do anything. If
|
|
||||||
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
|
||||||
time, output_flush_fn will be ignored, although it must be
|
|
||||||
supplied for compatibility. */
|
|
||||||
void PNGAPI
|
|
||||||
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
|
||||||
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
|
||||||
{
|
|
||||||
png_ptr->io_ptr = io_ptr;
|
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
|
||||||
if (write_data_fn != NULL)
|
|
||||||
png_ptr->write_data_fn = write_data_fn;
|
|
||||||
else
|
|
||||||
png_ptr->write_data_fn = png_default_write_data;
|
|
||||||
#else
|
|
||||||
png_ptr->write_data_fn = write_data_fn;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
|
||||||
if (output_flush_fn != NULL)
|
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
|
||||||
else
|
|
||||||
png_ptr->output_flush_fn = png_default_flush;
|
|
||||||
#else
|
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
|
||||||
|
|
||||||
/* It is an error to read while writing a png file */
|
|
||||||
if (png_ptr->read_data_fn != NULL)
|
|
||||||
{
|
|
||||||
png_ptr->read_data_fn = NULL;
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"Attempted to set both read_data_fn and write_data_fn in");
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"the same structure. Resetting read_data_fn to NULL.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(USE_FAR_KEYWORD)
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
|
||||||
{
|
|
||||||
void *near_ptr;
|
|
||||||
void FAR *far_ptr;
|
|
||||||
FP_OFF(near_ptr) = FP_OFF(ptr);
|
|
||||||
far_ptr = (void FAR *)near_ptr;
|
|
||||||
if(check != 0)
|
|
||||||
if(FP_SEG(ptr) != FP_SEG(far_ptr))
|
|
||||||
png_error(png_ptr,"segment lost in conversion");
|
|
||||||
return(near_ptr);
|
|
||||||
}
|
|
||||||
# else
|
|
||||||
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
|
||||||
{
|
|
||||||
void *near_ptr;
|
|
||||||
void FAR *far_ptr;
|
|
||||||
near_ptr = (void FAR *)ptr;
|
|
||||||
far_ptr = (void FAR *)near_ptr;
|
|
||||||
if(check != 0)
|
|
||||||
if(far_ptr != ptr)
|
|
||||||
png_error(png_ptr,"segment lost in conversion");
|
|
||||||
return(near_ptr);
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,572 +0,0 @@
|
||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
|
||||||
*
|
|
||||||
* Last changed in libpng 1.2.9 April 14, 2006
|
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
|
||||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
|
||||||
|
|
||||||
/* Transform the data according to the user's wishes. The order of
|
|
||||||
* transformations is significant.
|
|
||||||
*/
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_write_transformations(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_write_transformations\n");
|
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
|
||||||
if(png_ptr->write_user_transform_fn != NULL)
|
|
||||||
(*(png_ptr->write_user_transform_fn)) /* user write transform function */
|
|
||||||
(png_ptr, /* png_ptr */
|
|
||||||
&(png_ptr->row_info), /* row_info: */
|
|
||||||
/* png_uint_32 width; width of row */
|
|
||||||
/* png_uint_32 rowbytes; number of bytes in row */
|
|
||||||
/* png_byte color_type; color type of pixels */
|
|
||||||
/* png_byte bit_depth; bit depth of samples */
|
|
||||||
/* png_byte channels; number of channels (1-4) */
|
|
||||||
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
|
||||||
png_ptr->row_buf + 1); /* start of pixel data for row */
|
|
||||||
#endif
|
|
||||||
#if defined(PNG_WRITE_FILLER_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_FILLER)
|
|
||||||
png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
|
||||||
png_ptr->flags);
|
|
||||||
#endif
|
|
||||||
#if defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
|
||||||
png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
#if defined(PNG_WRITE_PACK_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_PACK)
|
|
||||||
png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
|
||||||
(png_uint_32)png_ptr->bit_depth);
|
|
||||||
#endif
|
|
||||||
#if defined(PNG_WRITE_SWAP_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
|
||||||
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
#if defined(PNG_WRITE_SHIFT_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_SHIFT)
|
|
||||||
png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
|
||||||
&(png_ptr->shift));
|
|
||||||
#endif
|
|
||||||
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_SWAP_ALPHA)
|
|
||||||
png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
|
||||||
png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
#if defined(PNG_WRITE_BGR_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_BGR)
|
|
||||||
png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
#if defined(PNG_WRITE_INVERT_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_INVERT_MONO)
|
|
||||||
png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_PACK_SUPPORTED)
|
|
||||||
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
|
|
||||||
* row_info bit depth should be 8 (one pixel per byte). The channels
|
|
||||||
* should be 1 (this only happens on grayscale and paletted images).
|
|
||||||
*/
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_pack\n");
|
|
||||||
if (row_info->bit_depth == 8 &&
|
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
row_info->channels == 1)
|
|
||||||
{
|
|
||||||
switch ((int)bit_depth)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
png_bytep sp, dp;
|
|
||||||
int mask, v;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
|
|
||||||
sp = row;
|
|
||||||
dp = row;
|
|
||||||
mask = 0x80;
|
|
||||||
v = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
if (*sp != 0)
|
|
||||||
v |= mask;
|
|
||||||
sp++;
|
|
||||||
if (mask > 1)
|
|
||||||
mask >>= 1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mask = 0x80;
|
|
||||||
*dp = (png_byte)v;
|
|
||||||
dp++;
|
|
||||||
v = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mask != 0x80)
|
|
||||||
*dp = (png_byte)v;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
png_bytep sp, dp;
|
|
||||||
int shift, v;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
|
|
||||||
sp = row;
|
|
||||||
dp = row;
|
|
||||||
shift = 6;
|
|
||||||
v = 0;
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
png_byte value;
|
|
||||||
|
|
||||||
value = (png_byte)(*sp & 0x03);
|
|
||||||
v |= (value << shift);
|
|
||||||
if (shift == 0)
|
|
||||||
{
|
|
||||||
shift = 6;
|
|
||||||
*dp = (png_byte)v;
|
|
||||||
dp++;
|
|
||||||
v = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
shift -= 2;
|
|
||||||
sp++;
|
|
||||||
}
|
|
||||||
if (shift != 6)
|
|
||||||
*dp = (png_byte)v;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 4:
|
|
||||||
{
|
|
||||||
png_bytep sp, dp;
|
|
||||||
int shift, v;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
|
|
||||||
sp = row;
|
|
||||||
dp = row;
|
|
||||||
shift = 4;
|
|
||||||
v = 0;
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
png_byte value;
|
|
||||||
|
|
||||||
value = (png_byte)(*sp & 0x0f);
|
|
||||||
v |= (value << shift);
|
|
||||||
|
|
||||||
if (shift == 0)
|
|
||||||
{
|
|
||||||
shift = 4;
|
|
||||||
*dp = (png_byte)v;
|
|
||||||
dp++;
|
|
||||||
v = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
shift -= 4;
|
|
||||||
|
|
||||||
sp++;
|
|
||||||
}
|
|
||||||
if (shift != 4)
|
|
||||||
*dp = (png_byte)v;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
row_info->bit_depth = (png_byte)bit_depth;
|
|
||||||
row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels);
|
|
||||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
|
|
||||||
row_info->width);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_SHIFT_SUPPORTED)
|
|
||||||
/* Shift pixel values to take advantage of whole range. Pass the
|
|
||||||
* true number of bits in bit_depth. The row should be packed
|
|
||||||
* according to row_info->bit_depth. Thus, if you had a row of
|
|
||||||
* bit depth 4, but the pixels only had values from 0 to 7, you
|
|
||||||
* would pass 3 as bit_depth, and this routine would translate the
|
|
||||||
* data to 0 to 15.
|
|
||||||
*/
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_shift\n");
|
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
if (row != NULL && row_info != NULL &&
|
|
||||||
#else
|
|
||||||
if (
|
|
||||||
#endif
|
|
||||||
row_info->color_type != PNG_COLOR_TYPE_PALETTE)
|
|
||||||
{
|
|
||||||
int shift_start[4], shift_dec[4];
|
|
||||||
int channels = 0;
|
|
||||||
|
|
||||||
if (row_info->color_type & PNG_COLOR_MASK_COLOR)
|
|
||||||
{
|
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->red;
|
|
||||||
shift_dec[channels] = bit_depth->red;
|
|
||||||
channels++;
|
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->green;
|
|
||||||
shift_dec[channels] = bit_depth->green;
|
|
||||||
channels++;
|
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->blue;
|
|
||||||
shift_dec[channels] = bit_depth->blue;
|
|
||||||
channels++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->gray;
|
|
||||||
shift_dec[channels] = bit_depth->gray;
|
|
||||||
channels++;
|
|
||||||
}
|
|
||||||
if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
|
|
||||||
{
|
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->alpha;
|
|
||||||
shift_dec[channels] = bit_depth->alpha;
|
|
||||||
channels++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* with low row depths, could only be grayscale, so one channel */
|
|
||||||
if (row_info->bit_depth < 8)
|
|
||||||
{
|
|
||||||
png_bytep bp = row;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_byte mask;
|
|
||||||
png_uint_32 row_bytes = row_info->rowbytes;
|
|
||||||
|
|
||||||
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
|
|
||||||
mask = 0x55;
|
|
||||||
else if (row_info->bit_depth == 4 && bit_depth->gray == 3)
|
|
||||||
mask = 0x11;
|
|
||||||
else
|
|
||||||
mask = 0xff;
|
|
||||||
|
|
||||||
for (i = 0; i < row_bytes; i++, bp++)
|
|
||||||
{
|
|
||||||
png_uint_16 v;
|
|
||||||
int j;
|
|
||||||
|
|
||||||
v = *bp;
|
|
||||||
*bp = 0;
|
|
||||||
for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0])
|
|
||||||
{
|
|
||||||
if (j > 0)
|
|
||||||
*bp |= (png_byte)((v << j) & 0xff);
|
|
||||||
else
|
|
||||||
*bp |= (png_byte)((v >> (-j)) & mask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_bytep bp = row;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 istop = channels * row_info->width;
|
|
||||||
|
|
||||||
for (i = 0; i < istop; i++, bp++)
|
|
||||||
{
|
|
||||||
|
|
||||||
png_uint_16 v;
|
|
||||||
int j;
|
|
||||||
int c = (int)(i%channels);
|
|
||||||
|
|
||||||
v = *bp;
|
|
||||||
*bp = 0;
|
|
||||||
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
|
||||||
{
|
|
||||||
if (j > 0)
|
|
||||||
*bp |= (png_byte)((v << j) & 0xff);
|
|
||||||
else
|
|
||||||
*bp |= (png_byte)((v >> (-j)) & 0xff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_bytep bp;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 istop = channels * row_info->width;
|
|
||||||
|
|
||||||
for (bp = row, i = 0; i < istop; i++)
|
|
||||||
{
|
|
||||||
int c = (int)(i%channels);
|
|
||||||
png_uint_16 value, v;
|
|
||||||
int j;
|
|
||||||
|
|
||||||
v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1));
|
|
||||||
value = 0;
|
|
||||||
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
|
||||||
{
|
|
||||||
if (j > 0)
|
|
||||||
value |= (png_uint_16)((v << j) & (png_uint_16)0xffff);
|
|
||||||
else
|
|
||||||
value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
|
|
||||||
}
|
|
||||||
*bp++ = (png_byte)(value >> 8);
|
|
||||||
*bp++ = (png_byte)(value & 0xff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_write_swap_alpha\n");
|
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
if (row != NULL && row_info != NULL)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
|
||||||
{
|
|
||||||
/* This converts from ARGB to RGBA */
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
for (i = 0, sp = dp = row; i < row_width; i++)
|
|
||||||
{
|
|
||||||
png_byte save = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = save;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* This converts from AARRGGBB to RRGGBBAA */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_width; i++)
|
|
||||||
{
|
|
||||||
png_byte save[2];
|
|
||||||
save[0] = *(sp++);
|
|
||||||
save[1] = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = save[0];
|
|
||||||
*(dp++) = save[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
|
||||||
{
|
|
||||||
/* This converts from AG to GA */
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_width; i++)
|
|
||||||
{
|
|
||||||
png_byte save = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = save;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* This converts from AAGG to GGAA */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_width; i++)
|
|
||||||
{
|
|
||||||
png_byte save[2];
|
|
||||||
save[0] = *(sp++);
|
|
||||||
save[1] = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = save[0];
|
|
||||||
*(dp++) = save[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_write_invert_alpha\n");
|
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
if (row != NULL && row_info != NULL)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
|
||||||
{
|
|
||||||
/* This inverts the alpha channel in RGBA */
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
for (i = 0, sp = dp = row; i < row_width; i++)
|
|
||||||
{
|
|
||||||
/* does nothing
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*/
|
|
||||||
sp+=3; dp = sp;
|
|
||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* This inverts the alpha channel in RRGGBBAA */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_width; i++)
|
|
||||||
{
|
|
||||||
/* does nothing
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*/
|
|
||||||
sp+=6; dp = sp;
|
|
||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
|
||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
|
||||||
{
|
|
||||||
/* This inverts the alpha channel in GA */
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_width; i++)
|
|
||||||
{
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* This inverts the alpha channel in GGAA */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_width; i++)
|
|
||||||
{
|
|
||||||
/* does nothing
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*(dp++) = *(sp++);
|
|
||||||
*/
|
|
||||||
sp+=2; dp = sp;
|
|
||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
|
||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
|
||||||
/* undoes intrapixel differencing */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_write_intrapixel\n");
|
|
||||||
if (
|
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
|
||||||
{
|
|
||||||
int bytes_per_pixel;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_bytep rp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
|
||||||
bytes_per_pixel = 3;
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
|
||||||
bytes_per_pixel = 4;
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
|
||||||
{
|
|
||||||
*(rp) = (png_byte)((*rp - *(rp+1))&0xff);
|
|
||||||
*(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (row_info->bit_depth == 16)
|
|
||||||
{
|
|
||||||
png_bytep rp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
|
||||||
bytes_per_pixel = 6;
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
|
||||||
bytes_per_pixel = 8;
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
|
||||||
{
|
|
||||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp+1);
|
|
||||||
png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3);
|
|
||||||
png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5);
|
|
||||||
png_uint_32 red = (png_uint_32)((s0-s1) & 0xffffL);
|
|
||||||
png_uint_32 blue = (png_uint_32)((s2-s1) & 0xffffL);
|
|
||||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
|
||||||
*(rp+1) = (png_byte)(red & 0xff);
|
|
||||||
*(rp+4) = (png_byte)((blue >> 8) & 0xff);
|
|
||||||
*(rp+5) = (png_byte)(blue & 0xff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,44 +0,0 @@
|
||||||
/SDL.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_active.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_audio.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_byteorder.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_cdrom.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_config.h/1.1/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_config.h.default/1.1/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_config.h.in/1.1/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_config_amiga.h/1.1/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_config_dreamcast.h/1.1/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_config_macos.h/1.1/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_config_macosx.h/1.1/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_config_minimal.h/1.1/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_config_os2.h/1.1/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_config_win32.h/1.1/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_copying.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_cpuinfo.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_endian.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_error.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_events.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_getenv.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_joystick.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_keyboard.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_keysym.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_loadso.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_main.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_mouse.h/1.3/Sat Jun 24 19:59:04 2006//
|
|
||||||
/SDL_mutex.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_name.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_opengl.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_platform.h/1.1/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_quit.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_rwops.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_stdinc.h/1.1/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_syswm.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_thread.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_timer.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_types.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_version.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/SDL_video.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/begin_code.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
/close_code.h/1.3/Sat Jun 24 19:59:05 2006//
|
|
||||||
D/SDL_Debug////
|
|
||||||
D/SDL_Release////
|
|
|
@ -1 +0,0 @@
|
||||||
VisualBoyAdvance/win32/dependencies/sdl
|
|
|
@ -1 +0,0 @@
|
||||||
:pserver:anonymous@vba.cvs.sourceforge.net:/cvsroot/vba
|
|
|
@ -1,94 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Main include header for the SDL library */
|
|
||||||
|
|
||||||
#ifndef _SDL_H
|
|
||||||
#define _SDL_H
|
|
||||||
|
|
||||||
#include "SDL_main.h"
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_audio.h"
|
|
||||||
#include "SDL_cdrom.h"
|
|
||||||
#include "SDL_cpuinfo.h"
|
|
||||||
#include "SDL_endian.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
#include "SDL_events.h"
|
|
||||||
#include "SDL_loadso.h"
|
|
||||||
#include "SDL_mutex.h"
|
|
||||||
#include "SDL_rwops.h"
|
|
||||||
#include "SDL_thread.h"
|
|
||||||
#include "SDL_timer.h"
|
|
||||||
#include "SDL_video.h"
|
|
||||||
#include "SDL_version.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* As of version 0.5, SDL is loaded dynamically into the application */
|
|
||||||
|
|
||||||
/* These are the flags which may be passed to SDL_Init() -- you should
|
|
||||||
specify the subsystems which you will be using in your application.
|
|
||||||
*/
|
|
||||||
#define SDL_INIT_TIMER 0x00000001
|
|
||||||
#define SDL_INIT_AUDIO 0x00000010
|
|
||||||
#define SDL_INIT_VIDEO 0x00000020
|
|
||||||
#define SDL_INIT_CDROM 0x00000100
|
|
||||||
#define SDL_INIT_JOYSTICK 0x00000200
|
|
||||||
#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */
|
|
||||||
#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */
|
|
||||||
#define SDL_INIT_EVERYTHING 0x0000FFFF
|
|
||||||
|
|
||||||
/* This function loads the SDL dynamically linked library and initializes
|
|
||||||
* the subsystems specified by 'flags' (and those satisfying dependencies)
|
|
||||||
* Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
|
|
||||||
* signal handlers for some commonly ignored fatal signals (like SIGSEGV)
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
|
|
||||||
|
|
||||||
/* This function initializes specific SDL subsystems */
|
|
||||||
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
|
|
||||||
|
|
||||||
/* This function cleans up specific SDL subsystems */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
|
|
||||||
|
|
||||||
/* This function returns mask of the specified subsystems which have
|
|
||||||
been initialized.
|
|
||||||
If 'flags' is 0, it returns a mask of all initialized subsystems.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
|
|
||||||
|
|
||||||
/* This function cleans up all initialized subsystems and unloads the
|
|
||||||
* dynamically linked library. You should call it upon all exit conditions.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_Quit(void);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_H */
|
|
|
@ -1,3 +0,0 @@
|
||||||
/SDL.lib/1.1/Fri Aug 25 13:07:25 2006/-kb/
|
|
||||||
/SDLmain.lib/1.1/Fri Aug 25 13:07:25 2006/-kb/
|
|
||||||
D
|
|
|
@ -1 +0,0 @@
|
||||||
VisualBoyAdvance/win32/dependencies/sdl/SDL_Debug
|
|
|
@ -1 +0,0 @@
|
||||||
:pserver:anonymous@vba.cvs.sourceforge.net:/cvsroot/vba
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,3 +0,0 @@
|
||||||
/SDL.lib/1.1/Fri Aug 25 13:07:26 2006/-kb/
|
|
||||||
/SDLmain.lib/1.1/Fri Aug 25 13:07:26 2006/-kb/
|
|
||||||
D
|
|
|
@ -1 +0,0 @@
|
||||||
VisualBoyAdvance/win32/dependencies/sdl/SDL_Release
|
|
|
@ -1 +0,0 @@
|
||||||
:pserver:anonymous@vba.cvs.sourceforge.net:/cvsroot/vba
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Include file for SDL application focus event handling */
|
|
||||||
|
|
||||||
#ifndef _SDL_active_h
|
|
||||||
#define _SDL_active_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The available application states */
|
|
||||||
#define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */
|
|
||||||
#define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */
|
|
||||||
#define SDL_APPACTIVE 0x04 /* The application is active */
|
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
/*
|
|
||||||
* This function returns the current state of the application, which is a
|
|
||||||
* bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and
|
|
||||||
* SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to
|
|
||||||
* see your application, otherwise it has been iconified or disabled.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
|
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_active_h */
|
|
|
@ -1,253 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Access to the raw audio mixing buffer for the SDL library */
|
|
||||||
|
|
||||||
#ifndef _SDL_audio_h
|
|
||||||
#define _SDL_audio_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
#include "SDL_endian.h"
|
|
||||||
#include "SDL_mutex.h"
|
|
||||||
#include "SDL_thread.h"
|
|
||||||
#include "SDL_rwops.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The calculated values in this structure are calculated by SDL_OpenAudio() */
|
|
||||||
typedef struct SDL_AudioSpec {
|
|
||||||
int freq; /* DSP frequency -- samples per second */
|
|
||||||
Uint16 format; /* Audio data format */
|
|
||||||
Uint8 channels; /* Number of channels: 1 mono, 2 stereo */
|
|
||||||
Uint8 silence; /* Audio buffer silence value (calculated) */
|
|
||||||
Uint16 samples; /* Audio buffer size in samples (power of 2) */
|
|
||||||
Uint16 padding; /* Necessary for some compile environments */
|
|
||||||
Uint32 size; /* Audio buffer size in bytes (calculated) */
|
|
||||||
/* This function is called when the audio device needs more data.
|
|
||||||
'stream' is a pointer to the audio data buffer
|
|
||||||
'len' is the length of that buffer in bytes.
|
|
||||||
Once the callback returns, the buffer will no longer be valid.
|
|
||||||
Stereo samples are stored in a LRLRLR ordering.
|
|
||||||
*/
|
|
||||||
void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len);
|
|
||||||
void *userdata;
|
|
||||||
} SDL_AudioSpec;
|
|
||||||
|
|
||||||
/* Audio format flags (defaults to LSB byte order) */
|
|
||||||
#define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */
|
|
||||||
#define AUDIO_S8 0x8008 /* Signed 8-bit samples */
|
|
||||||
#define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */
|
|
||||||
#define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */
|
|
||||||
#define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */
|
|
||||||
#define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */
|
|
||||||
#define AUDIO_U16 AUDIO_U16LSB
|
|
||||||
#define AUDIO_S16 AUDIO_S16LSB
|
|
||||||
|
|
||||||
/* Native audio byte ordering */
|
|
||||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
|
||||||
#define AUDIO_U16SYS AUDIO_U16LSB
|
|
||||||
#define AUDIO_S16SYS AUDIO_S16LSB
|
|
||||||
#else
|
|
||||||
#define AUDIO_U16SYS AUDIO_U16MSB
|
|
||||||
#define AUDIO_S16SYS AUDIO_S16MSB
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* A structure to hold a set of audio conversion filters and buffers */
|
|
||||||
typedef struct SDL_AudioCVT {
|
|
||||||
int needed; /* Set to 1 if conversion possible */
|
|
||||||
Uint16 src_format; /* Source audio format */
|
|
||||||
Uint16 dst_format; /* Target audio format */
|
|
||||||
double rate_incr; /* Rate conversion increment */
|
|
||||||
Uint8 *buf; /* Buffer to hold entire audio data */
|
|
||||||
int len; /* Length of original audio buffer */
|
|
||||||
int len_cvt; /* Length of converted audio buffer */
|
|
||||||
int len_mult; /* buffer must be len*len_mult big */
|
|
||||||
double len_ratio; /* Given len, final size is len*len_ratio */
|
|
||||||
void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
|
|
||||||
int filter_index; /* Current audio conversion function */
|
|
||||||
} SDL_AudioCVT;
|
|
||||||
|
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
|
|
||||||
/* These functions are used internally, and should not be used unless you
|
|
||||||
* have a specific need to specify the audio driver you want to use.
|
|
||||||
* You should normally use SDL_Init() or SDL_InitSubSystem().
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
|
|
||||||
|
|
||||||
/* This function fills the given character buffer with the name of the
|
|
||||||
* current audio driver, and returns a pointer to it if the audio driver has
|
|
||||||
* been initialized. It returns NULL if no driver has been initialized.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function opens the audio device with the desired parameters, and
|
|
||||||
* returns 0 if successful, placing the actual hardware parameters in the
|
|
||||||
* structure pointed to by 'obtained'. If 'obtained' is NULL, the audio
|
|
||||||
* data passed to the callback function will be guaranteed to be in the
|
|
||||||
* requested format, and will be automatically converted to the hardware
|
|
||||||
* audio format if necessary. This function returns -1 if it failed
|
|
||||||
* to open the audio device, or couldn't set up the audio thread.
|
|
||||||
*
|
|
||||||
* When filling in the desired audio spec structure,
|
|
||||||
* 'desired->freq' should be the desired audio frequency in samples-per-second.
|
|
||||||
* 'desired->format' should be the desired audio format.
|
|
||||||
* 'desired->samples' is the desired size of the audio buffer, in samples.
|
|
||||||
* This number should be a power of two, and may be adjusted by the audio
|
|
||||||
* driver to a value more suitable for the hardware. Good values seem to
|
|
||||||
* range between 512 and 8096 inclusive, depending on the application and
|
|
||||||
* CPU speed. Smaller values yield faster response time, but can lead
|
|
||||||
* to underflow if the application is doing heavy processing and cannot
|
|
||||||
* fill the audio buffer in time. A stereo sample consists of both right
|
|
||||||
* and left channels in LR ordering.
|
|
||||||
* Note that the number of samples is directly related to time by the
|
|
||||||
* following formula: ms = (samples*1000)/freq
|
|
||||||
* 'desired->size' is the size in bytes of the audio buffer, and is
|
|
||||||
* calculated by SDL_OpenAudio().
|
|
||||||
* 'desired->silence' is the value used to set the buffer to silence,
|
|
||||||
* and is calculated by SDL_OpenAudio().
|
|
||||||
* 'desired->callback' should be set to a function that will be called
|
|
||||||
* when the audio device is ready for more data. It is passed a pointer
|
|
||||||
* to the audio buffer, and the length in bytes of the audio buffer.
|
|
||||||
* This function usually runs in a separate thread, and so you should
|
|
||||||
* protect data structures that it accesses by calling SDL_LockAudio()
|
|
||||||
* and SDL_UnlockAudio() in your code.
|
|
||||||
* 'desired->userdata' is passed as the first parameter to your callback
|
|
||||||
* function.
|
|
||||||
*
|
|
||||||
* The audio device starts out playing silence when it's opened, and should
|
|
||||||
* be enabled for playing by calling SDL_PauseAudio(0) when you are ready
|
|
||||||
* for your audio callback function to be called. Since the audio driver
|
|
||||||
* may modify the requested size of the audio buffer, you should allocate
|
|
||||||
* any local mixing buffers after you open the audio device.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the current audio state:
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
SDL_AUDIO_STOPPED = 0,
|
|
||||||
SDL_AUDIO_PLAYING,
|
|
||||||
SDL_AUDIO_PAUSED
|
|
||||||
} SDL_audiostatus;
|
|
||||||
extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function pauses and unpauses the audio callback processing.
|
|
||||||
* It should be called with a parameter of 0 after opening the audio
|
|
||||||
* device to start playing sound. This is so you can safely initialize
|
|
||||||
* data for your callback function after opening the audio device.
|
|
||||||
* Silence will be written to the audio device during the pause.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function loads a WAVE from the data source, automatically freeing
|
|
||||||
* that source if 'freesrc' is non-zero. For example, to load a WAVE file,
|
|
||||||
* you could do:
|
|
||||||
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
|
|
||||||
*
|
|
||||||
* If this function succeeds, it returns the given SDL_AudioSpec,
|
|
||||||
* filled with the audio data format of the wave data, and sets
|
|
||||||
* 'audio_buf' to a malloc()'d buffer containing the audio data,
|
|
||||||
* and sets 'audio_len' to the length of that audio buffer, in bytes.
|
|
||||||
* You need to free the audio buffer with SDL_FreeWAV() when you are
|
|
||||||
* done with it.
|
|
||||||
*
|
|
||||||
* This function returns NULL and sets the SDL error message if the
|
|
||||||
* wave file cannot be opened, uses an unknown data format, or is
|
|
||||||
* corrupt. Currently raw and MS-ADPCM WAVE files are supported.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
|
|
||||||
|
|
||||||
/* Compatibility convenience function -- loads a WAV from a file */
|
|
||||||
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
|
|
||||||
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function frees data previously allocated with SDL_LoadWAV_RW()
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function takes a source format and rate and a destination format
|
|
||||||
* and rate, and initializes the 'cvt' structure with information needed
|
|
||||||
* by SDL_ConvertAudio() to convert a buffer of audio data from one format
|
|
||||||
* to the other.
|
|
||||||
* This function returns 0, or -1 if there was an error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
|
|
||||||
Uint16 src_format, Uint8 src_channels, int src_rate,
|
|
||||||
Uint16 dst_format, Uint8 dst_channels, int dst_rate);
|
|
||||||
|
|
||||||
/* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(),
|
|
||||||
* created an audio buffer cvt->buf, and filled it with cvt->len bytes of
|
|
||||||
* audio data in the source format, this function will convert it in-place
|
|
||||||
* to the desired format.
|
|
||||||
* The data conversion may expand the size of the audio data, so the buffer
|
|
||||||
* cvt->buf should be allocated after the cvt structure is initialized by
|
|
||||||
* SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This takes two audio buffers of the playing audio format and mixes
|
|
||||||
* them, performing addition, volume adjustment, and overflow clipping.
|
|
||||||
* The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
|
|
||||||
* for full audio volume. Note this does not change hardware volume.
|
|
||||||
* This is provided for convenience -- you can mix your own audio data.
|
|
||||||
*/
|
|
||||||
#define SDL_MIX_MAXVOLUME 128
|
|
||||||
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The lock manipulated by these functions protects the callback function.
|
|
||||||
* During a LockAudio/UnlockAudio pair, you can be guaranteed that the
|
|
||||||
* callback function is not running. Do not call these from the callback
|
|
||||||
* function or you will cause deadlock.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function shuts down audio processing and closes the audio device.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
|
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_audio_h */
|
|
|
@ -1,24 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* DEPRECATED */
|
|
||||||
#include "SDL_endian.h"
|
|
|
@ -1,171 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This is the CD-audio control API for Simple DirectMedia Layer */
|
|
||||||
|
|
||||||
#ifndef _SDL_cdrom_h
|
|
||||||
#define _SDL_cdrom_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* In order to use these functions, SDL_Init() must have been called
|
|
||||||
with the SDL_INIT_CDROM flag. This causes SDL to scan the system
|
|
||||||
for CD-ROM drives, and load appropriate drivers.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* The maximum number of CD-ROM tracks on a disk */
|
|
||||||
#define SDL_MAX_TRACKS 99
|
|
||||||
|
|
||||||
/* The types of CD-ROM track possible */
|
|
||||||
#define SDL_AUDIO_TRACK 0x00
|
|
||||||
#define SDL_DATA_TRACK 0x04
|
|
||||||
|
|
||||||
/* The possible states which a CD-ROM drive can be in. */
|
|
||||||
typedef enum {
|
|
||||||
CD_TRAYEMPTY,
|
|
||||||
CD_STOPPED,
|
|
||||||
CD_PLAYING,
|
|
||||||
CD_PAUSED,
|
|
||||||
CD_ERROR = -1
|
|
||||||
} CDstatus;
|
|
||||||
|
|
||||||
/* Given a status, returns true if there's a disk in the drive */
|
|
||||||
#define CD_INDRIVE(status) ((int)(status) > 0)
|
|
||||||
|
|
||||||
typedef struct SDL_CDtrack {
|
|
||||||
Uint8 id; /* Track number */
|
|
||||||
Uint8 type; /* Data or audio track */
|
|
||||||
Uint16 unused;
|
|
||||||
Uint32 length; /* Length, in frames, of this track */
|
|
||||||
Uint32 offset; /* Offset, in frames, from start of disk */
|
|
||||||
} SDL_CDtrack;
|
|
||||||
|
|
||||||
/* This structure is only current as of the last call to SDL_CDStatus() */
|
|
||||||
typedef struct SDL_CD {
|
|
||||||
int id; /* Private drive identifier */
|
|
||||||
CDstatus status; /* Current drive status */
|
|
||||||
|
|
||||||
/* The rest of this structure is only valid if there's a CD in drive */
|
|
||||||
int numtracks; /* Number of tracks on disk */
|
|
||||||
int cur_track; /* Current track position */
|
|
||||||
int cur_frame; /* Current frame offset within current track */
|
|
||||||
SDL_CDtrack track[SDL_MAX_TRACKS+1];
|
|
||||||
} SDL_CD;
|
|
||||||
|
|
||||||
/* Conversion functions from frames to Minute/Second/Frames and vice versa */
|
|
||||||
#define CD_FPS 75
|
|
||||||
#define FRAMES_TO_MSF(f, M,S,F) { \
|
|
||||||
int value = f; \
|
|
||||||
*(F) = value%CD_FPS; \
|
|
||||||
value /= CD_FPS; \
|
|
||||||
*(S) = value%60; \
|
|
||||||
value /= 60; \
|
|
||||||
*(M) = value; \
|
|
||||||
}
|
|
||||||
#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F))
|
|
||||||
|
|
||||||
/* CD-audio API functions: */
|
|
||||||
|
|
||||||
/* Returns the number of CD-ROM drives on the system, or -1 if
|
|
||||||
SDL_Init() has not been called with the SDL_INIT_CDROM flag.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_CDNumDrives(void);
|
|
||||||
|
|
||||||
/* Returns a human-readable, system-dependent identifier for the CD-ROM.
|
|
||||||
Example:
|
|
||||||
"/dev/cdrom"
|
|
||||||
"E:"
|
|
||||||
"/dev/disk/ide/1/master"
|
|
||||||
*/
|
|
||||||
extern DECLSPEC const char * SDLCALL SDL_CDName(int drive);
|
|
||||||
|
|
||||||
/* Opens a CD-ROM drive for access. It returns a drive handle on success,
|
|
||||||
or NULL if the drive was invalid or busy. This newly opened CD-ROM
|
|
||||||
becomes the default CD used when other CD functions are passed a NULL
|
|
||||||
CD-ROM handle.
|
|
||||||
Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive);
|
|
||||||
|
|
||||||
/* This function returns the current status of the given drive.
|
|
||||||
If the drive has a CD in it, the table of contents of the CD and current
|
|
||||||
play position of the CD will be stored in the SDL_CD structure.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom);
|
|
||||||
|
|
||||||
/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
|
|
||||||
tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
|
|
||||||
until the end of the CD. This function will skip data tracks.
|
|
||||||
This function should only be called after calling SDL_CDStatus() to
|
|
||||||
get track information about the CD.
|
|
||||||
For example:
|
|
||||||
// Play entire CD:
|
|
||||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
|
|
||||||
SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
|
|
||||||
// Play last track:
|
|
||||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
|
|
||||||
SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
|
|
||||||
}
|
|
||||||
// Play first and second track and 10 seconds of third track:
|
|
||||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
|
|
||||||
SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);
|
|
||||||
|
|
||||||
This function returns 0, or -1 if there was an error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom,
|
|
||||||
int start_track, int start_frame, int ntracks, int nframes);
|
|
||||||
|
|
||||||
/* Play the given CD starting at 'start' frame for 'length' frames.
|
|
||||||
It returns 0, or -1 if there was an error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length);
|
|
||||||
|
|
||||||
/* Pause play -- returns 0, or -1 on error */
|
|
||||||
extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom);
|
|
||||||
|
|
||||||
/* Resume play -- returns 0, or -1 on error */
|
|
||||||
extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom);
|
|
||||||
|
|
||||||
/* Stop play -- returns 0, or -1 on error */
|
|
||||||
extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom);
|
|
||||||
|
|
||||||
/* Eject CD-ROM -- returns 0, or -1 on error */
|
|
||||||
extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom);
|
|
||||||
|
|
||||||
/* Closes the handle for the CD-ROM drive */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom);
|
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_video_h */
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_config_h
|
|
||||||
#define _SDL_config_h
|
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
|
||||||
|
|
||||||
/* Add any platform that doesn't build using the configure system */
|
|
||||||
#if defined(__AMIGA__)
|
|
||||||
#include "SDL_config_amiga.h"
|
|
||||||
#elif defined(__DREAMCAST__)
|
|
||||||
#include "SDL_config_dreamcast.h"
|
|
||||||
#elif defined(__MACOS__)
|
|
||||||
#include "SDL_config_macos.h"
|
|
||||||
#elif defined(__MACOSX__)
|
|
||||||
#include "SDL_config_macosx.h"
|
|
||||||
#elif defined(__WIN32__)
|
|
||||||
#include "SDL_config_win32.h"
|
|
||||||
#elif defined(__OS2__)
|
|
||||||
#include "SDL_config_os2.h"
|
|
||||||
#else
|
|
||||||
#include "SDL_config_minimal.h"
|
|
||||||
#endif /* platform config */
|
|
||||||
|
|
||||||
#endif /* _SDL_config_h */
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_config_h
|
|
||||||
#define _SDL_config_h
|
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
|
||||||
|
|
||||||
/* Add any platform that doesn't build using the configure system */
|
|
||||||
#if defined(__AMIGA__)
|
|
||||||
#include "SDL_config_amiga.h"
|
|
||||||
#elif defined(__DREAMCAST__)
|
|
||||||
#include "SDL_config_dreamcast.h"
|
|
||||||
#elif defined(__MACOS__)
|
|
||||||
#include "SDL_config_macos.h"
|
|
||||||
#elif defined(__MACOSX__)
|
|
||||||
#include "SDL_config_macosx.h"
|
|
||||||
#elif defined(__WIN32__)
|
|
||||||
#include "SDL_config_win32.h"
|
|
||||||
#elif defined(__OS2__)
|
|
||||||
#include "SDL_config_os2.h"
|
|
||||||
#else
|
|
||||||
#include "SDL_config_minimal.h"
|
|
||||||
#endif /* platform config */
|
|
||||||
|
|
||||||
#endif /* _SDL_config_h */
|
|
|
@ -1,305 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_config_h
|
|
||||||
#define _SDL_config_h
|
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
|
||||||
|
|
||||||
/* General platform specific identifiers */
|
|
||||||
#include "SDL_platform.h"
|
|
||||||
|
|
||||||
/* C language features */
|
|
||||||
#undef const
|
|
||||||
#undef inline
|
|
||||||
#undef volatile
|
|
||||||
|
|
||||||
/* C datatypes */
|
|
||||||
#undef size_t
|
|
||||||
#undef int8_t
|
|
||||||
#undef uint8_t
|
|
||||||
#undef int16_t
|
|
||||||
#undef uint16_t
|
|
||||||
#undef int32_t
|
|
||||||
#undef uint32_t
|
|
||||||
#undef int64_t
|
|
||||||
#undef uint64_t
|
|
||||||
#undef uintptr_t
|
|
||||||
#undef SDL_HAS_64BIT_TYPE
|
|
||||||
|
|
||||||
/* Endianness */
|
|
||||||
#undef SDL_BYTEORDER
|
|
||||||
|
|
||||||
/* Comment this if you want to build without any C library requirements */
|
|
||||||
#undef HAVE_LIBC
|
|
||||||
#if HAVE_LIBC
|
|
||||||
|
|
||||||
/* Useful headers */
|
|
||||||
#undef HAVE_ALLOCA_H
|
|
||||||
#undef HAVE_SYS_TYPES_H
|
|
||||||
#undef HAVE_STDIO_H
|
|
||||||
#undef STDC_HEADERS
|
|
||||||
#undef HAVE_STDLIB_H
|
|
||||||
#undef HAVE_STDARG_H
|
|
||||||
#undef HAVE_MALLOC_H
|
|
||||||
#undef HAVE_MEMORY_H
|
|
||||||
#undef HAVE_STRING_H
|
|
||||||
#undef HAVE_STRINGS_H
|
|
||||||
#undef HAVE_INTTYPES_H
|
|
||||||
#undef HAVE_STDINT_H
|
|
||||||
#undef HAVE_CTYPE_H
|
|
||||||
#undef HAVE_MATH_H
|
|
||||||
#undef HAVE_ICONV_H
|
|
||||||
#undef HAVE_SIGNAL_H
|
|
||||||
#undef HAVE_ALTIVEC_H
|
|
||||||
|
|
||||||
/* C library functions */
|
|
||||||
#undef HAVE_MALLOC
|
|
||||||
#undef HAVE_CALLOC
|
|
||||||
#undef HAVE_REALLOC
|
|
||||||
#undef HAVE_FREE
|
|
||||||
#undef HAVE_ALLOCA
|
|
||||||
#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
|
|
||||||
#undef HAVE_GETENV
|
|
||||||
#undef HAVE_PUTENV
|
|
||||||
#undef HAVE_UNSETENV
|
|
||||||
#endif
|
|
||||||
#undef HAVE_QSORT
|
|
||||||
#undef HAVE_ABS
|
|
||||||
#undef HAVE_BCOPY
|
|
||||||
#undef HAVE_MEMSET
|
|
||||||
#undef HAVE_MEMCPY
|
|
||||||
#undef HAVE_MEMMOVE
|
|
||||||
#undef HAVE_MEMCMP
|
|
||||||
#undef HAVE_STRLEN
|
|
||||||
#undef HAVE_STRLCPY
|
|
||||||
#undef HAVE_STRLCAT
|
|
||||||
#undef HAVE_STRDUP
|
|
||||||
#undef HAVE__STRREV
|
|
||||||
#undef HAVE__STRUPR
|
|
||||||
#undef HAVE__STRLWR
|
|
||||||
#undef HAVE_INDEX
|
|
||||||
#undef HAVE_RINDEX
|
|
||||||
#undef HAVE_STRCHR
|
|
||||||
#undef HAVE_STRRCHR
|
|
||||||
#undef HAVE_STRSTR
|
|
||||||
#undef HAVE_ITOA
|
|
||||||
#undef HAVE__LTOA
|
|
||||||
#undef HAVE__UITOA
|
|
||||||
#undef HAVE__ULTOA
|
|
||||||
#undef HAVE_STRTOL
|
|
||||||
#undef HAVE_STRTOUL
|
|
||||||
#undef HAVE__I64TOA
|
|
||||||
#undef HAVE__UI64TOA
|
|
||||||
#undef HAVE_STRTOLL
|
|
||||||
#undef HAVE_STRTOULL
|
|
||||||
#undef HAVE_STRTOD
|
|
||||||
#undef HAVE_ATOI
|
|
||||||
#undef HAVE_ATOF
|
|
||||||
#undef HAVE_STRCMP
|
|
||||||
#undef HAVE_STRNCMP
|
|
||||||
#undef HAVE__STRICMP
|
|
||||||
#undef HAVE_STRCASECMP
|
|
||||||
#undef HAVE__STRNICMP
|
|
||||||
#undef HAVE_STRNCASECMP
|
|
||||||
#undef HAVE_SSCANF
|
|
||||||
#undef HAVE_SNPRINTF
|
|
||||||
#undef HAVE_VSNPRINTF
|
|
||||||
#undef HAVE_ICONV
|
|
||||||
#undef HAVE_SIGACTION
|
|
||||||
#undef HAVE_SETJMP
|
|
||||||
#undef HAVE_NANOSLEEP
|
|
||||||
#undef HAVE_CLOCK_GETTIME
|
|
||||||
#undef HAVE_DLVSYM
|
|
||||||
|
|
||||||
#else
|
|
||||||
/* We may need some replacement for stdarg.h here */
|
|
||||||
#include <stdarg.h>
|
|
||||||
#endif /* HAVE_LIBC */
|
|
||||||
|
|
||||||
/* Allow disabling of core subsystems */
|
|
||||||
#undef SDL_AUDIO_DISABLED
|
|
||||||
#undef SDL_CDROM_DISABLED
|
|
||||||
#undef SDL_CPUINFO_DISABLED
|
|
||||||
#undef SDL_EVENTS_DISABLED
|
|
||||||
#undef SDL_FILE_DISABLED
|
|
||||||
#undef SDL_JOYSTICK_DISABLED
|
|
||||||
#undef SDL_LOADSO_DISABLED
|
|
||||||
#undef SDL_THREADS_DISABLED
|
|
||||||
#undef SDL_TIMERS_DISABLED
|
|
||||||
#undef SDL_VIDEO_DISABLED
|
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
|
||||||
#undef SDL_AUDIO_DRIVER_AHI
|
|
||||||
#undef SDL_AUDIO_DRIVER_ALSA
|
|
||||||
#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
|
|
||||||
#undef SDL_AUDIO_DRIVER_ARTS
|
|
||||||
#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
|
|
||||||
#undef SDL_AUDIO_DRIVER_BAUDIO
|
|
||||||
#undef SDL_AUDIO_DRIVER_BSD
|
|
||||||
#undef SDL_AUDIO_DRIVER_COREAUDIO
|
|
||||||
#undef SDL_AUDIO_DRIVER_DART
|
|
||||||
#undef SDL_AUDIO_DRIVER_DC
|
|
||||||
#undef SDL_AUDIO_DRIVER_DISK
|
|
||||||
#undef SDL_AUDIO_DRIVER_DUMMY
|
|
||||||
#undef SDL_AUDIO_DRIVER_DMEDIA
|
|
||||||
#undef SDL_AUDIO_DRIVER_DSOUND
|
|
||||||
#undef SDL_AUDIO_DRIVER_ESD
|
|
||||||
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
|
|
||||||
#undef SDL_AUDIO_DRIVER_MINT
|
|
||||||
#undef SDL_AUDIO_DRIVER_MMEAUDIO
|
|
||||||
#undef SDL_AUDIO_DRIVER_NAS
|
|
||||||
#undef SDL_AUDIO_DRIVER_OSS
|
|
||||||
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
|
|
||||||
#undef SDL_AUDIO_DRIVER_PAUD
|
|
||||||
#undef SDL_AUDIO_DRIVER_QNXNTO
|
|
||||||
#undef SDL_AUDIO_DRIVER_SNDMGR
|
|
||||||
#undef SDL_AUDIO_DRIVER_SUNAUDIO
|
|
||||||
#undef SDL_AUDIO_DRIVER_WAVEOUT
|
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
|
||||||
#undef SDL_CDROM_AIX
|
|
||||||
#undef SDL_CDROM_BEOS
|
|
||||||
#undef SDL_CDROM_BSDI
|
|
||||||
#undef SDL_CDROM_DC
|
|
||||||
#undef SDL_CDROM_DUMMY
|
|
||||||
#undef SDL_CDROM_FREEBSD
|
|
||||||
#undef SDL_CDROM_LINUX
|
|
||||||
#undef SDL_CDROM_MACOS
|
|
||||||
#undef SDL_CDROM_MACOSX
|
|
||||||
#undef SDL_CDROM_MINT
|
|
||||||
#undef SDL_CDROM_OPENBSD
|
|
||||||
#undef SDL_CDROM_OS2
|
|
||||||
#undef SDL_CDROM_OSF
|
|
||||||
#undef SDL_CDROM_QNX
|
|
||||||
#undef SDL_CDROM_WIN32
|
|
||||||
|
|
||||||
/* Enable various input drivers */
|
|
||||||
#undef SDL_INPUT_TSLIB
|
|
||||||
#undef SDL_JOYSTICK_AMIGA
|
|
||||||
#undef SDL_JOYSTICK_BEOS
|
|
||||||
#undef SDL_JOYSTICK_DC
|
|
||||||
#undef SDL_JOYSTICK_DUMMY
|
|
||||||
#undef SDL_JOYSTICK_IOKIT
|
|
||||||
#undef SDL_JOYSTICK_LINUX
|
|
||||||
#undef SDL_JOYSTICK_LINUXEV
|
|
||||||
#undef SDL_JOYSTICK_MACOS
|
|
||||||
#undef SDL_JOYSTICK_MINT
|
|
||||||
#undef SDL_JOYSTICK_OS2
|
|
||||||
#undef SDL_JOYSTICK_RISCOS
|
|
||||||
#undef SDL_JOYSTICK_WINMM
|
|
||||||
#undef SDL_JOYSTICK_USBHID
|
|
||||||
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
|
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
|
||||||
#undef SDL_LOADSO_BEOS
|
|
||||||
#undef SDL_LOADSO_DLCOMPAT
|
|
||||||
#undef SDL_LOADSO_DLOPEN
|
|
||||||
#undef SDL_LOADSO_DUMMY
|
|
||||||
#undef SDL_LOADSO_LDG
|
|
||||||
#undef SDL_LOADSO_MACOS
|
|
||||||
#undef SDL_LOADSO_OS2
|
|
||||||
#undef SDL_LOADSO_WIN32
|
|
||||||
|
|
||||||
/* Enable various threading systems */
|
|
||||||
#undef SDL_THREAD_AMIGA
|
|
||||||
#undef SDL_THREAD_BEOS
|
|
||||||
#undef SDL_THREAD_DC
|
|
||||||
#undef SDL_THREAD_EPOC
|
|
||||||
#undef SDL_THREAD_OS2
|
|
||||||
#undef SDL_THREAD_PTH
|
|
||||||
#undef SDL_THREAD_PTHREAD
|
|
||||||
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
|
|
||||||
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
|
|
||||||
#undef SDL_THREAD_SPROC
|
|
||||||
#undef SDL_THREAD_WIN32
|
|
||||||
|
|
||||||
/* Enable various timer systems */
|
|
||||||
#undef SDL_TIMER_AMIGA
|
|
||||||
#undef SDL_TIMER_BEOS
|
|
||||||
#undef SDL_TIMER_DC
|
|
||||||
#undef SDL_TIMER_DUMMY
|
|
||||||
#undef SDL_TIMER_EPOC
|
|
||||||
#undef SDL_TIMER_MACOS
|
|
||||||
#undef SDL_TIMER_MINT
|
|
||||||
#undef SDL_TIMER_OS2
|
|
||||||
#undef SDL_TIMER_RISCOS
|
|
||||||
#undef SDL_TIMER_UNIX
|
|
||||||
#undef SDL_TIMER_WIN32
|
|
||||||
#undef SDL_TIMER_WINCE
|
|
||||||
|
|
||||||
/* Enable various video drivers */
|
|
||||||
#undef SDL_VIDEO_DRIVER_AALIB
|
|
||||||
#undef SDL_VIDEO_DRIVER_BWINDOW
|
|
||||||
#undef SDL_VIDEO_DRIVER_CYBERGRAPHICS
|
|
||||||
#undef SDL_VIDEO_DRIVER_DC
|
|
||||||
#undef SDL_VIDEO_DRIVER_DDRAW
|
|
||||||
#undef SDL_VIDEO_DRIVER_DGA
|
|
||||||
#undef SDL_VIDEO_DRIVER_DIRECTFB
|
|
||||||
#undef SDL_VIDEO_DRIVER_DRAWSPROCKET
|
|
||||||
#undef SDL_VIDEO_DRIVER_DUMMY
|
|
||||||
#undef SDL_VIDEO_DRIVER_EPOC
|
|
||||||
#undef SDL_VIDEO_DRIVER_FBCON
|
|
||||||
#undef SDL_VIDEO_DRIVER_GAPI
|
|
||||||
#undef SDL_VIDEO_DRIVER_GEM
|
|
||||||
#undef SDL_VIDEO_DRIVER_GGI
|
|
||||||
#undef SDL_VIDEO_DRIVER_IPOD
|
|
||||||
#undef SDL_VIDEO_DRIVER_NANOX
|
|
||||||
#undef SDL_VIDEO_DRIVER_OS2FS
|
|
||||||
#undef SDL_VIDEO_DRIVER_PHOTON
|
|
||||||
#undef SDL_VIDEO_DRIVER_PICOGUI
|
|
||||||
#undef SDL_VIDEO_DRIVER_PS2GS
|
|
||||||
#undef SDL_VIDEO_DRIVER_QTOPIA
|
|
||||||
#undef SDL_VIDEO_DRIVER_QUARTZ
|
|
||||||
#undef SDL_VIDEO_DRIVER_RISCOS
|
|
||||||
#undef SDL_VIDEO_DRIVER_SVGALIB
|
|
||||||
#undef SDL_VIDEO_DRIVER_TOOLBOX
|
|
||||||
#undef SDL_VIDEO_DRIVER_VGL
|
|
||||||
#undef SDL_VIDEO_DRIVER_WINDIB
|
|
||||||
#undef SDL_VIDEO_DRIVER_WSCONS
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DPMS
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11_VIDMODE
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11_XME
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11_XRANDR
|
|
||||||
#undef SDL_VIDEO_DRIVER_X11_XV
|
|
||||||
#undef SDL_VIDEO_DRIVER_XBIOS
|
|
||||||
|
|
||||||
/* Enable OpenGL support */
|
|
||||||
#undef SDL_VIDEO_OPENGL
|
|
||||||
#undef SDL_VIDEO_OPENGL_GLX
|
|
||||||
#undef SDL_VIDEO_OPENGL_WGL
|
|
||||||
#undef SDL_VIDEO_OPENGL_OSMESA
|
|
||||||
#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
|
|
||||||
|
|
||||||
/* Enable assembly routines */
|
|
||||||
#undef SDL_ASSEMBLY_ROUTINES
|
|
||||||
#undef SDL_HERMES_BLITTERS
|
|
||||||
#undef SDL_ALTIVEC_BLITTERS
|
|
||||||
|
|
||||||
#endif /* _SDL_config_h */
|
|
|
@ -1,80 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_config_amiga_h
|
|
||||||
#define _SDL_config_amiga_h
|
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
|
||||||
|
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
|
||||||
|
|
||||||
/* Useful headers */
|
|
||||||
#define HAVE_SYS_TYPES_H 1
|
|
||||||
#define HAVE_STDIO_H 1
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
#define HAVE_INTTYPES_H 1
|
|
||||||
#define HAVE_SIGNAL_H 1
|
|
||||||
|
|
||||||
/* C library functions */
|
|
||||||
#define HAVE_MALLOC 1
|
|
||||||
#define HAVE_CALLOC 1
|
|
||||||
#define HAVE_REALLOC 1
|
|
||||||
#define HAVE_FREE 1
|
|
||||||
#define HAVE_ALLOCA 1
|
|
||||||
#define HAVE_GETENV 1
|
|
||||||
#define HAVE_PUTENV 1
|
|
||||||
#define HAVE_MEMSET 1
|
|
||||||
#define HAVE_MEMCPY 1
|
|
||||||
#define HAVE_MEMMOVE 1
|
|
||||||
#define HAVE_MEMCMP 1
|
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
|
||||||
#define SDL_AUDIO_DRIVER_AHI 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
|
||||||
#define SDL_CDROM_DUMMY 1
|
|
||||||
|
|
||||||
/* Enable various input drivers */
|
|
||||||
#define SDL_JOYSTICK_AMIGA 1
|
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
|
||||||
#define SDL_LOADSO_DUMMY 1
|
|
||||||
|
|
||||||
/* Enable various threading systems */
|
|
||||||
#define SDL_THREAD_AMIGA 1
|
|
||||||
|
|
||||||
/* Enable various timer systems */
|
|
||||||
#define SDL_TIMER_AMIGA 1
|
|
||||||
|
|
||||||
/* Enable various video drivers */
|
|
||||||
#define SDL_VIDEO_DRIVER_CYBERGRAPHICS 1
|
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
|
||||||
|
|
||||||
/* Enable OpenGL support */
|
|
||||||
#define SDL_VIDEO_OPENGL 1
|
|
||||||
|
|
||||||
#endif /* _SDL_config_amiga_h */
|
|
|
@ -1,106 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_config_dreamcast_h
|
|
||||||
#define _SDL_config_dreamcast_h
|
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
|
||||||
|
|
||||||
typedef signed char int8_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef signed short int16_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef signed int int32_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
typedef signed long long int64_t;
|
|
||||||
typedef unsigned long long uint64_t;
|
|
||||||
typedef unsigned long uintptr_t;
|
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
|
||||||
|
|
||||||
/* Useful headers */
|
|
||||||
#define HAVE_SYS_TYPES_H 1
|
|
||||||
#define HAVE_STDIO_H 1
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
#define HAVE_CTYPE_H 1
|
|
||||||
|
|
||||||
/* C library functions */
|
|
||||||
#define HAVE_MALLOC 1
|
|
||||||
#define HAVE_CALLOC 1
|
|
||||||
#define HAVE_REALLOC 1
|
|
||||||
#define HAVE_FREE 1
|
|
||||||
#define HAVE_ALLOCA 1
|
|
||||||
#define HAVE_GETENV 1
|
|
||||||
#define HAVE_PUTENV 1
|
|
||||||
#define HAVE_QSORT 1
|
|
||||||
#define HAVE_ABS 1
|
|
||||||
#define HAVE_BCOPY 1
|
|
||||||
#define HAVE_MEMSET 1
|
|
||||||
#define HAVE_MEMCPY 1
|
|
||||||
#define HAVE_MEMMOVE 1
|
|
||||||
#define HAVE_MEMCMP 1
|
|
||||||
#define HAVE_STRLEN 1
|
|
||||||
#define HAVE_STRDUP 1
|
|
||||||
#define HAVE_INDEX 1
|
|
||||||
#define HAVE_RINDEX 1
|
|
||||||
#define HAVE_STRCHR 1
|
|
||||||
#define HAVE_STRRCHR 1
|
|
||||||
#define HAVE_STRSTR 1
|
|
||||||
#define HAVE_STRTOL 1
|
|
||||||
#define HAVE_STRTOD 1
|
|
||||||
#define HAVE_ATOI 1
|
|
||||||
#define HAVE_ATOF 1
|
|
||||||
#define HAVE_STRCMP 1
|
|
||||||
#define HAVE_STRNCMP 1
|
|
||||||
#define HAVE_STRICMP 1
|
|
||||||
#define HAVE_STRCASECMP 1
|
|
||||||
#define HAVE_SSCANF 1
|
|
||||||
#define HAVE_SNPRINTF 1
|
|
||||||
#define HAVE_VSNPRINTF 1
|
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
|
||||||
#define SDL_AUDIO_DRIVER_DC 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
|
||||||
#define SDL_CDROM_DC 1
|
|
||||||
|
|
||||||
/* Enable various input drivers */
|
|
||||||
#define SDL_JOYSTICK_DC 1
|
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
|
||||||
#define SDL_LOADSO_DUMMY 1
|
|
||||||
|
|
||||||
/* Enable various threading systems */
|
|
||||||
#define SDL_THREAD_DC 1
|
|
||||||
|
|
||||||
/* Enable various timer systems */
|
|
||||||
#define SDL_TIMER_DC 1
|
|
||||||
|
|
||||||
/* Enable various video drivers */
|
|
||||||
#define SDL_VIDEO_DRIVER_DC 1
|
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
|
||||||
|
|
||||||
#endif /* _SDL_config_dreamcast_h */
|
|
|
@ -1,112 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_config_macos_h
|
|
||||||
#define _SDL_config_macos_h
|
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
|
||||||
|
|
||||||
#include <MacTypes.h>
|
|
||||||
|
|
||||||
typedef SInt8 int8_t;
|
|
||||||
typedef UInt8 uint8_t;
|
|
||||||
typedef SInt16 int16_t;
|
|
||||||
typedef UInt16 uint16_t;
|
|
||||||
typedef SInt32 int32_t;
|
|
||||||
typedef UInt32 uint32_t;
|
|
||||||
typedef SInt64 int64_t;
|
|
||||||
typedef UInt64 uint64_t;
|
|
||||||
typedef unsigned long uintptr_t;
|
|
||||||
|
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
|
||||||
|
|
||||||
/* Useful headers */
|
|
||||||
#define HAVE_STDIO_H 1
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
#define HAVE_CTYPE_H 1
|
|
||||||
#define HAVE_MATH_H 1
|
|
||||||
#define HAVE_SIGNAL_H 1
|
|
||||||
|
|
||||||
/* C library functions */
|
|
||||||
#define HAVE_MALLOC 1
|
|
||||||
#define HAVE_CALLOC 1
|
|
||||||
#define HAVE_REALLOC 1
|
|
||||||
#define HAVE_FREE 1
|
|
||||||
#define HAVE_ALLOCA 1
|
|
||||||
#define HAVE_ABS 1
|
|
||||||
#define HAVE_MEMSET 1
|
|
||||||
#define HAVE_MEMCPY 1
|
|
||||||
#define HAVE_MEMMOVE 1
|
|
||||||
#define HAVE_MEMCMP 1
|
|
||||||
#define HAVE_STRLEN 1
|
|
||||||
#define HAVE_STRCHR 1
|
|
||||||
#define HAVE_STRRCHR 1
|
|
||||||
#define HAVE_STRSTR 1
|
|
||||||
#define HAVE_ITOA 1
|
|
||||||
#define HAVE_STRTOL 1
|
|
||||||
#define HAVE_STRTOD 1
|
|
||||||
#define HAVE_ATOI 1
|
|
||||||
#define HAVE_ATOF 1
|
|
||||||
#define HAVE_STRCMP 1
|
|
||||||
#define HAVE_STRNCMP 1
|
|
||||||
#define HAVE_SSCANF 1
|
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
|
||||||
#define SDL_AUDIO_DRIVER_SNDMGR 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
|
||||||
#if TARGET_API_MAC_CARBON
|
|
||||||
#define SDL_CDROM_DUMMY 1
|
|
||||||
#else
|
|
||||||
#define SDL_CDROM_MACOS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enable various input drivers */
|
|
||||||
#if TARGET_API_MAC_CARBON
|
|
||||||
#define SDL_JOYSTICK_DUMMY 1
|
|
||||||
#else
|
|
||||||
#define SDL_JOYSTICK_MACOS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
|
||||||
#define SDL_LOADSO_MACOS 1
|
|
||||||
|
|
||||||
/* Enable various threading systems */
|
|
||||||
#define SDL_THREADS_DISABLED 1
|
|
||||||
|
|
||||||
/* Enable various timer systems */
|
|
||||||
#define SDL_TIMER_MACOS 1
|
|
||||||
|
|
||||||
/* Enable various video drivers */
|
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
|
||||||
#define SDL_VIDEO_DRIVER_DRAWSPROCKET 1
|
|
||||||
#define SDL_VIDEO_DRIVER_TOOLBOX 1
|
|
||||||
|
|
||||||
/* Enable OpenGL support */
|
|
||||||
#define SDL_VIDEO_OPENGL 1
|
|
||||||
|
|
||||||
#endif /* _SDL_config_macos_h */
|
|
|
@ -1,132 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_config_macosx_h
|
|
||||||
#define _SDL_config_macosx_h
|
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
|
||||||
|
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
|
||||||
|
|
||||||
/* Useful headers */
|
|
||||||
/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */
|
|
||||||
#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) )
|
|
||||||
#define HAVE_ALLOCA_H 1
|
|
||||||
#endif
|
|
||||||
#define HAVE_SYS_TYPES_H 1
|
|
||||||
#define HAVE_STDIO_H 1
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
#define HAVE_INTTYPES_H 1
|
|
||||||
#define HAVE_STDINT_H 1
|
|
||||||
#define HAVE_CTYPE_H 1
|
|
||||||
#define HAVE_MATH_H 1
|
|
||||||
#define HAVE_SIGNAL_H 1
|
|
||||||
|
|
||||||
/* C library functions */
|
|
||||||
#define HAVE_MALLOC 1
|
|
||||||
#define HAVE_CALLOC 1
|
|
||||||
#define HAVE_REALLOC 1
|
|
||||||
#define HAVE_FREE 1
|
|
||||||
#define HAVE_ALLOCA 1
|
|
||||||
#define HAVE_GETENV 1
|
|
||||||
#define HAVE_PUTENV 1
|
|
||||||
#define HAVE_UNSETENV 1
|
|
||||||
#define HAVE_QSORT 1
|
|
||||||
#define HAVE_ABS 1
|
|
||||||
#define HAVE_BCOPY 1
|
|
||||||
#define HAVE_MEMSET 1
|
|
||||||
#define HAVE_MEMCPY 1
|
|
||||||
#define HAVE_MEMMOVE 1
|
|
||||||
#define HAVE_MEMCMP 1
|
|
||||||
#define HAVE_STRLEN 1
|
|
||||||
#define HAVE_STRLCPY 1
|
|
||||||
#define HAVE_STRLCAT 1
|
|
||||||
#define HAVE_STRDUP 1
|
|
||||||
#define HAVE_STRCHR 1
|
|
||||||
#define HAVE_STRRCHR 1
|
|
||||||
#define HAVE_STRSTR 1
|
|
||||||
#define HAVE_STRTOL 1
|
|
||||||
#define HAVE_STRTOUL 1
|
|
||||||
#define HAVE_STRTOLL 1
|
|
||||||
#define HAVE_STRTOULL 1
|
|
||||||
#define HAVE_STRTOD 1
|
|
||||||
#define HAVE_ATOI 1
|
|
||||||
#define HAVE_ATOF 1
|
|
||||||
#define HAVE_STRCMP 1
|
|
||||||
#define HAVE_STRNCMP 1
|
|
||||||
#define HAVE_STRCASECMP 1
|
|
||||||
#define HAVE_STRNCASECMP 1
|
|
||||||
#define HAVE_SSCANF 1
|
|
||||||
#define HAVE_SNPRINTF 1
|
|
||||||
#define HAVE_VSNPRINTF 1
|
|
||||||
#define HAVE_SIGACTION 1
|
|
||||||
#define HAVE_SETJMP 1
|
|
||||||
#define HAVE_NANOSLEEP 1
|
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
|
||||||
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
|
||||||
#define SDL_AUDIO_DRIVER_SNDMGR 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
|
||||||
#define SDL_CDROM_MACOSX 1
|
|
||||||
|
|
||||||
/* Enable various input drivers */
|
|
||||||
#define SDL_JOYSTICK_IOKIT 1
|
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
|
||||||
#ifdef __ppc__
|
|
||||||
/* For Mac OS X 10.2 compatibility */
|
|
||||||
#define SDL_LOADSO_DLCOMPAT 1
|
|
||||||
#else
|
|
||||||
#define SDL_LOADSO_DLOPEN 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enable various threading systems */
|
|
||||||
#define SDL_THREAD_PTHREAD 1
|
|
||||||
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
|
|
||||||
|
|
||||||
/* Enable various timer systems */
|
|
||||||
#define SDL_TIMER_UNIX 1
|
|
||||||
|
|
||||||
/* Enable various video drivers */
|
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
|
||||||
#if TARGET_API_MAC_CARBON
|
|
||||||
#define SDL_VIDEO_DRIVER_TOOLBOX 1
|
|
||||||
#else
|
|
||||||
#define SDL_VIDEO_DRIVER_QUARTZ 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enable OpenGL support */
|
|
||||||
#define SDL_VIDEO_OPENGL 1
|
|
||||||
|
|
||||||
/* Enable assembly routines */
|
|
||||||
#define SDL_ASSEMBLY_ROUTINES 1
|
|
||||||
#ifdef __ppc__
|
|
||||||
#define SDL_ALTIVEC_BLITTERS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _SDL_config_macosx_h */
|
|
|
@ -1,62 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_config_minimal_h
|
|
||||||
#define _SDL_config_minimal_h
|
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
|
||||||
|
|
||||||
/* This is the minimal configuration that can be used to build SDL */
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
typedef signed char int8_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef signed short int16_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef signed int int32_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
typedef unsigned int size_t;
|
|
||||||
typedef unsigned long uintptr_t;
|
|
||||||
|
|
||||||
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
|
||||||
|
|
||||||
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
|
|
||||||
#define SDL_CDROM_DISABLED 1
|
|
||||||
|
|
||||||
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
|
|
||||||
#define SDL_JOYSTICK_DISABLED 1
|
|
||||||
|
|
||||||
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
|
||||||
#define SDL_LOADSO_DISABLED 1
|
|
||||||
|
|
||||||
/* Enable the stub thread support (src/thread/generic/\*.c) */
|
|
||||||
#define SDL_THREADS_DISABLED 1
|
|
||||||
|
|
||||||
/* Enable the stub timer support (src/timer/dummy/\*.c) */
|
|
||||||
#define SDL_TIMERS_DISABLED 1
|
|
||||||
|
|
||||||
/* Enable the dummy video driver (src/video/dummy/\*.c) */
|
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
|
||||||
|
|
||||||
#endif /* _SDL_config_minimal_h */
|
|
|
@ -1,141 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_config_os2_h
|
|
||||||
#define _SDL_config_os2_h
|
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
|
||||||
|
|
||||||
typedef signed char int8_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef signed short int16_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef signed int int32_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
typedef unsigned int size_t;
|
|
||||||
typedef unsigned long uintptr_t;
|
|
||||||
typedef signed long long int64_t;
|
|
||||||
typedef unsigned long long uint64_t;
|
|
||||||
|
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
|
||||||
|
|
||||||
/* Use Watcom's LIBC */
|
|
||||||
#define HAVE_LIBC 1
|
|
||||||
|
|
||||||
/* Useful headers */
|
|
||||||
#define HAVE_SYS_TYPES_H 1
|
|
||||||
#define HAVE_STDIO_H 1
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
#define HAVE_STDLIB_H 1
|
|
||||||
#define HAVE_STDARG_H 1
|
|
||||||
#define HAVE_MALLOC_H 1
|
|
||||||
#define HAVE_MEMORY_H 1
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
#define HAVE_STRINGS_H 1
|
|
||||||
#define HAVE_INTTYPES_H 1
|
|
||||||
#define HAVE_STDINT_H 1
|
|
||||||
#define HAVE_CTYPE_H 1
|
|
||||||
#define HAVE_MATH_H 1
|
|
||||||
#define HAVE_SIGNAL_H 1
|
|
||||||
|
|
||||||
/* C library functions */
|
|
||||||
#define HAVE_MALLOC 1
|
|
||||||
#define HAVE_CALLOC 1
|
|
||||||
#define HAVE_REALLOC 1
|
|
||||||
#define HAVE_FREE 1
|
|
||||||
#define HAVE_ALLOCA 1
|
|
||||||
#define HAVE_GETENV 1
|
|
||||||
#define HAVE_PUTENV 1
|
|
||||||
#define HAVE_UNSETENV 1
|
|
||||||
#define HAVE_QSORT 1
|
|
||||||
#define HAVE_ABS 1
|
|
||||||
#define HAVE_BCOPY 1
|
|
||||||
#define HAVE_MEMSET 1
|
|
||||||
#define HAVE_MEMCPY 1
|
|
||||||
#define HAVE_MEMMOVE 1
|
|
||||||
#define HAVE_MEMCMP 1
|
|
||||||
#define HAVE_STRLEN 1
|
|
||||||
#define HAVE_STRLCPY 1
|
|
||||||
#define HAVE_STRLCAT 1
|
|
||||||
#define HAVE_STRDUP 1
|
|
||||||
#define HAVE__STRREV 1
|
|
||||||
#define HAVE__STRUPR 1
|
|
||||||
#define HAVE__STRLWR 1
|
|
||||||
#define HAVE_INDEX 1
|
|
||||||
#define HAVE_RINDEX 1
|
|
||||||
#define HAVE_STRCHR 1
|
|
||||||
#define HAVE_STRRCHR 1
|
|
||||||
#define HAVE_STRSTR 1
|
|
||||||
#define HAVE_ITOA 1
|
|
||||||
#define HAVE__LTOA 1
|
|
||||||
#define HAVE__UITOA 1
|
|
||||||
#define HAVE__ULTOA 1
|
|
||||||
#define HAVE_STRTOL 1
|
|
||||||
#define HAVE__I64TOA 1
|
|
||||||
#define HAVE__UI64TOA 1
|
|
||||||
#define HAVE_STRTOLL 1
|
|
||||||
#define HAVE_STRTOD 1
|
|
||||||
#define HAVE_ATOI 1
|
|
||||||
#define HAVE_ATOF 1
|
|
||||||
#define HAVE_STRCMP 1
|
|
||||||
#define HAVE_STRNCMP 1
|
|
||||||
#define HAVE_STRICMP 1
|
|
||||||
#define HAVE_STRCASECMP 1
|
|
||||||
#define HAVE_SSCANF 1
|
|
||||||
#define HAVE_SNPRINTF 1
|
|
||||||
#define HAVE_VSNPRINTF 1
|
|
||||||
#define HAVE_SETJMP 1
|
|
||||||
#define HAVE_CLOCK_GETTIME 1
|
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
|
||||||
#define SDL_AUDIO_DRIVER_DART 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
|
||||||
#define SDL_CDROM_OS2 1
|
|
||||||
|
|
||||||
/* Enable various input drivers */
|
|
||||||
#define SDL_JOYSTICK_OS2 1
|
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
|
||||||
#define SDL_LOADSO_OS2 1
|
|
||||||
|
|
||||||
/* Enable various threading systems */
|
|
||||||
#define SDL_THREAD_OS2 1
|
|
||||||
|
|
||||||
/* Enable various timer systems */
|
|
||||||
#define SDL_TIMER_OS2 1
|
|
||||||
|
|
||||||
/* Enable various video drivers */
|
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
|
||||||
#define SDL_VIDEO_DRIVER_OS2FS 1
|
|
||||||
|
|
||||||
/* Enable OpenGL support */
|
|
||||||
/* Nothing here yet for OS/2... :( */
|
|
||||||
|
|
||||||
/* Enable assembly routines where available */
|
|
||||||
#define SDL_ASSEMBLY_ROUTINES 1
|
|
||||||
|
|
||||||
#endif /* _SDL_config_os2_h */
|
|
|
@ -1,171 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_config_win32_h
|
|
||||||
#define _SDL_config_win32_h
|
|
||||||
|
|
||||||
#include "SDL_platform.h"
|
|
||||||
|
|
||||||
/* This is a set of defines to configure the SDL features */
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
typedef signed __int8 int8_t;
|
|
||||||
typedef unsigned __int8 uint8_t;
|
|
||||||
typedef signed __int16 int16_t;
|
|
||||||
typedef unsigned __int16 uint16_t;
|
|
||||||
typedef signed __int32 int32_t;
|
|
||||||
typedef unsigned __int32 uint32_t;
|
|
||||||
typedef signed __int64 int64_t;
|
|
||||||
typedef unsigned __int64 uint64_t;
|
|
||||||
#ifndef _UINTPTR_T_DEFINED
|
|
||||||
#ifdef _WIN64
|
|
||||||
typedef unsigned __int64 uintptr_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned int uintptr_t;
|
|
||||||
#endif
|
|
||||||
#define _UINTPTR_T_DEFINED
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
typedef signed char int8_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef signed short int16_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef signed int int32_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
typedef signed long long int64_t;
|
|
||||||
typedef unsigned long long uint64_t;
|
|
||||||
#ifndef _SIZE_T_DEFINED_
|
|
||||||
#define _SIZE_T_DEFINED_
|
|
||||||
typedef unsigned int size_t;
|
|
||||||
#endif
|
|
||||||
typedef unsigned int uintptr_t;
|
|
||||||
#endif /* _MSC_VER */
|
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
|
||||||
|
|
||||||
/* Enabled for SDL 1.2 (binary compatibility) */
|
|
||||||
#define HAVE_LIBC 1
|
|
||||||
#ifdef HAVE_LIBC
|
|
||||||
/* Useful headers */
|
|
||||||
#define HAVE_STDIO_H 1
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
#define HAVE_CTYPE_H 1
|
|
||||||
#define HAVE_MATH_H 1
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
#define HAVE_SIGNAL_H 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* C library functions */
|
|
||||||
#define HAVE_MALLOC 1
|
|
||||||
#define HAVE_CALLOC 1
|
|
||||||
#define HAVE_REALLOC 1
|
|
||||||
#define HAVE_FREE 1
|
|
||||||
#define HAVE_ALLOCA 1
|
|
||||||
#define HAVE_QSORT 1
|
|
||||||
#define HAVE_ABS 1
|
|
||||||
#define HAVE_MEMSET 1
|
|
||||||
#define HAVE_MEMCPY 1
|
|
||||||
#define HAVE_MEMMOVE 1
|
|
||||||
#define HAVE_MEMCMP 1
|
|
||||||
#define HAVE_STRLEN 1
|
|
||||||
#define HAVE__STRREV 1
|
|
||||||
#define HAVE__STRUPR 1
|
|
||||||
#define HAVE__STRLWR 1
|
|
||||||
#define HAVE_STRCHR 1
|
|
||||||
#define HAVE_STRRCHR 1
|
|
||||||
#define HAVE_STRSTR 1
|
|
||||||
#define HAVE_ITOA 1
|
|
||||||
#define HAVE__LTOA 1
|
|
||||||
#define HAVE__ULTOA 1
|
|
||||||
#define HAVE_STRTOL 1
|
|
||||||
#define HAVE_STRTOUL 1
|
|
||||||
#define HAVE_STRTOLL 1
|
|
||||||
#define HAVE_STRTOD 1
|
|
||||||
#define HAVE_ATOI 1
|
|
||||||
#define HAVE_ATOF 1
|
|
||||||
#define HAVE_STRCMP 1
|
|
||||||
#define HAVE_STRNCMP 1
|
|
||||||
#define HAVE__STRICMP 1
|
|
||||||
#define HAVE__STRNICMP 1
|
|
||||||
#define HAVE_SSCANF 1
|
|
||||||
#else
|
|
||||||
#define HAVE_STDARG_H 1
|
|
||||||
#define HAVE_STDDEF_H 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
#define SDL_AUDIO_DRIVER_DSOUND 1
|
|
||||||
#endif
|
|
||||||
#define SDL_AUDIO_DRIVER_WAVEOUT 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
|
||||||
|
|
||||||
/* Enable various cdrom drivers */
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
#define SDL_CDROM_DISABLED 1
|
|
||||||
#else
|
|
||||||
#define SDL_CDROM_WIN32 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enable various input drivers */
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
#define SDL_JOYSTICK_DISABLED 1
|
|
||||||
#else
|
|
||||||
#define SDL_JOYSTICK_WINMM 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
|
||||||
#define SDL_LOADSO_WIN32 1
|
|
||||||
|
|
||||||
/* Enable various threading systems */
|
|
||||||
#define SDL_THREAD_WIN32 1
|
|
||||||
|
|
||||||
/* Enable various timer systems */
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
#define SDL_TIMER_WINCE 1
|
|
||||||
#else
|
|
||||||
#define SDL_TIMER_WIN32 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enable various video drivers */
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
#define SDL_VIDEO_DRIVER_GAPI 1
|
|
||||||
#endif
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
#define SDL_VIDEO_DRIVER_DDRAW 1
|
|
||||||
#endif
|
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
|
||||||
#define SDL_VIDEO_DRIVER_WINDIB 1
|
|
||||||
|
|
||||||
/* Enable OpenGL support */
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
#define SDL_VIDEO_OPENGL 1
|
|
||||||
#define SDL_VIDEO_OPENGL_WGL 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enable assembly routines (Win64 doesn't have inline asm) */
|
|
||||||
#ifndef _WIN64
|
|
||||||
#define SDL_ASSEMBLY_ROUTINES 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _SDL_config_win32_h */
|
|
|
@ -1,22 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
/* CPU feature detection for SDL */
|
|
||||||
|
|
||||||
#ifndef _SDL_cpuinfo_h
|
|
||||||
#define _SDL_cpuinfo_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This function returns true if the CPU has the RDTSC instruction
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
|
|
||||||
|
|
||||||
/* This function returns true if the CPU has MMX features
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
|
|
||||||
|
|
||||||
/* This function returns true if the CPU has MMX Ext. features
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void);
|
|
||||||
|
|
||||||
/* This function returns true if the CPU has 3DNow features
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
|
|
||||||
|
|
||||||
/* This function returns true if the CPU has 3DNow! Ext. features
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);
|
|
||||||
|
|
||||||
/* This function returns true if the CPU has SSE features
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
|
|
||||||
|
|
||||||
/* This function returns true if the CPU has SSE2 features
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
|
|
||||||
|
|
||||||
/* This function returns true if the CPU has AltiVec features
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_cpuinfo_h */
|
|
|
@ -1,192 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Functions for reading and writing endian-specific values */
|
|
||||||
|
|
||||||
#ifndef _SDL_endian_h
|
|
||||||
#define _SDL_endian_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
|
|
||||||
/* The two types of endianness */
|
|
||||||
#define SDL_LIL_ENDIAN 1234
|
|
||||||
#define SDL_BIG_ENDIAN 4321
|
|
||||||
|
|
||||||
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
|
|
||||||
#if defined(__hppa__) || \
|
|
||||||
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
|
||||||
(defined(__MIPS__) && defined(__MISPEB__)) || \
|
|
||||||
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
|
|
||||||
defined(__sparc__)
|
|
||||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
|
||||||
#endif
|
|
||||||
#endif /* !SDL_BYTEORDER */
|
|
||||||
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Use inline functions for compilers that support them, and static
|
|
||||||
functions for those that do not. Because these functions become
|
|
||||||
static for compilers that do not support inline functions, this
|
|
||||||
header should only be included in files that actually use them.
|
|
||||||
*/
|
|
||||||
#if defined(__GNUC__) && defined(__i386__) && \
|
|
||||||
!(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
|
|
||||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
|
||||||
{
|
|
||||||
__asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
|
||||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
|
||||||
{
|
|
||||||
__asm__("xchgb %b0,%h0" : "=Q" (x) : "0" (x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
|
||||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
|
||||||
{
|
|
||||||
Uint16 result;
|
|
||||||
|
|
||||||
__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
|
|
||||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
|
||||||
{
|
|
||||||
__asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc");
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static __inline__ Uint16 SDL_Swap16(Uint16 x) {
|
|
||||||
return((x<<8)|(x>>8));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__i386__)
|
|
||||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
|
||||||
{
|
|
||||||
__asm__("bswap %0" : "=r" (x) : "0" (x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
|
||||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
|
||||||
{
|
|
||||||
__asm__("bswapl %0" : "=r" (x) : "0" (x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
|
||||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
|
||||||
{
|
|
||||||
Uint32 result;
|
|
||||||
|
|
||||||
__asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));
|
|
||||||
__asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (x));
|
|
||||||
__asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
|
|
||||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
|
||||||
{
|
|
||||||
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc");
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static __inline__ Uint32 SDL_Swap32(Uint32 x) {
|
|
||||||
return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SDL_HAS_64BIT_TYPE
|
|
||||||
#if defined(__GNUC__) && defined(__i386__)
|
|
||||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
|
||||||
{
|
|
||||||
union {
|
|
||||||
struct { Uint32 a,b; } s;
|
|
||||||
Uint64 u;
|
|
||||||
} v;
|
|
||||||
v.u = x;
|
|
||||||
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
|
|
||||||
: "=r" (v.s.a), "=r" (v.s.b)
|
|
||||||
: "0" (v.s.a), "1" (v.s.b));
|
|
||||||
return v.u;
|
|
||||||
}
|
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
|
||||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
|
||||||
{
|
|
||||||
__asm__("bswapq %0" : "=r" (x) : "0" (x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
|
||||||
{
|
|
||||||
Uint32 hi, lo;
|
|
||||||
|
|
||||||
/* Separate into high and low 32-bit values and swap them */
|
|
||||||
lo = (Uint32)(x&0xFFFFFFFF);
|
|
||||||
x >>= 32;
|
|
||||||
hi = (Uint32)(x&0xFFFFFFFF);
|
|
||||||
x = SDL_Swap32(lo);
|
|
||||||
x <<= 32;
|
|
||||||
x |= SDL_Swap32(hi);
|
|
||||||
return(x);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
/* This is mainly to keep compilers from complaining in SDL code.
|
|
||||||
If there is no real 64-bit datatype, then compilers will complain about
|
|
||||||
the fake 64-bit datatype that SDL provides when it compiles user code.
|
|
||||||
*/
|
|
||||||
#define SDL_Swap64(X) (X)
|
|
||||||
#endif /* SDL_HAS_64BIT_TYPE */
|
|
||||||
|
|
||||||
|
|
||||||
/* Byteswap item from the specified endianness to the native endianness */
|
|
||||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
|
||||||
#define SDL_SwapLE16(X) (X)
|
|
||||||
#define SDL_SwapLE32(X) (X)
|
|
||||||
#define SDL_SwapLE64(X) (X)
|
|
||||||
#define SDL_SwapBE16(X) SDL_Swap16(X)
|
|
||||||
#define SDL_SwapBE32(X) SDL_Swap32(X)
|
|
||||||
#define SDL_SwapBE64(X) SDL_Swap64(X)
|
|
||||||
#else
|
|
||||||
#define SDL_SwapLE16(X) SDL_Swap16(X)
|
|
||||||
#define SDL_SwapLE32(X) SDL_Swap32(X)
|
|
||||||
#define SDL_SwapLE64(X) SDL_Swap64(X)
|
|
||||||
#define SDL_SwapBE16(X) (X)
|
|
||||||
#define SDL_SwapBE32(X) (X)
|
|
||||||
#define SDL_SwapBE64(X) (X)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_endian_h */
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Simple error message routines for SDL */
|
|
||||||
|
|
||||||
#ifndef _SDL_error_h
|
|
||||||
#define _SDL_error_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Public functions */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_GetError(void);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
|
||||||
|
|
||||||
/* Private error message function - used internally */
|
|
||||||
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
|
|
||||||
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
|
|
||||||
typedef enum {
|
|
||||||
SDL_ENOMEM,
|
|
||||||
SDL_EFREAD,
|
|
||||||
SDL_EFWRITE,
|
|
||||||
SDL_EFSEEK,
|
|
||||||
SDL_UNSUPPORTED,
|
|
||||||
SDL_LASTERROR
|
|
||||||
} SDL_errorcode;
|
|
||||||
extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
|
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_error_h */
|
|
|
@ -1,337 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Include file for SDL event handling */
|
|
||||||
|
|
||||||
#ifndef _SDL_events_h
|
|
||||||
#define _SDL_events_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
#include "SDL_active.h"
|
|
||||||
#include "SDL_keyboard.h"
|
|
||||||
#include "SDL_mouse.h"
|
|
||||||
#include "SDL_joystick.h"
|
|
||||||
#include "SDL_quit.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* General keyboard/mouse state definitions */
|
|
||||||
#define SDL_RELEASED 0
|
|
||||||
#define SDL_PRESSED 1
|
|
||||||
|
|
||||||
/* Event enumerations */
|
|
||||||
typedef enum {
|
|
||||||
SDL_NOEVENT = 0, /* Unused (do not remove) */
|
|
||||||
SDL_ACTIVEEVENT, /* Application loses/gains visibility */
|
|
||||||
SDL_KEYDOWN, /* Keys pressed */
|
|
||||||
SDL_KEYUP, /* Keys released */
|
|
||||||
SDL_MOUSEMOTION, /* Mouse moved */
|
|
||||||
SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */
|
|
||||||
SDL_MOUSEBUTTONUP, /* Mouse button released */
|
|
||||||
SDL_JOYAXISMOTION, /* Joystick axis motion */
|
|
||||||
SDL_JOYBALLMOTION, /* Joystick trackball motion */
|
|
||||||
SDL_JOYHATMOTION, /* Joystick hat position change */
|
|
||||||
SDL_JOYBUTTONDOWN, /* Joystick button pressed */
|
|
||||||
SDL_JOYBUTTONUP, /* Joystick button released */
|
|
||||||
SDL_QUIT, /* User-requested quit */
|
|
||||||
SDL_SYSWMEVENT, /* System specific event */
|
|
||||||
SDL_EVENT_RESERVEDA, /* Reserved for future use.. */
|
|
||||||
SDL_EVENT_RESERVEDB, /* Reserved for future use.. */
|
|
||||||
SDL_VIDEORESIZE, /* User resized video mode */
|
|
||||||
SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */
|
|
||||||
SDL_EVENT_RESERVED2, /* Reserved for future use.. */
|
|
||||||
SDL_EVENT_RESERVED3, /* Reserved for future use.. */
|
|
||||||
SDL_EVENT_RESERVED4, /* Reserved for future use.. */
|
|
||||||
SDL_EVENT_RESERVED5, /* Reserved for future use.. */
|
|
||||||
SDL_EVENT_RESERVED6, /* Reserved for future use.. */
|
|
||||||
SDL_EVENT_RESERVED7, /* Reserved for future use.. */
|
|
||||||
/* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
|
|
||||||
SDL_USEREVENT = 24,
|
|
||||||
/* This last event is only for bounding internal arrays
|
|
||||||
It is the number of bits in the event mask datatype -- Uint32
|
|
||||||
*/
|
|
||||||
SDL_NUMEVENTS = 32
|
|
||||||
} SDL_EventType;
|
|
||||||
|
|
||||||
/* Predefined event masks */
|
|
||||||
#define SDL_EVENTMASK(X) (1<<(X))
|
|
||||||
typedef enum {
|
|
||||||
SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
|
|
||||||
SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
|
|
||||||
SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
|
|
||||||
SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)|
|
|
||||||
SDL_EVENTMASK(SDL_KEYUP),
|
|
||||||
SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
|
|
||||||
SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
|
|
||||||
SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
|
||||||
SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)|
|
|
||||||
SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
|
|
||||||
SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
|
||||||
SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
|
|
||||||
SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
|
|
||||||
SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
|
|
||||||
SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
|
|
||||||
SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
|
||||||
SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)|
|
|
||||||
SDL_EVENTMASK(SDL_JOYBALLMOTION)|
|
|
||||||
SDL_EVENTMASK(SDL_JOYHATMOTION)|
|
|
||||||
SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
|
|
||||||
SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
|
||||||
SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
|
|
||||||
SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
|
|
||||||
SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
|
|
||||||
SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
|
|
||||||
} SDL_EventMask ;
|
|
||||||
#define SDL_ALLEVENTS 0xFFFFFFFF
|
|
||||||
|
|
||||||
/* Application visibility event structure */
|
|
||||||
typedef struct SDL_ActiveEvent {
|
|
||||||
Uint8 type; /* SDL_ACTIVEEVENT */
|
|
||||||
Uint8 gain; /* Whether given states were gained or lost (1/0) */
|
|
||||||
Uint8 state; /* A mask of the focus states */
|
|
||||||
} SDL_ActiveEvent;
|
|
||||||
|
|
||||||
/* Keyboard event structure */
|
|
||||||
typedef struct SDL_KeyboardEvent {
|
|
||||||
Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */
|
|
||||||
Uint8 which; /* The keyboard device index */
|
|
||||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
|
||||||
SDL_keysym keysym;
|
|
||||||
} SDL_KeyboardEvent;
|
|
||||||
|
|
||||||
/* Mouse motion event structure */
|
|
||||||
typedef struct SDL_MouseMotionEvent {
|
|
||||||
Uint8 type; /* SDL_MOUSEMOTION */
|
|
||||||
Uint8 which; /* The mouse device index */
|
|
||||||
Uint8 state; /* The current button state */
|
|
||||||
Uint16 x, y; /* The X/Y coordinates of the mouse */
|
|
||||||
Sint16 xrel; /* The relative motion in the X direction */
|
|
||||||
Sint16 yrel; /* The relative motion in the Y direction */
|
|
||||||
} SDL_MouseMotionEvent;
|
|
||||||
|
|
||||||
/* Mouse button event structure */
|
|
||||||
typedef struct SDL_MouseButtonEvent {
|
|
||||||
Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
|
|
||||||
Uint8 which; /* The mouse device index */
|
|
||||||
Uint8 button; /* The mouse button index */
|
|
||||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
|
||||||
Uint16 x, y; /* The X/Y coordinates of the mouse at press time */
|
|
||||||
} SDL_MouseButtonEvent;
|
|
||||||
|
|
||||||
/* Joystick axis motion event structure */
|
|
||||||
typedef struct SDL_JoyAxisEvent {
|
|
||||||
Uint8 type; /* SDL_JOYAXISMOTION */
|
|
||||||
Uint8 which; /* The joystick device index */
|
|
||||||
Uint8 axis; /* The joystick axis index */
|
|
||||||
Sint16 value; /* The axis value (range: -32768 to 32767) */
|
|
||||||
} SDL_JoyAxisEvent;
|
|
||||||
|
|
||||||
/* Joystick trackball motion event structure */
|
|
||||||
typedef struct SDL_JoyBallEvent {
|
|
||||||
Uint8 type; /* SDL_JOYBALLMOTION */
|
|
||||||
Uint8 which; /* The joystick device index */
|
|
||||||
Uint8 ball; /* The joystick trackball index */
|
|
||||||
Sint16 xrel; /* The relative motion in the X direction */
|
|
||||||
Sint16 yrel; /* The relative motion in the Y direction */
|
|
||||||
} SDL_JoyBallEvent;
|
|
||||||
|
|
||||||
/* Joystick hat position change event structure */
|
|
||||||
typedef struct SDL_JoyHatEvent {
|
|
||||||
Uint8 type; /* SDL_JOYHATMOTION */
|
|
||||||
Uint8 which; /* The joystick device index */
|
|
||||||
Uint8 hat; /* The joystick hat index */
|
|
||||||
Uint8 value; /* The hat position value:
|
|
||||||
SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
|
|
||||||
SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
|
|
||||||
SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
|
|
||||||
Note that zero means the POV is centered.
|
|
||||||
*/
|
|
||||||
} SDL_JoyHatEvent;
|
|
||||||
|
|
||||||
/* Joystick button event structure */
|
|
||||||
typedef struct SDL_JoyButtonEvent {
|
|
||||||
Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
|
|
||||||
Uint8 which; /* The joystick device index */
|
|
||||||
Uint8 button; /* The joystick button index */
|
|
||||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
|
||||||
} SDL_JoyButtonEvent;
|
|
||||||
|
|
||||||
/* The "window resized" event
|
|
||||||
When you get this event, you are responsible for setting a new video
|
|
||||||
mode with the new width and height.
|
|
||||||
*/
|
|
||||||
typedef struct SDL_ResizeEvent {
|
|
||||||
Uint8 type; /* SDL_VIDEORESIZE */
|
|
||||||
int w; /* New width */
|
|
||||||
int h; /* New height */
|
|
||||||
} SDL_ResizeEvent;
|
|
||||||
|
|
||||||
/* The "screen redraw" event */
|
|
||||||
typedef struct SDL_ExposeEvent {
|
|
||||||
Uint8 type; /* SDL_VIDEOEXPOSE */
|
|
||||||
} SDL_ExposeEvent;
|
|
||||||
|
|
||||||
/* The "quit requested" event */
|
|
||||||
typedef struct SDL_QuitEvent {
|
|
||||||
Uint8 type; /* SDL_QUIT */
|
|
||||||
} SDL_QuitEvent;
|
|
||||||
|
|
||||||
/* A user-defined event type */
|
|
||||||
typedef struct SDL_UserEvent {
|
|
||||||
Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */
|
|
||||||
int code; /* User defined event code */
|
|
||||||
void *data1; /* User defined data pointer */
|
|
||||||
void *data2; /* User defined data pointer */
|
|
||||||
} SDL_UserEvent;
|
|
||||||
|
|
||||||
/* If you want to use this event, you should include SDL_syswm.h */
|
|
||||||
struct SDL_SysWMmsg;
|
|
||||||
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
|
|
||||||
typedef struct SDL_SysWMEvent {
|
|
||||||
Uint8 type;
|
|
||||||
SDL_SysWMmsg *msg;
|
|
||||||
} SDL_SysWMEvent;
|
|
||||||
|
|
||||||
/* General event structure */
|
|
||||||
typedef union SDL_Event {
|
|
||||||
Uint8 type;
|
|
||||||
SDL_ActiveEvent active;
|
|
||||||
SDL_KeyboardEvent key;
|
|
||||||
SDL_MouseMotionEvent motion;
|
|
||||||
SDL_MouseButtonEvent button;
|
|
||||||
SDL_JoyAxisEvent jaxis;
|
|
||||||
SDL_JoyBallEvent jball;
|
|
||||||
SDL_JoyHatEvent jhat;
|
|
||||||
SDL_JoyButtonEvent jbutton;
|
|
||||||
SDL_ResizeEvent resize;
|
|
||||||
SDL_ExposeEvent expose;
|
|
||||||
SDL_QuitEvent quit;
|
|
||||||
SDL_UserEvent user;
|
|
||||||
SDL_SysWMEvent syswm;
|
|
||||||
} SDL_Event;
|
|
||||||
|
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
|
|
||||||
/* Pumps the event loop, gathering events from the input devices.
|
|
||||||
This function updates the event queue and internal input device state.
|
|
||||||
This should only be run in the thread that sets the video mode.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
|
|
||||||
|
|
||||||
/* Checks the event queue for messages and optionally returns them.
|
|
||||||
If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
|
|
||||||
the back of the event queue.
|
|
||||||
If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
|
|
||||||
of the event queue, matching 'mask', will be returned and will not
|
|
||||||
be removed from the queue.
|
|
||||||
If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
|
|
||||||
of the event queue, matching 'mask', will be returned and will be
|
|
||||||
removed from the queue.
|
|
||||||
This function returns the number of events actually stored, or -1
|
|
||||||
if there was an error. This function is thread-safe.
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
SDL_ADDEVENT,
|
|
||||||
SDL_PEEKEVENT,
|
|
||||||
SDL_GETEVENT
|
|
||||||
} SDL_eventaction;
|
|
||||||
/* */
|
|
||||||
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
|
|
||||||
SDL_eventaction action, Uint32 mask);
|
|
||||||
|
|
||||||
/* Polls for currently pending events, and returns 1 if there are any pending
|
|
||||||
events, or 0 if there are none available. If 'event' is not NULL, the next
|
|
||||||
event is removed from the queue and stored in that area.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
|
|
||||||
|
|
||||||
/* Waits indefinitely for the next available event, returning 1, or 0 if there
|
|
||||||
was an error while waiting for events. If 'event' is not NULL, the next
|
|
||||||
event is removed from the queue and stored in that area.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
|
|
||||||
|
|
||||||
/* Add an event to the event queue.
|
|
||||||
This function returns 0 on success, or -1 if the event queue was full
|
|
||||||
or there was some other error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
|
|
||||||
|
|
||||||
/*
|
|
||||||
This function sets up a filter to process all events before they
|
|
||||||
change internal state and are posted to the internal event queue.
|
|
||||||
|
|
||||||
The filter is protypted as:
|
|
||||||
*/
|
|
||||||
typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event);
|
|
||||||
/*
|
|
||||||
If the filter returns 1, then the event will be added to the internal queue.
|
|
||||||
If it returns 0, then the event will be dropped from the queue, but the
|
|
||||||
internal state will still be updated. This allows selective filtering of
|
|
||||||
dynamically arriving events.
|
|
||||||
|
|
||||||
WARNING: Be very careful of what you do in the event filter function, as
|
|
||||||
it may run in a different thread!
|
|
||||||
|
|
||||||
There is one caveat when dealing with the SDL_QUITEVENT event type. The
|
|
||||||
event filter is only called when the window manager desires to close the
|
|
||||||
application window. If the event filter returns 1, then the window will
|
|
||||||
be closed, otherwise the window will remain open if possible.
|
|
||||||
If the quit event is generated by an interrupt signal, it will bypass the
|
|
||||||
internal queue and be delivered to the application at the next event poll.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return the current event filter - can be used to "chain" filters.
|
|
||||||
If there is no event filter set, this function returns NULL.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
This function allows you to set the state of processing certain events.
|
|
||||||
If 'state' is set to SDL_IGNORE, that event will be automatically dropped
|
|
||||||
from the event queue and will not event be filtered.
|
|
||||||
If 'state' is set to SDL_ENABLE, that event will be processed normally.
|
|
||||||
If 'state' is set to SDL_QUERY, SDL_EventState() will return the
|
|
||||||
current processing state of the specified event.
|
|
||||||
*/
|
|
||||||
#define SDL_QUERY -1
|
|
||||||
#define SDL_IGNORE 0
|
|
||||||
#define SDL_DISABLE 0
|
|
||||||
#define SDL_ENABLE 1
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
|
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_events_h */
|
|
|
@ -1,24 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* DEPRECATED */
|
|
||||||
#include "SDL_stdinc.h"
|
|
|
@ -1,167 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Include file for SDL joystick event handling */
|
|
||||||
|
|
||||||
#ifndef _SDL_joystick_h
|
|
||||||
#define _SDL_joystick_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* In order to use these functions, SDL_Init() must have been called
|
|
||||||
with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
|
|
||||||
for joysticks, and load appropriate drivers.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* The joystick structure used to identify an SDL joystick */
|
|
||||||
struct _SDL_Joystick;
|
|
||||||
typedef struct _SDL_Joystick SDL_Joystick;
|
|
||||||
|
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
/*
|
|
||||||
* Count the number of joysticks attached to the system
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the implementation dependent name of a joystick.
|
|
||||||
* This can be called before any joysticks are opened.
|
|
||||||
* If no name can be found, this function returns NULL.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Open a joystick for use - the index passed as an argument refers to
|
|
||||||
* the N'th joystick on the system. This index is the value which will
|
|
||||||
* identify this joystick in future joystick events.
|
|
||||||
*
|
|
||||||
* This function returns a joystick identifier, or NULL if an error occurred.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns 1 if the joystick has been opened, or 0 if it has not.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the device index of an opened joystick.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the number of general axis controls on a joystick
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the number of trackballs on a joystick
|
|
||||||
* Joystick trackballs have only relative motion events associated
|
|
||||||
* with them and their state cannot be polled.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the number of POV hats on a joystick
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the number of buttons on a joystick
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Update the current state of the open joysticks.
|
|
||||||
* This is called automatically by the event loop if any joystick
|
|
||||||
* events are enabled.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable/disable joystick event polling.
|
|
||||||
* If joystick events are disabled, you must call SDL_JoystickUpdate()
|
|
||||||
* yourself and check the state of the joystick when you want joystick
|
|
||||||
* information.
|
|
||||||
* The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the current state of an axis control on a joystick
|
|
||||||
* The state is a value ranging from -32768 to 32767.
|
|
||||||
* The axis indices start at index 0.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the current state of a POV hat on a joystick
|
|
||||||
* The return value is one of the following positions:
|
|
||||||
*/
|
|
||||||
#define SDL_HAT_CENTERED 0x00
|
|
||||||
#define SDL_HAT_UP 0x01
|
|
||||||
#define SDL_HAT_RIGHT 0x02
|
|
||||||
#define SDL_HAT_DOWN 0x04
|
|
||||||
#define SDL_HAT_LEFT 0x08
|
|
||||||
#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
|
|
||||||
#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
|
|
||||||
#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
|
|
||||||
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
|
|
||||||
/*
|
|
||||||
* The hat indices start at index 0.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the ball axis change since the last poll
|
|
||||||
* This returns 0, or -1 if you passed it invalid parameters.
|
|
||||||
* The ball indices start at index 0.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the current state of a button on a joystick
|
|
||||||
* The button indices start at index 0.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Close a joystick previously opened with SDL_JoystickOpen()
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
|
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_joystick_h */
|
|
|
@ -1,121 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Include file for SDL keyboard event handling */
|
|
||||||
|
|
||||||
#ifndef _SDL_keyboard_h
|
|
||||||
#define _SDL_keyboard_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
#include "SDL_keysym.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Keysym structure
|
|
||||||
- The scancode is hardware dependent, and should not be used by general
|
|
||||||
applications. If no hardware scancode is available, it will be 0.
|
|
||||||
|
|
||||||
- The 'unicode' translated character is only available when character
|
|
||||||
translation is enabled by the SDL_EnableUNICODE() API. If non-zero,
|
|
||||||
this is a UNICODE character corresponding to the keypress. If the
|
|
||||||
high 9 bits of the character are 0, then this maps to the equivalent
|
|
||||||
ASCII character:
|
|
||||||
char ch;
|
|
||||||
if ( (keysym.unicode & 0xFF80) == 0 ) {
|
|
||||||
ch = keysym.unicode & 0x7F;
|
|
||||||
} else {
|
|
||||||
An international character..
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
typedef struct SDL_keysym {
|
|
||||||
Uint8 scancode; /* hardware specific scancode */
|
|
||||||
SDLKey sym; /* SDL virtual keysym */
|
|
||||||
SDLMod mod; /* current key modifiers */
|
|
||||||
Uint16 unicode; /* translated character */
|
|
||||||
} SDL_keysym;
|
|
||||||
|
|
||||||
/* This is the mask which refers to all hotkey bindings */
|
|
||||||
#define SDL_ALL_HOTKEYS 0xFFFFFFFF
|
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
/*
|
|
||||||
* Enable/Disable UNICODE translation of keyboard input.
|
|
||||||
* This translation has some overhead, so translation defaults off.
|
|
||||||
* If 'enable' is 1, translation is enabled.
|
|
||||||
* If 'enable' is 0, translation is disabled.
|
|
||||||
* If 'enable' is -1, the translation state is not changed.
|
|
||||||
* It returns the previous state of keyboard translation.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable/Disable keyboard repeat. Keyboard repeat defaults to off.
|
|
||||||
* 'delay' is the initial delay in ms between the time when a key is
|
|
||||||
* pressed, and keyboard repeat begins.
|
|
||||||
* 'interval' is the time in ms between keyboard repeat events.
|
|
||||||
*/
|
|
||||||
#define SDL_DEFAULT_REPEAT_DELAY 500
|
|
||||||
#define SDL_DEFAULT_REPEAT_INTERVAL 30
|
|
||||||
/*
|
|
||||||
* If 'delay' is set to 0, keyboard repeat is disabled.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get a snapshot of the current state of the keyboard.
|
|
||||||
* Returns an array of keystates, indexed by the SDLK_* syms.
|
|
||||||
* Used:
|
|
||||||
* Uint8 *keystate = SDL_GetKeyState(NULL);
|
|
||||||
* if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the current key modifier state
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the current key modifier state
|
|
||||||
* This does not change the keyboard state, only the key modifier flags.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the name of an SDL virtual keysym
|
|
||||||
*/
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key);
|
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_keyboard_h */
|
|
|
@ -1,311 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_keysym_h
|
|
||||||
#define _SDL_keysym_h
|
|
||||||
|
|
||||||
/* What we really want is a mapping of every raw key on the keyboard.
|
|
||||||
To support international keyboards, we use the range 0xA1 - 0xFF
|
|
||||||
as international virtual keycodes. We'll follow in the footsteps of X11...
|
|
||||||
The names of the keys
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
/* The keyboard syms have been cleverly chosen to map to ASCII */
|
|
||||||
SDLK_UNKNOWN = 0,
|
|
||||||
SDLK_FIRST = 0,
|
|
||||||
SDLK_BACKSPACE = 8,
|
|
||||||
SDLK_TAB = 9,
|
|
||||||
SDLK_CLEAR = 12,
|
|
||||||
SDLK_RETURN = 13,
|
|
||||||
SDLK_PAUSE = 19,
|
|
||||||
SDLK_ESCAPE = 27,
|
|
||||||
SDLK_SPACE = 32,
|
|
||||||
SDLK_EXCLAIM = 33,
|
|
||||||
SDLK_QUOTEDBL = 34,
|
|
||||||
SDLK_HASH = 35,
|
|
||||||
SDLK_DOLLAR = 36,
|
|
||||||
SDLK_AMPERSAND = 38,
|
|
||||||
SDLK_QUOTE = 39,
|
|
||||||
SDLK_LEFTPAREN = 40,
|
|
||||||
SDLK_RIGHTPAREN = 41,
|
|
||||||
SDLK_ASTERISK = 42,
|
|
||||||
SDLK_PLUS = 43,
|
|
||||||
SDLK_COMMA = 44,
|
|
||||||
SDLK_MINUS = 45,
|
|
||||||
SDLK_PERIOD = 46,
|
|
||||||
SDLK_SLASH = 47,
|
|
||||||
SDLK_0 = 48,
|
|
||||||
SDLK_1 = 49,
|
|
||||||
SDLK_2 = 50,
|
|
||||||
SDLK_3 = 51,
|
|
||||||
SDLK_4 = 52,
|
|
||||||
SDLK_5 = 53,
|
|
||||||
SDLK_6 = 54,
|
|
||||||
SDLK_7 = 55,
|
|
||||||
SDLK_8 = 56,
|
|
||||||
SDLK_9 = 57,
|
|
||||||
SDLK_COLON = 58,
|
|
||||||
SDLK_SEMICOLON = 59,
|
|
||||||
SDLK_LESS = 60,
|
|
||||||
SDLK_EQUALS = 61,
|
|
||||||
SDLK_GREATER = 62,
|
|
||||||
SDLK_QUESTION = 63,
|
|
||||||
SDLK_AT = 64,
|
|
||||||
/*
|
|
||||||
Skip uppercase letters
|
|
||||||
*/
|
|
||||||
SDLK_LEFTBRACKET = 91,
|
|
||||||
SDLK_BACKSLASH = 92,
|
|
||||||
SDLK_RIGHTBRACKET = 93,
|
|
||||||
SDLK_CARET = 94,
|
|
||||||
SDLK_UNDERSCORE = 95,
|
|
||||||
SDLK_BACKQUOTE = 96,
|
|
||||||
SDLK_a = 97,
|
|
||||||
SDLK_b = 98,
|
|
||||||
SDLK_c = 99,
|
|
||||||
SDLK_d = 100,
|
|
||||||
SDLK_e = 101,
|
|
||||||
SDLK_f = 102,
|
|
||||||
SDLK_g = 103,
|
|
||||||
SDLK_h = 104,
|
|
||||||
SDLK_i = 105,
|
|
||||||
SDLK_j = 106,
|
|
||||||
SDLK_k = 107,
|
|
||||||
SDLK_l = 108,
|
|
||||||
SDLK_m = 109,
|
|
||||||
SDLK_n = 110,
|
|
||||||
SDLK_o = 111,
|
|
||||||
SDLK_p = 112,
|
|
||||||
SDLK_q = 113,
|
|
||||||
SDLK_r = 114,
|
|
||||||
SDLK_s = 115,
|
|
||||||
SDLK_t = 116,
|
|
||||||
SDLK_u = 117,
|
|
||||||
SDLK_v = 118,
|
|
||||||
SDLK_w = 119,
|
|
||||||
SDLK_x = 120,
|
|
||||||
SDLK_y = 121,
|
|
||||||
SDLK_z = 122,
|
|
||||||
SDLK_DELETE = 127,
|
|
||||||
/* End of ASCII mapped keysyms */
|
|
||||||
|
|
||||||
/* International keyboard syms */
|
|
||||||
SDLK_WORLD_0 = 160, /* 0xA0 */
|
|
||||||
SDLK_WORLD_1 = 161,
|
|
||||||
SDLK_WORLD_2 = 162,
|
|
||||||
SDLK_WORLD_3 = 163,
|
|
||||||
SDLK_WORLD_4 = 164,
|
|
||||||
SDLK_WORLD_5 = 165,
|
|
||||||
SDLK_WORLD_6 = 166,
|
|
||||||
SDLK_WORLD_7 = 167,
|
|
||||||
SDLK_WORLD_8 = 168,
|
|
||||||
SDLK_WORLD_9 = 169,
|
|
||||||
SDLK_WORLD_10 = 170,
|
|
||||||
SDLK_WORLD_11 = 171,
|
|
||||||
SDLK_WORLD_12 = 172,
|
|
||||||
SDLK_WORLD_13 = 173,
|
|
||||||
SDLK_WORLD_14 = 174,
|
|
||||||
SDLK_WORLD_15 = 175,
|
|
||||||
SDLK_WORLD_16 = 176,
|
|
||||||
SDLK_WORLD_17 = 177,
|
|
||||||
SDLK_WORLD_18 = 178,
|
|
||||||
SDLK_WORLD_19 = 179,
|
|
||||||
SDLK_WORLD_20 = 180,
|
|
||||||
SDLK_WORLD_21 = 181,
|
|
||||||
SDLK_WORLD_22 = 182,
|
|
||||||
SDLK_WORLD_23 = 183,
|
|
||||||
SDLK_WORLD_24 = 184,
|
|
||||||
SDLK_WORLD_25 = 185,
|
|
||||||
SDLK_WORLD_26 = 186,
|
|
||||||
SDLK_WORLD_27 = 187,
|
|
||||||
SDLK_WORLD_28 = 188,
|
|
||||||
SDLK_WORLD_29 = 189,
|
|
||||||
SDLK_WORLD_30 = 190,
|
|
||||||
SDLK_WORLD_31 = 191,
|
|
||||||
SDLK_WORLD_32 = 192,
|
|
||||||
SDLK_WORLD_33 = 193,
|
|
||||||
SDLK_WORLD_34 = 194,
|
|
||||||
SDLK_WORLD_35 = 195,
|
|
||||||
SDLK_WORLD_36 = 196,
|
|
||||||
SDLK_WORLD_37 = 197,
|
|
||||||
SDLK_WORLD_38 = 198,
|
|
||||||
SDLK_WORLD_39 = 199,
|
|
||||||
SDLK_WORLD_40 = 200,
|
|
||||||
SDLK_WORLD_41 = 201,
|
|
||||||
SDLK_WORLD_42 = 202,
|
|
||||||
SDLK_WORLD_43 = 203,
|
|
||||||
SDLK_WORLD_44 = 204,
|
|
||||||
SDLK_WORLD_45 = 205,
|
|
||||||
SDLK_WORLD_46 = 206,
|
|
||||||
SDLK_WORLD_47 = 207,
|
|
||||||
SDLK_WORLD_48 = 208,
|
|
||||||
SDLK_WORLD_49 = 209,
|
|
||||||
SDLK_WORLD_50 = 210,
|
|
||||||
SDLK_WORLD_51 = 211,
|
|
||||||
SDLK_WORLD_52 = 212,
|
|
||||||
SDLK_WORLD_53 = 213,
|
|
||||||
SDLK_WORLD_54 = 214,
|
|
||||||
SDLK_WORLD_55 = 215,
|
|
||||||
SDLK_WORLD_56 = 216,
|
|
||||||
SDLK_WORLD_57 = 217,
|
|
||||||
SDLK_WORLD_58 = 218,
|
|
||||||
SDLK_WORLD_59 = 219,
|
|
||||||
SDLK_WORLD_60 = 220,
|
|
||||||
SDLK_WORLD_61 = 221,
|
|
||||||
SDLK_WORLD_62 = 222,
|
|
||||||
SDLK_WORLD_63 = 223,
|
|
||||||
SDLK_WORLD_64 = 224,
|
|
||||||
SDLK_WORLD_65 = 225,
|
|
||||||
SDLK_WORLD_66 = 226,
|
|
||||||
SDLK_WORLD_67 = 227,
|
|
||||||
SDLK_WORLD_68 = 228,
|
|
||||||
SDLK_WORLD_69 = 229,
|
|
||||||
SDLK_WORLD_70 = 230,
|
|
||||||
SDLK_WORLD_71 = 231,
|
|
||||||
SDLK_WORLD_72 = 232,
|
|
||||||
SDLK_WORLD_73 = 233,
|
|
||||||
SDLK_WORLD_74 = 234,
|
|
||||||
SDLK_WORLD_75 = 235,
|
|
||||||
SDLK_WORLD_76 = 236,
|
|
||||||
SDLK_WORLD_77 = 237,
|
|
||||||
SDLK_WORLD_78 = 238,
|
|
||||||
SDLK_WORLD_79 = 239,
|
|
||||||
SDLK_WORLD_80 = 240,
|
|
||||||
SDLK_WORLD_81 = 241,
|
|
||||||
SDLK_WORLD_82 = 242,
|
|
||||||
SDLK_WORLD_83 = 243,
|
|
||||||
SDLK_WORLD_84 = 244,
|
|
||||||
SDLK_WORLD_85 = 245,
|
|
||||||
SDLK_WORLD_86 = 246,
|
|
||||||
SDLK_WORLD_87 = 247,
|
|
||||||
SDLK_WORLD_88 = 248,
|
|
||||||
SDLK_WORLD_89 = 249,
|
|
||||||
SDLK_WORLD_90 = 250,
|
|
||||||
SDLK_WORLD_91 = 251,
|
|
||||||
SDLK_WORLD_92 = 252,
|
|
||||||
SDLK_WORLD_93 = 253,
|
|
||||||
SDLK_WORLD_94 = 254,
|
|
||||||
SDLK_WORLD_95 = 255, /* 0xFF */
|
|
||||||
|
|
||||||
/* Numeric keypad */
|
|
||||||
SDLK_KP0 = 256,
|
|
||||||
SDLK_KP1 = 257,
|
|
||||||
SDLK_KP2 = 258,
|
|
||||||
SDLK_KP3 = 259,
|
|
||||||
SDLK_KP4 = 260,
|
|
||||||
SDLK_KP5 = 261,
|
|
||||||
SDLK_KP6 = 262,
|
|
||||||
SDLK_KP7 = 263,
|
|
||||||
SDLK_KP8 = 264,
|
|
||||||
SDLK_KP9 = 265,
|
|
||||||
SDLK_KP_PERIOD = 266,
|
|
||||||
SDLK_KP_DIVIDE = 267,
|
|
||||||
SDLK_KP_MULTIPLY = 268,
|
|
||||||
SDLK_KP_MINUS = 269,
|
|
||||||
SDLK_KP_PLUS = 270,
|
|
||||||
SDLK_KP_ENTER = 271,
|
|
||||||
SDLK_KP_EQUALS = 272,
|
|
||||||
|
|
||||||
/* Arrows + Home/End pad */
|
|
||||||
SDLK_UP = 273,
|
|
||||||
SDLK_DOWN = 274,
|
|
||||||
SDLK_RIGHT = 275,
|
|
||||||
SDLK_LEFT = 276,
|
|
||||||
SDLK_INSERT = 277,
|
|
||||||
SDLK_HOME = 278,
|
|
||||||
SDLK_END = 279,
|
|
||||||
SDLK_PAGEUP = 280,
|
|
||||||
SDLK_PAGEDOWN = 281,
|
|
||||||
|
|
||||||
/* Function keys */
|
|
||||||
SDLK_F1 = 282,
|
|
||||||
SDLK_F2 = 283,
|
|
||||||
SDLK_F3 = 284,
|
|
||||||
SDLK_F4 = 285,
|
|
||||||
SDLK_F5 = 286,
|
|
||||||
SDLK_F6 = 287,
|
|
||||||
SDLK_F7 = 288,
|
|
||||||
SDLK_F8 = 289,
|
|
||||||
SDLK_F9 = 290,
|
|
||||||
SDLK_F10 = 291,
|
|
||||||
SDLK_F11 = 292,
|
|
||||||
SDLK_F12 = 293,
|
|
||||||
SDLK_F13 = 294,
|
|
||||||
SDLK_F14 = 295,
|
|
||||||
SDLK_F15 = 296,
|
|
||||||
|
|
||||||
/* Key state modifier keys */
|
|
||||||
SDLK_NUMLOCK = 300,
|
|
||||||
SDLK_CAPSLOCK = 301,
|
|
||||||
SDLK_SCROLLOCK = 302,
|
|
||||||
SDLK_RSHIFT = 303,
|
|
||||||
SDLK_LSHIFT = 304,
|
|
||||||
SDLK_RCTRL = 305,
|
|
||||||
SDLK_LCTRL = 306,
|
|
||||||
SDLK_RALT = 307,
|
|
||||||
SDLK_LALT = 308,
|
|
||||||
SDLK_RMETA = 309,
|
|
||||||
SDLK_LMETA = 310,
|
|
||||||
SDLK_LSUPER = 311, /* Left "Windows" key */
|
|
||||||
SDLK_RSUPER = 312, /* Right "Windows" key */
|
|
||||||
SDLK_MODE = 313, /* "Alt Gr" key */
|
|
||||||
SDLK_COMPOSE = 314, /* Multi-key compose key */
|
|
||||||
|
|
||||||
/* Miscellaneous function keys */
|
|
||||||
SDLK_HELP = 315,
|
|
||||||
SDLK_PRINT = 316,
|
|
||||||
SDLK_SYSREQ = 317,
|
|
||||||
SDLK_BREAK = 318,
|
|
||||||
SDLK_MENU = 319,
|
|
||||||
SDLK_POWER = 320, /* Power Macintosh power key */
|
|
||||||
SDLK_EURO = 321, /* Some european keyboards */
|
|
||||||
SDLK_UNDO = 322, /* Atari keyboard has Undo */
|
|
||||||
|
|
||||||
/* Add any other keys here */
|
|
||||||
|
|
||||||
SDLK_LAST
|
|
||||||
} SDLKey;
|
|
||||||
|
|
||||||
/* Enumeration of valid key mods (possibly OR'd together) */
|
|
||||||
typedef enum {
|
|
||||||
KMOD_NONE = 0x0000,
|
|
||||||
KMOD_LSHIFT= 0x0001,
|
|
||||||
KMOD_RSHIFT= 0x0002,
|
|
||||||
KMOD_LCTRL = 0x0040,
|
|
||||||
KMOD_RCTRL = 0x0080,
|
|
||||||
KMOD_LALT = 0x0100,
|
|
||||||
KMOD_RALT = 0x0200,
|
|
||||||
KMOD_LMETA = 0x0400,
|
|
||||||
KMOD_RMETA = 0x0800,
|
|
||||||
KMOD_NUM = 0x1000,
|
|
||||||
KMOD_CAPS = 0x2000,
|
|
||||||
KMOD_MODE = 0x4000,
|
|
||||||
KMOD_RESERVED = 0x8000
|
|
||||||
} SDLMod;
|
|
||||||
|
|
||||||
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
|
|
||||||
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
|
|
||||||
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
|
|
||||||
#define KMOD_META (KMOD_LMETA|KMOD_RMETA)
|
|
||||||
|
|
||||||
#endif /* _SDL_keysym_h */
|
|
|
@ -1,74 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
/* System dependent library loading routines */
|
|
||||||
|
|
||||||
/* Some things to keep in mind:
|
|
||||||
- These functions only work on C function names. Other languages may
|
|
||||||
have name mangling and intrinsic language support that varies from
|
|
||||||
compiler to compiler.
|
|
||||||
- Make sure you declare your function pointers with the same calling
|
|
||||||
convention as the actual library function. Your code will crash
|
|
||||||
mysteriously if you do not do this.
|
|
||||||
- Avoid namespace collisions. If you load a symbol from the library,
|
|
||||||
it is not defined whether or not it goes into the global symbol
|
|
||||||
namespace for the application. If it does and it conflicts with
|
|
||||||
symbols in your code or other shared libraries, you will not get
|
|
||||||
the results you expect. :)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _SDL_loadso_h
|
|
||||||
#define _SDL_loadso_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This function dynamically loads a shared object and returns a pointer
|
|
||||||
* to the object handle (or NULL if there was an error).
|
|
||||||
* The 'sofile' parameter is a system dependent name of the object file.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile);
|
|
||||||
|
|
||||||
/* Given an object handle, this function looks up the address of the
|
|
||||||
* named function in the shared object and returns it. This address
|
|
||||||
* is no longer valid after calling SDL_UnloadObject().
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name);
|
|
||||||
|
|
||||||
/* Unload a shared object from memory */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_loadso_h */
|
|
|
@ -1,98 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_main_h
|
|
||||||
#define _SDL_main_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
|
|
||||||
/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */
|
|
||||||
|
|
||||||
#if defined(__WIN32__) || \
|
|
||||||
(defined(__MWERKS__) && !defined(__BEOS__)) || \
|
|
||||||
defined(__MACOS__) || defined(__MACOSX__) || \
|
|
||||||
defined(__SYMBIAN32__) || defined(QWS)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define C_LINKAGE "C"
|
|
||||||
#else
|
|
||||||
#define C_LINKAGE
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
/* The application's main() function must be called with C linkage,
|
|
||||||
and should be declared like this:
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
#endif
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#define main SDL_main
|
|
||||||
|
|
||||||
/* The prototype for the application's main() function */
|
|
||||||
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
|
|
||||||
|
|
||||||
|
|
||||||
/* From the SDL library code -- needed for registering the app on Win32 */
|
|
||||||
#ifdef __WIN32__
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This should be called from your WinMain() function, if any */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst);
|
|
||||||
/* This can also be called, but is no longer necessary */
|
|
||||||
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
|
|
||||||
/* This can also be called, but is no longer necessary (SDL_Quit calls it) */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* From the SDL library code -- needed for registering QuickDraw on MacOS */
|
|
||||||
#if defined(__MACOS__)
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Forward declaration so we don't need to include QuickDraw.h */
|
|
||||||
struct QDGlobals;
|
|
||||||
|
|
||||||
/* This should be called from your main() function, if any */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* Need to redefine main()? */
|
|
||||||
|
|
||||||
#endif /* _SDL_main_h */
|
|
|
@ -1,136 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Include file for SDL mouse event handling */
|
|
||||||
|
|
||||||
#ifndef _SDL_mouse_h
|
|
||||||
#define _SDL_mouse_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
#include "SDL_video.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct WMcursor WMcursor; /* Implementation dependent */
|
|
||||||
typedef struct SDL_Cursor {
|
|
||||||
SDL_Rect area; /* The area of the mouse cursor */
|
|
||||||
Sint16 hot_x, hot_y; /* The "tip" of the cursor */
|
|
||||||
Uint8 *data; /* B/W cursor data */
|
|
||||||
Uint8 *mask; /* B/W cursor mask */
|
|
||||||
Uint8 *save[2]; /* Place to save cursor area */
|
|
||||||
WMcursor *wm_cursor; /* Window-manager cursor */
|
|
||||||
} SDL_Cursor;
|
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
/*
|
|
||||||
* Retrieve the current state of the mouse.
|
|
||||||
* The current button state is returned as a button bitmask, which can
|
|
||||||
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
|
||||||
* current mouse cursor position. You can pass NULL for either x or y.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Retrieve the current state of the mouse.
|
|
||||||
* The current button state is returned as a button bitmask, which can
|
|
||||||
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
|
||||||
* mouse deltas since the last call to SDL_GetRelativeMouseState().
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the position of the mouse cursor (generates a mouse motion event)
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create a cursor using the specified data and mask (in MSB format).
|
|
||||||
* The cursor width must be a multiple of 8 bits.
|
|
||||||
*
|
|
||||||
* The cursor is created in black and white according to the following:
|
|
||||||
* data mask resulting pixel on screen
|
|
||||||
* 0 1 White
|
|
||||||
* 1 1 Black
|
|
||||||
* 0 0 Transparent
|
|
||||||
* 1 0 Inverted color if possible, black if not.
|
|
||||||
*
|
|
||||||
* Cursors created with this function must be freed with SDL_FreeCursor().
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor
|
|
||||||
(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the currently active cursor to the specified one.
|
|
||||||
* If the cursor is currently visible, the change will be immediately
|
|
||||||
* represented on the display.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns the currently active cursor.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Deallocates a cursor created with SDL_CreateCursor().
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Toggle whether or not the cursor is shown on the screen.
|
|
||||||
* The cursor start off displayed, but can be turned off.
|
|
||||||
* SDL_ShowCursor() returns 1 if the cursor was being displayed
|
|
||||||
* before the call, or 0 if it was not. You can query the current
|
|
||||||
* state by passing a 'toggle' value of -1.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
|
|
||||||
|
|
||||||
/* Used as a mask when testing buttons in buttonstate
|
|
||||||
Button 1: Left mouse button
|
|
||||||
Button 2: Middle mouse button
|
|
||||||
Button 3: Right mouse button
|
|
||||||
Button 4: Mouse wheel up (may also be a real button)
|
|
||||||
Button 5: Mouse wheel down (may also be a real button)
|
|
||||||
*/
|
|
||||||
#define SDL_BUTTON(X) (1 << ((X)-1))
|
|
||||||
#define SDL_BUTTON_LEFT 1
|
|
||||||
#define SDL_BUTTON_MIDDLE 2
|
|
||||||
#define SDL_BUTTON_RIGHT 3
|
|
||||||
#define SDL_BUTTON_WHEELUP 4
|
|
||||||
#define SDL_BUTTON_WHEELDOWN 5
|
|
||||||
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
|
|
||||||
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
|
|
||||||
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
|
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_mouse_h */
|
|
|
@ -1,162 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_mutex_h
|
|
||||||
#define _SDL_mutex_h
|
|
||||||
|
|
||||||
/* Functions to provide thread synchronization primitives
|
|
||||||
|
|
||||||
These are independent of the other SDL routines.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Synchronization functions which can time out return this value
|
|
||||||
if they time out.
|
|
||||||
*/
|
|
||||||
#define SDL_MUTEX_TIMEDOUT 1
|
|
||||||
|
|
||||||
/* This is the timeout value which corresponds to never time out */
|
|
||||||
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
|
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
/* Mutex functions */
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
/* The SDL mutex structure, defined in SDL_mutex.c */
|
|
||||||
struct SDL_mutex;
|
|
||||||
typedef struct SDL_mutex SDL_mutex;
|
|
||||||
|
|
||||||
/* Create a mutex, initialized unlocked */
|
|
||||||
extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void);
|
|
||||||
|
|
||||||
/* Lock the mutex (Returns 0, or -1 on error) */
|
|
||||||
#define SDL_LockMutex(m) SDL_mutexP(m)
|
|
||||||
extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex);
|
|
||||||
|
|
||||||
/* Unlock the mutex (Returns 0, or -1 on error)
|
|
||||||
It is an error to unlock a mutex that has not been locked by
|
|
||||||
the current thread, and doing so results in undefined behavior.
|
|
||||||
*/
|
|
||||||
#define SDL_UnlockMutex(m) SDL_mutexV(m)
|
|
||||||
extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex);
|
|
||||||
|
|
||||||
/* Destroy a mutex */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex);
|
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
/* Semaphore functions */
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
/* The SDL semaphore structure, defined in SDL_sem.c */
|
|
||||||
struct SDL_semaphore;
|
|
||||||
typedef struct SDL_semaphore SDL_sem;
|
|
||||||
|
|
||||||
/* Create a semaphore, initialized with value, returns NULL on failure. */
|
|
||||||
extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
|
|
||||||
|
|
||||||
/* Destroy a semaphore */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
|
|
||||||
|
|
||||||
/* This function suspends the calling thread until the semaphore pointed
|
|
||||||
* to by sem has a positive count. It then atomically decreases the semaphore
|
|
||||||
* count.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
|
|
||||||
|
|
||||||
/* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds,
|
|
||||||
SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem);
|
|
||||||
|
|
||||||
/* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if
|
|
||||||
the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in
|
|
||||||
the allotted time, and -1 on error.
|
|
||||||
On some platforms this function is implemented by looping with a delay
|
|
||||||
of 1 ms, and so should be avoided if possible.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms);
|
|
||||||
|
|
||||||
/* Atomically increases the semaphore's count (not blocking), returns 0,
|
|
||||||
or -1 on error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem);
|
|
||||||
|
|
||||||
/* Returns the current count of the semaphore */
|
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem);
|
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
/* Condition variable functions */
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
/* The SDL condition variable structure, defined in SDL_cond.c */
|
|
||||||
struct SDL_cond;
|
|
||||||
typedef struct SDL_cond SDL_cond;
|
|
||||||
|
|
||||||
/* Create a condition variable */
|
|
||||||
extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void);
|
|
||||||
|
|
||||||
/* Destroy a condition variable */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond);
|
|
||||||
|
|
||||||
/* Restart one of the threads that are waiting on the condition variable,
|
|
||||||
returns 0 or -1 on error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond);
|
|
||||||
|
|
||||||
/* Restart all threads that are waiting on the condition variable,
|
|
||||||
returns 0 or -1 on error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond);
|
|
||||||
|
|
||||||
/* Wait on the condition variable, unlocking the provided mutex.
|
|
||||||
The mutex must be locked before entering this function!
|
|
||||||
The mutex is re-locked once the condition variable is signaled.
|
|
||||||
Returns 0 when it is signaled, or -1 on error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);
|
|
||||||
|
|
||||||
/* Waits for at most 'ms' milliseconds, and returns 0 if the condition
|
|
||||||
variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
|
|
||||||
signaled in the allotted time, and -1 on error.
|
|
||||||
On some platforms this function is implemented by looping with a delay
|
|
||||||
of 1 ms, and so should be avoided if possible.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_mutex_h */
|
|
|
@ -1,11 +0,0 @@
|
||||||
|
|
||||||
#ifndef _SDLname_h_
|
|
||||||
#define _SDLname_h_
|
|
||||||
|
|
||||||
#if defined(__STDC__) || defined(__cplusplus)
|
|
||||||
#define NeedFunctionPrototypes 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SDL_NAME(X) SDL_##X
|
|
||||||
|
|
||||||
#endif /* _SDLname_h_ */
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,104 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Try to get a standard set of platform defines */
|
|
||||||
|
|
||||||
#ifndef _SDL_platform_h
|
|
||||||
#define _SDL_platform_h
|
|
||||||
|
|
||||||
#if defined(_AIX)
|
|
||||||
#undef __AIX__
|
|
||||||
#define __AIX__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(AMIGA) || defined(__AMIGA) || defined(__amigados__)
|
|
||||||
#undef __AMIGA__
|
|
||||||
#define __AMIGA__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(__BEOS__)
|
|
||||||
#undef __BEOS__
|
|
||||||
#define __BEOS__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
|
|
||||||
#undef __BSDI__
|
|
||||||
#define __BSDI__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(_arch_dreamcast)
|
|
||||||
#undef __DREAMCAST__
|
|
||||||
#define __DREAMCAST__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
|
||||||
#undef __FREEBSD__
|
|
||||||
#define __FREEBSD__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
|
|
||||||
#undef __HPUX__
|
|
||||||
#define __HPUX__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
|
|
||||||
#undef __IRIX__
|
|
||||||
#define __IRIX__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(linux) || defined(__linux) || defined(__linux__)
|
|
||||||
#undef __LINUX__
|
|
||||||
#define __LINUX__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
#undef __MACOSX__
|
|
||||||
#define __MACOSX__ 1
|
|
||||||
#elif defined(macintosh)
|
|
||||||
#undef __MACOS__
|
|
||||||
#define __MACOS__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(__NetBSD__)
|
|
||||||
#undef __NETBSD__
|
|
||||||
#define __NETBSD__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(__OpenBSD__)
|
|
||||||
#undef __OPENBSD__
|
|
||||||
#define __OPENBSD__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(__OS2__)
|
|
||||||
#undef __OS2__
|
|
||||||
#define __OS2__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
|
|
||||||
#undef __OSF__
|
|
||||||
#define __OSF__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(__QNXNTO__)
|
|
||||||
#undef __QNXNTO__
|
|
||||||
#define __QNXNTO__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
|
|
||||||
#undef __RISCOS__
|
|
||||||
#define __RISCOS__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(__SVR4)
|
|
||||||
#undef __SOLARIS__
|
|
||||||
#define __SOLARIS__ 1
|
|
||||||
#endif
|
|
||||||
#if defined(WIN32) || defined(_WIN32)
|
|
||||||
#undef __WIN32__
|
|
||||||
#define __WIN32__ 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _SDL_platform_h */
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Include file for SDL quit event handling */
|
|
||||||
|
|
||||||
#ifndef _SDL_quit_h
|
|
||||||
#define _SDL_quit_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
An SDL_QUITEVENT is generated when the user tries to close the application
|
|
||||||
window. If it is ignored or filtered out, the window will remain open.
|
|
||||||
If it is not ignored or filtered, it is queued normally and the window
|
|
||||||
is allowed to close. When the window is closed, screen updates will
|
|
||||||
complete, but have no effect.
|
|
||||||
|
|
||||||
SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
|
|
||||||
and SIGTERM (system termination request), if handlers do not already
|
|
||||||
exist, that generate SDL_QUITEVENT events as well. There is no way
|
|
||||||
to determine the cause of an SDL_QUITEVENT, but setting a signal
|
|
||||||
handler in your application will override the default generation of
|
|
||||||
quit events for that signal.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* There are no functions directly affecting the quit event */
|
|
||||||
#define SDL_QuitRequested() \
|
|
||||||
(SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK))
|
|
||||||
|
|
||||||
#endif /* _SDL_quit_h */
|
|
|
@ -1,139 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This file provides a general interface for SDL to read and write
|
|
||||||
data sources. It can easily be extended to files, memory, etc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_rwops_h
|
|
||||||
#define _SDL_rwops_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This is the read/write operation structure -- very basic */
|
|
||||||
|
|
||||||
typedef struct SDL_RWops {
|
|
||||||
/* Seek to 'offset' relative to whence, one of stdio's whence values:
|
|
||||||
SEEK_SET, SEEK_CUR, SEEK_END
|
|
||||||
Returns the final offset in the data source.
|
|
||||||
*/
|
|
||||||
int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence);
|
|
||||||
|
|
||||||
/* Read up to 'num' objects each of size 'objsize' from the data
|
|
||||||
source to the area pointed at by 'ptr'.
|
|
||||||
Returns the number of objects read, or -1 if the read failed.
|
|
||||||
*/
|
|
||||||
int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum);
|
|
||||||
|
|
||||||
/* Write exactly 'num' objects each of size 'objsize' from the area
|
|
||||||
pointed at by 'ptr' to data source.
|
|
||||||
Returns 'num', or -1 if the write failed.
|
|
||||||
*/
|
|
||||||
int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num);
|
|
||||||
|
|
||||||
/* Close and free an allocated SDL_FSops structure */
|
|
||||||
int (SDLCALL *close)(struct SDL_RWops *context);
|
|
||||||
|
|
||||||
Uint32 type;
|
|
||||||
union {
|
|
||||||
#ifdef __WIN32__
|
|
||||||
struct {
|
|
||||||
int append;
|
|
||||||
void* h;
|
|
||||||
} win32io;
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STDIO_H
|
|
||||||
struct {
|
|
||||||
int autoclose;
|
|
||||||
FILE *fp;
|
|
||||||
} stdio;
|
|
||||||
#endif
|
|
||||||
struct {
|
|
||||||
Uint8 *base;
|
|
||||||
Uint8 *here;
|
|
||||||
Uint8 *stop;
|
|
||||||
} mem;
|
|
||||||
struct {
|
|
||||||
void *data1;
|
|
||||||
} unknown;
|
|
||||||
} hidden;
|
|
||||||
|
|
||||||
} SDL_RWops;
|
|
||||||
|
|
||||||
|
|
||||||
/* Functions to create SDL_RWops structures from various data sources */
|
|
||||||
|
|
||||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode);
|
|
||||||
|
|
||||||
#ifdef HAVE_STDIO_H
|
|
||||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size);
|
|
||||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size);
|
|
||||||
|
|
||||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area);
|
|
||||||
|
|
||||||
#define RW_SEEK_SET 0 /* Seek from the beginning of data */
|
|
||||||
#define RW_SEEK_CUR 1 /* Seek relative to current read point */
|
|
||||||
#define RW_SEEK_END 2 /* Seek relative to the end of data */
|
|
||||||
|
|
||||||
/* Macros to easily read and write from an SDL_RWops structure */
|
|
||||||
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
|
|
||||||
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
|
|
||||||
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
|
|
||||||
#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
|
|
||||||
#define SDL_RWclose(ctx) (ctx)->close(ctx)
|
|
||||||
|
|
||||||
|
|
||||||
/* Read an item of the specified endianness and return in native format */
|
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
|
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
|
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
|
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
|
|
||||||
extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
|
|
||||||
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
|
|
||||||
|
|
||||||
/* Write an item of native format to the specified endianness */
|
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
|
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
|
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
|
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
|
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
|
|
||||||
extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
|
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_rwops_h */
|
|
|
@ -1,584 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This is a general header that includes C language support */
|
|
||||||
|
|
||||||
#ifndef _SDL_stdinc_h
|
|
||||||
#define _SDL_stdinc_h
|
|
||||||
|
|
||||||
#include "SDL_config.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STDIO_H
|
|
||||||
#include <stdio.h>
|
|
||||||
#endif
|
|
||||||
#if defined(STDC_HEADERS)
|
|
||||||
# include <stdlib.h>
|
|
||||||
# include <stddef.h>
|
|
||||||
# include <stdarg.h>
|
|
||||||
#else
|
|
||||||
# if defined(HAVE_STDLIB_H)
|
|
||||||
# include <stdlib.h>
|
|
||||||
# elif defined(HAVE_MALLOC_H)
|
|
||||||
# include <malloc.h>
|
|
||||||
# endif
|
|
||||||
# if defined(HAVE_STDDEF_H)
|
|
||||||
# include <stddef.h>
|
|
||||||
# endif
|
|
||||||
# if defined(HAVE_STDARG_H)
|
|
||||||
# include <stdarg.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STRING_H
|
|
||||||
# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
|
|
||||||
# include <memory.h>
|
|
||||||
# endif
|
|
||||||
# include <string.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
# include <strings.h>
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_INTTYPES_H)
|
|
||||||
# include <inttypes.h>
|
|
||||||
#elif defined(HAVE_STDINT_H)
|
|
||||||
# include <stdint.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_CTYPE_H
|
|
||||||
# include <ctype.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_ICONV_H
|
|
||||||
# include <iconv.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The number of elements in an array */
|
|
||||||
#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
|
|
||||||
#define SDL_TABLESIZE(table) SDL_arraysize(table)
|
|
||||||
|
|
||||||
/* Basic data types */
|
|
||||||
typedef enum SDL_bool {
|
|
||||||
SDL_FALSE = 0,
|
|
||||||
SDL_TRUE = 1
|
|
||||||
} SDL_bool;
|
|
||||||
|
|
||||||
typedef int8_t Sint8;
|
|
||||||
typedef uint8_t Uint8;
|
|
||||||
typedef int16_t Sint16;
|
|
||||||
typedef uint16_t Uint16;
|
|
||||||
typedef int32_t Sint32;
|
|
||||||
typedef uint32_t Uint32;
|
|
||||||
|
|
||||||
#ifdef SDL_HAS_64BIT_TYPE
|
|
||||||
typedef int64_t Sint64;
|
|
||||||
typedef uint64_t Uint64;
|
|
||||||
#else
|
|
||||||
/* This is really just a hack to prevent the compiler from complaining */
|
|
||||||
typedef struct {
|
|
||||||
Uint32 hi;
|
|
||||||
Uint32 lo;
|
|
||||||
} Uint64, Sint64;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make sure the types really have the right sizes */
|
|
||||||
#define SDL_COMPILE_TIME_ASSERT(name, x) \
|
|
||||||
typedef int SDL_dummy_ ## name[(x) * 2 - 1]
|
|
||||||
|
|
||||||
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
|
|
||||||
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
|
|
||||||
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
|
|
||||||
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
|
|
||||||
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
|
|
||||||
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
|
|
||||||
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
|
|
||||||
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
|
||||||
|
|
||||||
/* Check to make sure enums are the size of ints, for structure packing.
|
|
||||||
For both Watcom C/C++ and Borland C/C++ the compiler option that makes
|
|
||||||
enums having the size of an int must be enabled.
|
|
||||||
This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
|
|
||||||
*/
|
|
||||||
/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#pragma enumsalwaysint on
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
DUMMY_ENUM_VALUE
|
|
||||||
} SDL_DUMMY_ENUM;
|
|
||||||
|
|
||||||
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
|
|
||||||
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC
|
|
||||||
#define SDL_malloc malloc
|
|
||||||
#else
|
|
||||||
extern DECLSPEC void * SDLCALL SDL_malloc(size_t size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CALLOC
|
|
||||||
#define SDL_calloc calloc
|
|
||||||
#else
|
|
||||||
extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_REALLOC
|
|
||||||
#define SDL_realloc realloc
|
|
||||||
#else
|
|
||||||
extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_FREE
|
|
||||||
#define SDL_free free
|
|
||||||
#else
|
|
||||||
extern DECLSPEC void SDLCALL SDL_free(void *mem);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_ALLOCA) && !defined(alloca)
|
|
||||||
# if defined(HAVE_ALLOCA_H)
|
|
||||||
# include <alloca.h>
|
|
||||||
# elif defined(__GNUC__)
|
|
||||||
# define alloca __builtin_alloca
|
|
||||||
# elif defined(_MSC_VER)
|
|
||||||
# include <malloc.h>
|
|
||||||
# define alloca _alloca
|
|
||||||
# elif defined(__WATCOMC__)
|
|
||||||
# include <malloc.h>
|
|
||||||
# elif defined(__AIX__)
|
|
||||||
#pragma alloca
|
|
||||||
# elif defined(__MRC__)
|
|
||||||
void *alloca (unsigned);
|
|
||||||
# else
|
|
||||||
char *alloca ();
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_ALLOCA
|
|
||||||
#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count)
|
|
||||||
#define SDL_stack_free(data)
|
|
||||||
#else
|
|
||||||
#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*count)
|
|
||||||
#define SDL_stack_free(data) SDL_free(data)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_GETENV
|
|
||||||
#define SDL_getenv getenv
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_PUTENV
|
|
||||||
#define SDL_putenv putenv
|
|
||||||
#else
|
|
||||||
extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_QSORT
|
|
||||||
#define SDL_qsort qsort
|
|
||||||
#else
|
|
||||||
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
|
|
||||||
int (*compare)(const void *, const void *));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ABS
|
|
||||||
#define SDL_abs abs
|
|
||||||
#else
|
|
||||||
#define SDL_abs(X) ((X) < 0 ? -(X) : (X))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
|
|
||||||
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
|
|
||||||
|
|
||||||
#ifdef HAVE_CTYPE_H
|
|
||||||
#define SDL_isdigit(X) isdigit(X)
|
|
||||||
#define SDL_isspace(X) isspace(X)
|
|
||||||
#define SDL_toupper(X) toupper(X)
|
|
||||||
#define SDL_tolower(X) tolower(X)
|
|
||||||
#else
|
|
||||||
#define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9'))
|
|
||||||
#define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n'))
|
|
||||||
#define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X))
|
|
||||||
#define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MEMSET
|
|
||||||
#define SDL_memset memset
|
|
||||||
#else
|
|
||||||
extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(i386)
|
|
||||||
#define SDL_memset4(dst, val, len) \
|
|
||||||
do { \
|
|
||||||
int u0, u1, u2; \
|
|
||||||
__asm__ __volatile__ ( \
|
|
||||||
"cld\n\t" \
|
|
||||||
"rep ; stosl\n\t" \
|
|
||||||
: "=&D" (u0), "=&a" (u1), "=&c" (u2) \
|
|
||||||
: "0" (dst), "1" (val), "2" ((Uint32)(len)) \
|
|
||||||
: "memory" ); \
|
|
||||||
} while(0)
|
|
||||||
#endif
|
|
||||||
#ifndef SDL_memset4
|
|
||||||
#define SDL_memset4(dst, val, len) \
|
|
||||||
do { \
|
|
||||||
unsigned _count = (len); \
|
|
||||||
unsigned _n = (_count + 3) / 4; \
|
|
||||||
Uint32 *_p = (Uint32 *)(dst); \
|
|
||||||
Uint32 _val = (val); \
|
|
||||||
switch (_count % 4) { \
|
|
||||||
case 0: do { *_p++ = _val; \
|
|
||||||
case 3: *_p++ = _val; \
|
|
||||||
case 2: *_p++ = _val; \
|
|
||||||
case 1: *_p++ = _val; \
|
|
||||||
} while ( --_n ); \
|
|
||||||
} \
|
|
||||||
} while(0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(i386)
|
|
||||||
#define SDL_memcpy(dst, src, len) \
|
|
||||||
do { \
|
|
||||||
int u0, u1, u2; \
|
|
||||||
__asm__ __volatile__ ( \
|
|
||||||
"cld\n\t" \
|
|
||||||
"rep ; movsl\n\t" \
|
|
||||||
"testb $2,%b4\n\t" \
|
|
||||||
"je 1f\n\t" \
|
|
||||||
"movsw\n" \
|
|
||||||
"1:\ttestb $1,%b4\n\t" \
|
|
||||||
"je 2f\n\t" \
|
|
||||||
"movsb\n" \
|
|
||||||
"2:" \
|
|
||||||
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \
|
|
||||||
: "0" ((unsigned)(len)/4), "q" (len), "1" (dst),"2" (src) \
|
|
||||||
: "memory" ); \
|
|
||||||
} while(0)
|
|
||||||
#endif
|
|
||||||
#ifndef SDL_memcpy
|
|
||||||
#ifdef HAVE_MEMCPY
|
|
||||||
#define SDL_memcpy memcpy
|
|
||||||
#elif defined(HAVE_BCOPY)
|
|
||||||
#define SDL_memcpy(d, s, n) bcopy((s), (d), (n))
|
|
||||||
#else
|
|
||||||
extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(i386)
|
|
||||||
#define SDL_memcpy4(dst, src, len) \
|
|
||||||
do { \
|
|
||||||
int ecx, edi, esi; \
|
|
||||||
__asm__ __volatile__ ( \
|
|
||||||
"cld\n\t" \
|
|
||||||
"rep ; movsl" \
|
|
||||||
: "=&c" (ecx), "=&D" (edi), "=&S" (esi) \
|
|
||||||
: "0" ((unsigned)(len)), "1" (dst), "2" (src) \
|
|
||||||
: "memory" ); \
|
|
||||||
} while(0)
|
|
||||||
#endif
|
|
||||||
#ifndef SDL_memcpy4
|
|
||||||
#define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(i386)
|
|
||||||
#define SDL_revcpy(dst, src, len) \
|
|
||||||
do { \
|
|
||||||
int u0, u1, u2; \
|
|
||||||
char *dstp = (char *)(dst); \
|
|
||||||
char *srcp = (char *)(src); \
|
|
||||||
int n = (len); \
|
|
||||||
if ( n >= 4 ) { \
|
|
||||||
__asm__ __volatile__ ( \
|
|
||||||
"std\n\t" \
|
|
||||||
"rep ; movsl\n\t" \
|
|
||||||
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \
|
|
||||||
: "0" (n >> 2), \
|
|
||||||
"1" (dstp+(n-4)), "2" (srcp+(n-4)) \
|
|
||||||
: "memory" ); \
|
|
||||||
} \
|
|
||||||
switch (n & 3) { \
|
|
||||||
case 3: dstp[2] = srcp[2]; \
|
|
||||||
case 2: dstp[1] = srcp[1]; \
|
|
||||||
case 1: dstp[0] = srcp[0]; \
|
|
||||||
break; \
|
|
||||||
default: \
|
|
||||||
break; \
|
|
||||||
} \
|
|
||||||
} while(0)
|
|
||||||
#endif
|
|
||||||
#ifndef SDL_revcpy
|
|
||||||
extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MEMMOVE
|
|
||||||
#define SDL_memmove memmove
|
|
||||||
#elif defined(HAVE_BCOPY)
|
|
||||||
#define SDL_memmove(d, s, n) bcopy((s), (d), (n))
|
|
||||||
#else
|
|
||||||
#define SDL_memmove(dst, src, len) \
|
|
||||||
do { \
|
|
||||||
if ( dst < src ) { \
|
|
||||||
SDL_memcpy(dst, src, len); \
|
|
||||||
} else { \
|
|
||||||
SDL_revcpy(dst, src, len); \
|
|
||||||
} \
|
|
||||||
} while(0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MEMCMP
|
|
||||||
#define SDL_memcmp memcmp
|
|
||||||
#else
|
|
||||||
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRLEN
|
|
||||||
#define SDL_strlen strlen
|
|
||||||
#else
|
|
||||||
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRLCPY
|
|
||||||
#define SDL_strlcpy strlcpy
|
|
||||||
#else
|
|
||||||
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRLCAT
|
|
||||||
#define SDL_strlcat strlcat
|
|
||||||
#else
|
|
||||||
extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRDUP
|
|
||||||
#define SDL_strdup strdup
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_strdup(const char *string);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE__STRREV
|
|
||||||
#define SDL_strrev _strrev
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_strrev(char *string);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE__STRUPR
|
|
||||||
#define SDL_strupr _strupr
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_strupr(char *string);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE__STRLWR
|
|
||||||
#define SDL_strlwr _strlwr
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_strlwr(char *string);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRCHR
|
|
||||||
#define SDL_strchr strchr
|
|
||||||
#elif defined(HAVE_INDEX)
|
|
||||||
#define SDL_strchr index
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRRCHR
|
|
||||||
#define SDL_strrchr strrchr
|
|
||||||
#elif defined(HAVE_RINDEX)
|
|
||||||
#define SDL_strrchr rindex
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRSTR
|
|
||||||
#define SDL_strstr strstr
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ITOA
|
|
||||||
#define SDL_itoa itoa
|
|
||||||
#else
|
|
||||||
#define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE__LTOA
|
|
||||||
#define SDL_ltoa _ltoa
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE__UITOA
|
|
||||||
#define SDL_uitoa _uitoa
|
|
||||||
#else
|
|
||||||
#define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE__ULTOA
|
|
||||||
#define SDL_ultoa _ultoa
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRTOL
|
|
||||||
#define SDL_strtol strtol
|
|
||||||
#else
|
|
||||||
extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRTOUL
|
|
||||||
#define SDL_strtoul strtoul
|
|
||||||
#else
|
|
||||||
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SDL_HAS_64BIT_TYPE
|
|
||||||
|
|
||||||
#ifdef HAVE__I64TOA
|
|
||||||
#define SDL_lltoa _i64toa
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE__UI64TOA
|
|
||||||
#define SDL_ulltoa _ui64toa
|
|
||||||
#else
|
|
||||||
extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRTOLL
|
|
||||||
#define SDL_strtoll strtoll
|
|
||||||
#else
|
|
||||||
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRTOULL
|
|
||||||
#define SDL_strtoull strtoull
|
|
||||||
#else
|
|
||||||
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* SDL_HAS_64BIT_TYPE */
|
|
||||||
|
|
||||||
#ifdef HAVE_STRTOD
|
|
||||||
#define SDL_strtod strtod
|
|
||||||
#else
|
|
||||||
extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ATOI
|
|
||||||
#define SDL_atoi atoi
|
|
||||||
#else
|
|
||||||
#define SDL_atoi(X) SDL_strtol(X, NULL, 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ATOF
|
|
||||||
#define SDL_atof atof
|
|
||||||
#else
|
|
||||||
#define SDL_atof(X) SDL_strtod(X, NULL)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRCMP
|
|
||||||
#define SDL_strcmp strcmp
|
|
||||||
#else
|
|
||||||
extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRNCMP
|
|
||||||
#define SDL_strncmp strncmp
|
|
||||||
#else
|
|
||||||
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRCASECMP
|
|
||||||
#define SDL_strcasecmp strcasecmp
|
|
||||||
#elif defined(HAVE__STRICMP)
|
|
||||||
#define SDL_strcasecmp _stricmp
|
|
||||||
#else
|
|
||||||
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRNCASECMP
|
|
||||||
#define SDL_strncasecmp strncasecmp
|
|
||||||
#elif defined(HAVE__STRNICMP)
|
|
||||||
#define SDL_strncasecmp _strnicmp
|
|
||||||
#else
|
|
||||||
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SSCANF
|
|
||||||
#define SDL_sscanf sscanf
|
|
||||||
#else
|
|
||||||
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SNPRINTF
|
|
||||||
#define SDL_snprintf snprintf
|
|
||||||
#else
|
|
||||||
extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_VSNPRINTF
|
|
||||||
#define SDL_vsnprintf vsnprintf
|
|
||||||
#else
|
|
||||||
extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The SDL implementation of iconv() returns these error codes */
|
|
||||||
#define SDL_ICONV_ERROR (size_t)-1
|
|
||||||
#define SDL_ICONV_E2BIG (size_t)-2
|
|
||||||
#define SDL_ICONV_EILSEQ (size_t)-3
|
|
||||||
#define SDL_ICONV_EINVAL (size_t)-4
|
|
||||||
|
|
||||||
#ifdef HAVE_ICONV
|
|
||||||
#define SDL_iconv_t iconv_t
|
|
||||||
#define SDL_iconv_open iconv_open
|
|
||||||
#define SDL_iconv_close iconv_close
|
|
||||||
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
|
|
||||||
#else
|
|
||||||
typedef struct _SDL_iconv_t *SDL_iconv_t;
|
|
||||||
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode);
|
|
||||||
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
|
|
||||||
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
|
|
||||||
#endif
|
|
||||||
/* This function converts a string between encodings in one pass, returning a
|
|
||||||
string that must be freed with SDL_free() or NULL on error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft);
|
|
||||||
#define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1)
|
|
||||||
#define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1)
|
|
||||||
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
|
|
||||||
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_stdinc_h */
|
|
|
@ -1,210 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Include file for SDL custom system window manager hooks */
|
|
||||||
|
|
||||||
#ifndef _SDL_syswm_h
|
|
||||||
#define _SDL_syswm_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
#include "SDL_version.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Your application has access to a special type of event 'SDL_SYSWMEVENT',
|
|
||||||
which contains window-manager specific information and arrives whenever
|
|
||||||
an unhandled window event occurs. This event is ignored by default, but
|
|
||||||
you can enable it with SDL_EventState()
|
|
||||||
*/
|
|
||||||
#ifdef SDL_PROTOTYPES_ONLY
|
|
||||||
struct SDL_SysWMinfo;
|
|
||||||
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* This is the structure for custom window manager events */
|
|
||||||
#if defined(SDL_VIDEO_DRIVER_X11)
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
|
||||||
/* conflicts with Quickdraw.h */
|
|
||||||
#define Cursor X11Cursor
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xatom.h>
|
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
|
||||||
/* matches the re-define above */
|
|
||||||
#undef Cursor
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* These are the various supported subsystems under UNIX */
|
|
||||||
typedef enum {
|
|
||||||
SDL_SYSWM_X11
|
|
||||||
} SDL_SYSWM_TYPE;
|
|
||||||
|
|
||||||
/* The UNIX custom event structure */
|
|
||||||
struct SDL_SysWMmsg {
|
|
||||||
SDL_version version;
|
|
||||||
SDL_SYSWM_TYPE subsystem;
|
|
||||||
union {
|
|
||||||
XEvent xevent;
|
|
||||||
} event;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The UNIX custom window manager information structure.
|
|
||||||
When this structure is returned, it holds information about which
|
|
||||||
low level system it is using, and will be one of SDL_SYSWM_TYPE.
|
|
||||||
*/
|
|
||||||
typedef struct SDL_SysWMinfo {
|
|
||||||
SDL_version version;
|
|
||||||
SDL_SYSWM_TYPE subsystem;
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
Display *display; /* The X11 display */
|
|
||||||
Window window; /* The X11 display window */
|
|
||||||
/* These locking functions should be called around
|
|
||||||
any X11 functions using the display variable.
|
|
||||||
They lock the event thread, so should not be
|
|
||||||
called around event functions or from event filters.
|
|
||||||
*/
|
|
||||||
void (*lock_func)(void);
|
|
||||||
void (*unlock_func)(void);
|
|
||||||
|
|
||||||
/* Introduced in SDL 1.0.2 */
|
|
||||||
Window fswindow; /* The X11 fullscreen window */
|
|
||||||
Window wmwindow; /* The X11 managed input window */
|
|
||||||
} x11;
|
|
||||||
} info;
|
|
||||||
} SDL_SysWMinfo;
|
|
||||||
|
|
||||||
#elif defined(SDL_VIDEO_DRIVER_NANOX)
|
|
||||||
#include <microwin/nano-X.h>
|
|
||||||
|
|
||||||
/* The generic custom event structure */
|
|
||||||
struct SDL_SysWMmsg {
|
|
||||||
SDL_version version;
|
|
||||||
int data;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The windows custom window manager information structure */
|
|
||||||
typedef struct SDL_SysWMinfo {
|
|
||||||
SDL_version version ;
|
|
||||||
GR_WINDOW_ID window ; /* The display window */
|
|
||||||
} SDL_SysWMinfo;
|
|
||||||
|
|
||||||
#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
/* The windows custom event structure */
|
|
||||||
struct SDL_SysWMmsg {
|
|
||||||
SDL_version version;
|
|
||||||
HWND hwnd; /* The window for the message */
|
|
||||||
UINT msg; /* The type of message */
|
|
||||||
WPARAM wParam; /* WORD message parameter */
|
|
||||||
LPARAM lParam; /* LONG message parameter */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The windows custom window manager information structure */
|
|
||||||
typedef struct SDL_SysWMinfo {
|
|
||||||
SDL_version version;
|
|
||||||
HWND window; /* The Win32 display window */
|
|
||||||
HGLRC hglrc; /* The OpenGL context, if any */
|
|
||||||
} SDL_SysWMinfo;
|
|
||||||
|
|
||||||
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
|
|
||||||
|
|
||||||
/* RISC OS custom event structure */
|
|
||||||
struct SDL_SysWMmsg {
|
|
||||||
SDL_version version;
|
|
||||||
int eventCode; /* The window for the message */
|
|
||||||
int pollBlock[64];
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The RISC OS custom window manager information structure */
|
|
||||||
typedef struct SDL_SysWMinfo {
|
|
||||||
SDL_version version;
|
|
||||||
int wimpVersion; /* Wimp version running under */
|
|
||||||
int taskHandle; /* The RISC OS task handle */
|
|
||||||
int window; /* The RISC OS display window */
|
|
||||||
} SDL_SysWMinfo;
|
|
||||||
|
|
||||||
#elif defined(SDL_VIDEO_DRIVER_PHOTON)
|
|
||||||
#include <sys/neutrino.h>
|
|
||||||
#include <Ph.h>
|
|
||||||
|
|
||||||
/* The QNX custom event structure */
|
|
||||||
struct SDL_SysWMmsg {
|
|
||||||
SDL_version version;
|
|
||||||
int data;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The QNX custom window manager information structure */
|
|
||||||
typedef struct SDL_SysWMinfo {
|
|
||||||
SDL_version version;
|
|
||||||
int data;
|
|
||||||
} SDL_SysWMinfo;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* The generic custom event structure */
|
|
||||||
struct SDL_SysWMmsg {
|
|
||||||
SDL_version version;
|
|
||||||
int data;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The generic custom window manager information structure */
|
|
||||||
typedef struct SDL_SysWMinfo {
|
|
||||||
SDL_version version;
|
|
||||||
int data;
|
|
||||||
} SDL_SysWMinfo;
|
|
||||||
|
|
||||||
#endif /* video driver type */
|
|
||||||
|
|
||||||
#endif /* SDL_PROTOTYPES_ONLY */
|
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
/*
|
|
||||||
* This function gives you custom hooks into the window manager information.
|
|
||||||
* It fills the structure pointed to by 'info' with custom information and
|
|
||||||
* returns 1 if the function is implemented. If it's not implemented, or
|
|
||||||
* the version member of the 'info' structure is invalid, it returns 0.
|
|
||||||
*
|
|
||||||
* You typically use this function like this:
|
|
||||||
* SDL_SysWMInfo info;
|
|
||||||
* SDL_VERSION(&info.version);
|
|
||||||
* if ( SDL_GetWMInfo(&info) ) { ... }
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
|
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_syswm_h */
|
|
|
@ -1,119 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_thread_h
|
|
||||||
#define _SDL_thread_h
|
|
||||||
|
|
||||||
/* Header for the SDL thread management routines
|
|
||||||
|
|
||||||
These are independent of the other SDL routines.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
|
|
||||||
/* Thread synchronization primitives */
|
|
||||||
#include "SDL_mutex.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The SDL thread structure, defined in SDL_thread.c */
|
|
||||||
struct SDL_Thread;
|
|
||||||
typedef struct SDL_Thread SDL_Thread;
|
|
||||||
|
|
||||||
/* Create a thread */
|
|
||||||
#if (defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)
|
|
||||||
/*
|
|
||||||
We compile SDL into a DLL on OS/2. This means, that it's the DLL which
|
|
||||||
creates a new thread for the calling process with the SDL_CreateThread()
|
|
||||||
API. There is a problem with this, that only the RTL of the SDL.DLL will
|
|
||||||
be initialized for those threads, and not the RTL of the calling application!
|
|
||||||
To solve this, we make a little hack here.
|
|
||||||
We'll always use the caller's _beginthread() and _endthread() APIs to
|
|
||||||
start a new thread. This way, if it's the SDL.DLL which uses this API,
|
|
||||||
then the RTL of SDL.DLL will be used to create the new thread, and if it's
|
|
||||||
the application, then the RTL of the application will be used.
|
|
||||||
So, in short:
|
|
||||||
Always use the _beginthread() and _endthread() of the calling runtime library!
|
|
||||||
*/
|
|
||||||
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
#include <process.h> /* This has _beginthread() and _endthread() defined! */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __OS2__
|
|
||||||
typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg);
|
|
||||||
typedef void (*pfnSDL_CurrentEndThread)(void);
|
|
||||||
#elif __GNUC__
|
|
||||||
typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
|
||||||
unsigned (__stdcall *func)(void *), void *arg,
|
|
||||||
unsigned, unsigned *threadID);
|
|
||||||
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
|
||||||
#else
|
|
||||||
typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
|
||||||
unsigned (__stdcall *func)(void *), void *arg,
|
|
||||||
unsigned, unsigned *threadID);
|
|
||||||
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread);
|
|
||||||
|
|
||||||
#ifdef __OS2__
|
|
||||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread)
|
|
||||||
#elif defined(_WIN32_WCE)
|
|
||||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL)
|
|
||||||
#else
|
|
||||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex)
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Get the 32-bit thread identifier for the current thread */
|
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void);
|
|
||||||
|
|
||||||
/* Get the 32-bit thread identifier for the specified thread,
|
|
||||||
equivalent to SDL_ThreadID() if the specified thread is NULL.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread);
|
|
||||||
|
|
||||||
/* Wait for a thread to finish.
|
|
||||||
The return code for the thread function is placed in the area
|
|
||||||
pointed to by 'status', if 'status' is not NULL.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
|
|
||||||
|
|
||||||
/* Forcefully kill a thread without worrying about its state */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread);
|
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_thread_h */
|
|
|
@ -1,115 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SDL_timer_h
|
|
||||||
#define _SDL_timer_h
|
|
||||||
|
|
||||||
/* Header for the SDL time management routines */
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This is the OS scheduler timeslice, in milliseconds */
|
|
||||||
#define SDL_TIMESLICE 10
|
|
||||||
|
|
||||||
/* This is the maximum resolution of the SDL timer on all platforms */
|
|
||||||
#define TIMER_RESOLUTION 10 /* Experimentally determined */
|
|
||||||
|
|
||||||
/* Get the number of milliseconds since the SDL library initialization.
|
|
||||||
* Note that this value wraps if the program runs for more than ~49 days.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
|
||||||
|
|
||||||
/* Wait a specified number of milliseconds before returning */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
|
||||||
|
|
||||||
/* Function prototype for the timer callback function */
|
|
||||||
typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval);
|
|
||||||
|
|
||||||
/* Set a callback to run after the specified number of milliseconds has
|
|
||||||
* elapsed. The callback function is passed the current timer interval
|
|
||||||
* and returns the next timer interval. If the returned value is the
|
|
||||||
* same as the one passed in, the periodic alarm continues, otherwise a
|
|
||||||
* new alarm is scheduled. If the callback returns 0, the periodic alarm
|
|
||||||
* is cancelled.
|
|
||||||
*
|
|
||||||
* To cancel a currently running timer, call SDL_SetTimer(0, NULL);
|
|
||||||
*
|
|
||||||
* The timer callback function may run in a different thread than your
|
|
||||||
* main code, and so shouldn't call any functions from within itself.
|
|
||||||
*
|
|
||||||
* The maximum resolution of this timer is 10 ms, which means that if
|
|
||||||
* you request a 16 ms timer, your callback will run approximately 20 ms
|
|
||||||
* later on an unloaded system. If you wanted to set a flag signaling
|
|
||||||
* a frame update at 30 frames per second (every 33 ms), you might set a
|
|
||||||
* timer for 30 ms:
|
|
||||||
* SDL_SetTimer((33/10)*10, flag_update);
|
|
||||||
*
|
|
||||||
* If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init().
|
|
||||||
*
|
|
||||||
* Under UNIX, you should not use raise or use SIGALRM and this function
|
|
||||||
* in the same program, as it is implemented using setitimer(). You also
|
|
||||||
* should not use this function in multi-threaded applications as signals
|
|
||||||
* to multi-threaded apps have undefined behavior in some implementations.
|
|
||||||
*
|
|
||||||
* This function returns 0 if successful, or -1 if there was an error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);
|
|
||||||
|
|
||||||
/* New timer API, supports multiple timers
|
|
||||||
* Written by Stephane Peter <megastep@lokigames.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Function prototype for the new timer callback function.
|
|
||||||
* The callback function is passed the current timer interval and returns
|
|
||||||
* the next timer interval. If the returned value is the same as the one
|
|
||||||
* passed in, the periodic alarm continues, otherwise a new alarm is
|
|
||||||
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
|
|
||||||
*/
|
|
||||||
typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param);
|
|
||||||
|
|
||||||
/* Definition of the timer ID type */
|
|
||||||
typedef struct _SDL_TimerID *SDL_TimerID;
|
|
||||||
|
|
||||||
/* Add a new timer to the pool of timers already running.
|
|
||||||
Returns a timer ID, or NULL when an error occurs.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);
|
|
||||||
|
|
||||||
/* Remove one of the multiple timers knowing its ID.
|
|
||||||
* Returns a boolean value indicating success.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_timer_h */
|
|
|
@ -1,24 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* DEPRECATED */
|
|
||||||
#include "SDL_stdinc.h"
|
|
|
@ -1,85 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This header defines the current SDL version */
|
|
||||||
|
|
||||||
#ifndef _SDL_version_h
|
|
||||||
#define _SDL_version_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
|
||||||
*/
|
|
||||||
#define SDL_MAJOR_VERSION 1
|
|
||||||
#define SDL_MINOR_VERSION 2
|
|
||||||
#define SDL_PATCHLEVEL 10
|
|
||||||
|
|
||||||
typedef struct SDL_version {
|
|
||||||
Uint8 major;
|
|
||||||
Uint8 minor;
|
|
||||||
Uint8 patch;
|
|
||||||
} SDL_version;
|
|
||||||
|
|
||||||
/* This macro can be used to fill a version structure with the compile-time
|
|
||||||
* version of the SDL library.
|
|
||||||
*/
|
|
||||||
#define SDL_VERSION(X) \
|
|
||||||
{ \
|
|
||||||
(X)->major = SDL_MAJOR_VERSION; \
|
|
||||||
(X)->minor = SDL_MINOR_VERSION; \
|
|
||||||
(X)->patch = SDL_PATCHLEVEL; \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This macro turns the version numbers into a numeric value:
|
|
||||||
(1,2,3) -> (1203)
|
|
||||||
This assumes that there will never be more than 100 patchlevels
|
|
||||||
*/
|
|
||||||
#define SDL_VERSIONNUM(X, Y, Z) \
|
|
||||||
((X)*1000 + (Y)*100 + (Z))
|
|
||||||
|
|
||||||
/* This is the version number macro for the current SDL version */
|
|
||||||
#define SDL_COMPILEDVERSION \
|
|
||||||
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
|
|
||||||
|
|
||||||
/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */
|
|
||||||
#define SDL_VERSION_ATLEAST(X, Y, Z) \
|
|
||||||
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
|
|
||||||
|
|
||||||
/* This function gets the version of the dynamically linked SDL library.
|
|
||||||
it should NOT be used to fill a version structure, instead you should
|
|
||||||
use the SDL_Version() macro.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_version_h */
|
|
|
@ -1,889 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2006 Sam Lantinga
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Header file for access to the SDL raw framebuffer window */
|
|
||||||
|
|
||||||
#ifndef _SDL_video_h
|
|
||||||
#define _SDL_video_h
|
|
||||||
|
|
||||||
#include "SDL_stdinc.h"
|
|
||||||
#include "SDL_error.h"
|
|
||||||
#include "SDL_rwops.h"
|
|
||||||
|
|
||||||
#include "begin_code.h"
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Transparency definitions: These define alpha as the opacity of a surface */
|
|
||||||
#define SDL_ALPHA_OPAQUE 255
|
|
||||||
#define SDL_ALPHA_TRANSPARENT 0
|
|
||||||
|
|
||||||
/* Useful data types */
|
|
||||||
typedef struct SDL_Rect {
|
|
||||||
Sint16 x, y;
|
|
||||||
Uint16 w, h;
|
|
||||||
} SDL_Rect;
|
|
||||||
|
|
||||||
typedef struct SDL_Color {
|
|
||||||
Uint8 r;
|
|
||||||
Uint8 g;
|
|
||||||
Uint8 b;
|
|
||||||
Uint8 unused;
|
|
||||||
} SDL_Color;
|
|
||||||
#define SDL_Colour SDL_Color
|
|
||||||
|
|
||||||
typedef struct SDL_Palette {
|
|
||||||
int ncolors;
|
|
||||||
SDL_Color *colors;
|
|
||||||
} SDL_Palette;
|
|
||||||
|
|
||||||
/* Everything in the pixel format structure is read-only */
|
|
||||||
typedef struct SDL_PixelFormat {
|
|
||||||
SDL_Palette *palette;
|
|
||||||
Uint8 BitsPerPixel;
|
|
||||||
Uint8 BytesPerPixel;
|
|
||||||
Uint8 Rloss;
|
|
||||||
Uint8 Gloss;
|
|
||||||
Uint8 Bloss;
|
|
||||||
Uint8 Aloss;
|
|
||||||
Uint8 Rshift;
|
|
||||||
Uint8 Gshift;
|
|
||||||
Uint8 Bshift;
|
|
||||||
Uint8 Ashift;
|
|
||||||
Uint32 Rmask;
|
|
||||||
Uint32 Gmask;
|
|
||||||
Uint32 Bmask;
|
|
||||||
Uint32 Amask;
|
|
||||||
|
|
||||||
/* RGB color key information */
|
|
||||||
Uint32 colorkey;
|
|
||||||
/* Alpha value information (per-surface alpha) */
|
|
||||||
Uint8 alpha;
|
|
||||||
} SDL_PixelFormat;
|
|
||||||
|
|
||||||
/* This structure should be treated as read-only, except for 'pixels',
|
|
||||||
which, if not NULL, contains the raw pixel data for the surface.
|
|
||||||
*/
|
|
||||||
typedef struct SDL_Surface {
|
|
||||||
Uint32 flags; /* Read-only */
|
|
||||||
SDL_PixelFormat *format; /* Read-only */
|
|
||||||
int w, h; /* Read-only */
|
|
||||||
Uint16 pitch; /* Read-only */
|
|
||||||
void *pixels; /* Read-write */
|
|
||||||
int offset; /* Private */
|
|
||||||
|
|
||||||
/* Hardware-specific surface info */
|
|
||||||
struct private_hwdata *hwdata;
|
|
||||||
|
|
||||||
/* clipping information */
|
|
||||||
SDL_Rect clip_rect; /* Read-only */
|
|
||||||
Uint32 unused1; /* for binary compatibility */
|
|
||||||
|
|
||||||
/* Allow recursive locks */
|
|
||||||
Uint32 locked; /* Private */
|
|
||||||
|
|
||||||
/* info for fast blit mapping to other surfaces */
|
|
||||||
struct SDL_BlitMap *map; /* Private */
|
|
||||||
|
|
||||||
/* format version, bumped at every change to invalidate blit maps */
|
|
||||||
unsigned int format_version; /* Private */
|
|
||||||
|
|
||||||
/* Reference count -- used when freeing surface */
|
|
||||||
int refcount; /* Read-mostly */
|
|
||||||
} SDL_Surface;
|
|
||||||
|
|
||||||
/* These are the currently supported flags for the SDL_surface */
|
|
||||||
/* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */
|
|
||||||
#define SDL_SWSURFACE 0x00000000 /* Surface is in system memory */
|
|
||||||
#define SDL_HWSURFACE 0x00000001 /* Surface is in video memory */
|
|
||||||
#define SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */
|
|
||||||
/* Available for SDL_SetVideoMode() */
|
|
||||||
#define SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */
|
|
||||||
#define SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */
|
|
||||||
#define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */
|
|
||||||
#define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */
|
|
||||||
#define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */
|
|
||||||
#define SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */
|
|
||||||
#define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */
|
|
||||||
#define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */
|
|
||||||
/* Used internally (read-only) */
|
|
||||||
#define SDL_HWACCEL 0x00000100 /* Blit uses hardware acceleration */
|
|
||||||
#define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */
|
|
||||||
#define SDL_RLEACCELOK 0x00002000 /* Private flag */
|
|
||||||
#define SDL_RLEACCEL 0x00004000 /* Surface is RLE encoded */
|
|
||||||
#define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */
|
|
||||||
#define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */
|
|
||||||
|
|
||||||
/* Evaluates to true if the surface needs to be locked before access */
|
|
||||||
#define SDL_MUSTLOCK(surface) \
|
|
||||||
(surface->offset || \
|
|
||||||
((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0))
|
|
||||||
|
|
||||||
/* typedef for private surface blitting functions */
|
|
||||||
typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect,
|
|
||||||
struct SDL_Surface *dst, SDL_Rect *dstrect);
|
|
||||||
|
|
||||||
|
|
||||||
/* Useful for determining the video hardware capabilities */
|
|
||||||
typedef struct SDL_VideoInfo {
|
|
||||||
Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */
|
|
||||||
Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */
|
|
||||||
Uint32 UnusedBits1 :6;
|
|
||||||
Uint32 UnusedBits2 :1;
|
|
||||||
Uint32 blit_hw :1; /* Flag: Accelerated blits HW --> HW */
|
|
||||||
Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */
|
|
||||||
Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */
|
|
||||||
Uint32 blit_sw :1; /* Flag: Accelerated blits SW --> HW */
|
|
||||||
Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */
|
|
||||||
Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */
|
|
||||||
Uint32 blit_fill :1; /* Flag: Accelerated color fill */
|
|
||||||
Uint32 UnusedBits3 :16;
|
|
||||||
Uint32 video_mem; /* The total amount of video memory (in K) */
|
|
||||||
SDL_PixelFormat *vfmt; /* Value: The format of the video surface */
|
|
||||||
int current_w; /* Value: The current video mode width */
|
|
||||||
int current_h; /* Value: The current video mode height */
|
|
||||||
} SDL_VideoInfo;
|
|
||||||
|
|
||||||
|
|
||||||
/* The most common video overlay formats.
|
|
||||||
For an explanation of these pixel formats, see:
|
|
||||||
http://www.webartz.com/fourcc/indexyuv.htm
|
|
||||||
|
|
||||||
For information on the relationship between color spaces, see:
|
|
||||||
http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
|
|
||||||
*/
|
|
||||||
#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */
|
|
||||||
#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */
|
|
||||||
#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
|
|
||||||
#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
|
|
||||||
#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
|
|
||||||
|
|
||||||
/* The YUV hardware video overlay */
|
|
||||||
typedef struct SDL_Overlay {
|
|
||||||
Uint32 format; /* Read-only */
|
|
||||||
int w, h; /* Read-only */
|
|
||||||
int planes; /* Read-only */
|
|
||||||
Uint16 *pitches; /* Read-only */
|
|
||||||
Uint8 **pixels; /* Read-write */
|
|
||||||
|
|
||||||
/* Hardware-specific surface info */
|
|
||||||
struct private_yuvhwfuncs *hwfuncs;
|
|
||||||
struct private_yuvhwdata *hwdata;
|
|
||||||
|
|
||||||
/* Special flags */
|
|
||||||
Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */
|
|
||||||
Uint32 UnusedBits :31;
|
|
||||||
} SDL_Overlay;
|
|
||||||
|
|
||||||
|
|
||||||
/* Public enumeration for setting the OpenGL window attributes. */
|
|
||||||
typedef enum {
|
|
||||||
SDL_GL_RED_SIZE,
|
|
||||||
SDL_GL_GREEN_SIZE,
|
|
||||||
SDL_GL_BLUE_SIZE,
|
|
||||||
SDL_GL_ALPHA_SIZE,
|
|
||||||
SDL_GL_BUFFER_SIZE,
|
|
||||||
SDL_GL_DOUBLEBUFFER,
|
|
||||||
SDL_GL_DEPTH_SIZE,
|
|
||||||
SDL_GL_STENCIL_SIZE,
|
|
||||||
SDL_GL_ACCUM_RED_SIZE,
|
|
||||||
SDL_GL_ACCUM_GREEN_SIZE,
|
|
||||||
SDL_GL_ACCUM_BLUE_SIZE,
|
|
||||||
SDL_GL_ACCUM_ALPHA_SIZE,
|
|
||||||
SDL_GL_STEREO,
|
|
||||||
SDL_GL_MULTISAMPLEBUFFERS,
|
|
||||||
SDL_GL_MULTISAMPLESAMPLES,
|
|
||||||
SDL_GL_ACCELERATED_VISUAL,
|
|
||||||
SDL_GL_SWAP_CONTROL
|
|
||||||
} SDL_GLattr;
|
|
||||||
|
|
||||||
/* flags for SDL_SetPalette() */
|
|
||||||
#define SDL_LOGPAL 0x01
|
|
||||||
#define SDL_PHYSPAL 0x02
|
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
|
|
||||||
/* These functions are used internally, and should not be used unless you
|
|
||||||
* have a specific need to specify the video driver you want to use.
|
|
||||||
* You should normally use SDL_Init() or SDL_InitSubSystem().
|
|
||||||
*
|
|
||||||
* SDL_VideoInit() initializes the video subsystem -- sets up a connection
|
|
||||||
* to the window manager, etc, and determines the current video mode and
|
|
||||||
* pixel format, but does not initialize a window or graphics mode.
|
|
||||||
* Note that event handling is activated by this routine.
|
|
||||||
*
|
|
||||||
* If you use both sound and video in your application, you need to call
|
|
||||||
* SDL_Init() before opening the sound device, otherwise under Win32 DirectX,
|
|
||||||
* you won't be able to set full-screen display modes.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
|
|
||||||
|
|
||||||
/* This function fills the given character buffer with the name of the
|
|
||||||
* video driver, and returns a pointer to it if the video driver has
|
|
||||||
* been initialized. It returns NULL if no driver has been initialized.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function returns a pointer to the current display surface.
|
|
||||||
* If SDL is doing format conversion on the display surface, this
|
|
||||||
* function returns the publicly visible surface, not the real video
|
|
||||||
* surface.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function returns a read-only pointer to information about the
|
|
||||||
* video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt'
|
|
||||||
* member of the returned structure will contain the pixel format of the
|
|
||||||
* "best" video mode.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check to see if a particular video mode is supported.
|
|
||||||
* It returns 0 if the requested mode is not supported under any bit depth,
|
|
||||||
* or returns the bits-per-pixel of the closest available mode with the
|
|
||||||
* given width and height. If this bits-per-pixel is different from the
|
|
||||||
* one used when setting the video mode, SDL_SetVideoMode() will succeed,
|
|
||||||
* but will emulate the requested bits-per-pixel with a shadow surface.
|
|
||||||
*
|
|
||||||
* The arguments to SDL_VideoModeOK() are the same ones you would pass to
|
|
||||||
* SDL_SetVideoMode()
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return a pointer to an array of available screen dimensions for the
|
|
||||||
* given format and video flags, sorted largest to smallest. Returns
|
|
||||||
* NULL if there are no dimensions available for a particular format,
|
|
||||||
* or (SDL_Rect **)-1 if any dimension is okay for the given format.
|
|
||||||
*
|
|
||||||
* If 'format' is NULL, the mode list will be for the format given
|
|
||||||
* by SDL_GetVideoInfo()->vfmt
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set up a video mode with the specified width, height and bits-per-pixel.
|
|
||||||
*
|
|
||||||
* If 'bpp' is 0, it is treated as the current display bits per pixel.
|
|
||||||
*
|
|
||||||
* If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the
|
|
||||||
* requested bits-per-pixel, but will return whatever video pixel format is
|
|
||||||
* available. The default is to emulate the requested pixel format if it
|
|
||||||
* is not natively available.
|
|
||||||
*
|
|
||||||
* If SDL_HWSURFACE is set in 'flags', the video surface will be placed in
|
|
||||||
* video memory, if possible, and you may have to call SDL_LockSurface()
|
|
||||||
* in order to access the raw framebuffer. Otherwise, the video surface
|
|
||||||
* will be created in system memory.
|
|
||||||
*
|
|
||||||
* If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle
|
|
||||||
* updates asynchronously, but you must always lock before accessing pixels.
|
|
||||||
* SDL will wait for updates to complete before returning from the lock.
|
|
||||||
*
|
|
||||||
* If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee
|
|
||||||
* that the colors set by SDL_SetColors() will be the colors you get.
|
|
||||||
* Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all
|
|
||||||
* of the colors exactly the way they are requested, and you should look
|
|
||||||
* at the video surface structure to determine the actual palette.
|
|
||||||
* If SDL cannot guarantee that the colors you request can be set,
|
|
||||||
* i.e. if the colormap is shared, then the video surface may be created
|
|
||||||
* under emulation in system memory, overriding the SDL_HWSURFACE flag.
|
|
||||||
*
|
|
||||||
* If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set
|
|
||||||
* a fullscreen video mode. The default is to create a windowed mode
|
|
||||||
* if the current graphics system has a window manager.
|
|
||||||
* If the SDL library is able to set a fullscreen video mode, this flag
|
|
||||||
* will be set in the surface that is returned.
|
|
||||||
*
|
|
||||||
* If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up
|
|
||||||
* two surfaces in video memory and swap between them when you call
|
|
||||||
* SDL_Flip(). This is usually slower than the normal single-buffering
|
|
||||||
* scheme, but prevents "tearing" artifacts caused by modifying video
|
|
||||||
* memory while the monitor is refreshing. It should only be used by
|
|
||||||
* applications that redraw the entire screen on every update.
|
|
||||||
*
|
|
||||||
* If SDL_RESIZABLE is set in 'flags', the SDL library will allow the
|
|
||||||
* window manager, if any, to resize the window at runtime. When this
|
|
||||||
* occurs, SDL will send a SDL_VIDEORESIZE event to you application,
|
|
||||||
* and you must respond to the event by re-calling SDL_SetVideoMode()
|
|
||||||
* with the requested size (or another size that suits the application).
|
|
||||||
*
|
|
||||||
* If SDL_NOFRAME is set in 'flags', the SDL library will create a window
|
|
||||||
* without any title bar or frame decoration. Fullscreen video modes have
|
|
||||||
* this flag set automatically.
|
|
||||||
*
|
|
||||||
* This function returns the video framebuffer surface, or NULL if it fails.
|
|
||||||
*
|
|
||||||
* If you rely on functionality provided by certain video flags, check the
|
|
||||||
* flags of the returned surface to make sure that functionality is available.
|
|
||||||
* SDL will fall back to reduced functionality if the exact flags you wanted
|
|
||||||
* are not available.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode
|
|
||||||
(int width, int height, int bpp, Uint32 flags);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Makes sure the given list of rectangles is updated on the given screen.
|
|
||||||
* If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
|
|
||||||
* screen.
|
|
||||||
* These functions should not be called while 'screen' is locked.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_UpdateRects
|
|
||||||
(SDL_Surface *screen, int numrects, SDL_Rect *rects);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_UpdateRect
|
|
||||||
(SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* On hardware that supports double-buffering, this function sets up a flip
|
|
||||||
* and returns. The hardware will wait for vertical retrace, and then swap
|
|
||||||
* video buffers before the next video surface blit or lock will return.
|
|
||||||
* On hardware that doesn not support double-buffering, this is equivalent
|
|
||||||
* to calling SDL_UpdateRect(screen, 0, 0, 0, 0);
|
|
||||||
* The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when
|
|
||||||
* setting the video mode for this function to perform hardware flipping.
|
|
||||||
* This function returns 0 if successful, or -1 if there was an error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the gamma correction for each of the color channels.
|
|
||||||
* The gamma values range (approximately) between 0.1 and 10.0
|
|
||||||
*
|
|
||||||
* If this function isn't supported directly by the hardware, it will
|
|
||||||
* be emulated using gamma ramps, if available. If successful, this
|
|
||||||
* function returns 0, otherwise it returns -1.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the gamma translation table for the red, green, and blue channels
|
|
||||||
* of the video hardware. Each table is an array of 256 16-bit quantities,
|
|
||||||
* representing a mapping between the input and output for that channel.
|
|
||||||
* The input is the index into the array, and the output is the 16-bit
|
|
||||||
* gamma value at that index, scaled to the output color precision.
|
|
||||||
*
|
|
||||||
* You may pass NULL for any of the channels to leave it unchanged.
|
|
||||||
* If the call succeeds, it will return 0. If the display driver or
|
|
||||||
* hardware does not support gamma translation, or otherwise fails,
|
|
||||||
* this function will return -1.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Retrieve the current values of the gamma translation tables.
|
|
||||||
*
|
|
||||||
* You must pass in valid pointers to arrays of 256 16-bit quantities.
|
|
||||||
* Any of the pointers may be NULL to ignore that channel.
|
|
||||||
* If the call succeeds, it will return 0. If the display driver or
|
|
||||||
* hardware does not support gamma translation, or otherwise fails,
|
|
||||||
* this function will return -1.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets a portion of the colormap for the given 8-bit surface. If 'surface'
|
|
||||||
* is not a palettized surface, this function does nothing, returning 0.
|
|
||||||
* If all of the colors were set as passed to SDL_SetColors(), it will
|
|
||||||
* return 1. If not all the color entries were set exactly as given,
|
|
||||||
* it will return 0, and you should look at the surface palette to
|
|
||||||
* determine the actual color palette.
|
|
||||||
*
|
|
||||||
* When 'surface' is the surface associated with the current display, the
|
|
||||||
* display colormap will be updated with the requested colors. If
|
|
||||||
* SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
|
|
||||||
* will always return 1, and the palette is guaranteed to be set the way
|
|
||||||
* you desire, even if the window colormap has to be warped or run under
|
|
||||||
* emulation.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface,
|
|
||||||
SDL_Color *colors, int firstcolor, int ncolors);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets a portion of the colormap for a given 8-bit surface.
|
|
||||||
* 'flags' is one or both of:
|
|
||||||
* SDL_LOGPAL -- set logical palette, which controls how blits are mapped
|
|
||||||
* to/from the surface,
|
|
||||||
* SDL_PHYSPAL -- set physical palette, which controls how pixels look on
|
|
||||||
* the screen
|
|
||||||
* Only screens have physical palettes. Separate change of physical/logical
|
|
||||||
* palettes is only possible if the screen has SDL_HWPALETTE set.
|
|
||||||
*
|
|
||||||
* The return value is 1 if all colours could be set as requested, and 0
|
|
||||||
* otherwise.
|
|
||||||
*
|
|
||||||
* SDL_SetColors() is equivalent to calling this function with
|
|
||||||
* flags = (SDL_LOGPAL|SDL_PHYSPAL).
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags,
|
|
||||||
SDL_Color *colors, int firstcolor,
|
|
||||||
int ncolors);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maps an RGB triple to an opaque pixel value for a given pixel format
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
|
|
||||||
(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maps an RGBA quadruple to a pixel value for a given pixel format
|
|
||||||
*/
|
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat *format,
|
|
||||||
Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maps a pixel value into the RGB components for a given pixel format
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt,
|
|
||||||
Uint8 *r, Uint8 *g, Uint8 *b);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maps a pixel value into the RGBA components for a given pixel format
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt,
|
|
||||||
Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
|
|
||||||
* If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
|
|
||||||
* If the depth is greater than 8 bits, the pixel format is set using the
|
|
||||||
* flags '[RGB]mask'.
|
|
||||||
* If the function runs out of memory, it will return NULL.
|
|
||||||
*
|
|
||||||
* The 'flags' tell what kind of surface to create.
|
|
||||||
* SDL_SWSURFACE means that the surface should be created in system memory.
|
|
||||||
* SDL_HWSURFACE means that the surface should be created in video memory,
|
|
||||||
* with the same format as the display surface. This is useful for surfaces
|
|
||||||
* that will not change much, to take advantage of hardware acceleration
|
|
||||||
* when being blitted to the display surface.
|
|
||||||
* SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with
|
|
||||||
* this surface, but you must always lock it before accessing the pixels.
|
|
||||||
* SDL will wait for current blits to finish before returning from the lock.
|
|
||||||
* SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
|
|
||||||
* If the hardware supports acceleration of colorkey blits between
|
|
||||||
* two surfaces in video memory, SDL will try to place the surface in
|
|
||||||
* video memory. If this isn't possible or if there is no hardware
|
|
||||||
* acceleration available, the surface will be placed in system memory.
|
|
||||||
* SDL_SRCALPHA means that the surface will be used for alpha blits and
|
|
||||||
* if the hardware supports hardware acceleration of alpha blits between
|
|
||||||
* two surfaces in video memory, to place the surface in video memory
|
|
||||||
* if possible, otherwise it will be placed in system memory.
|
|
||||||
* If the surface is created in video memory, blits will be _much_ faster,
|
|
||||||
* but the surface format must be identical to the video surface format,
|
|
||||||
* and the only way to access the pixels member of the surface is to use
|
|
||||||
* the SDL_LockSurface() and SDL_UnlockSurface() calls.
|
|
||||||
* If the requested surface actually resides in video memory, SDL_HWSURFACE
|
|
||||||
* will be set in the flags member of the returned surface. If for some
|
|
||||||
* reason the surface could not be placed in video memory, it will not have
|
|
||||||
* the SDL_HWSURFACE flag set, and will be created in system memory instead.
|
|
||||||
*/
|
|
||||||
#define SDL_AllocSurface SDL_CreateRGBSurface
|
|
||||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface
|
|
||||||
(Uint32 flags, int width, int height, int depth,
|
|
||||||
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
|
||||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
|
|
||||||
int width, int height, int depth, int pitch,
|
|
||||||
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SDL_LockSurface() sets up a surface for directly accessing the pixels.
|
|
||||||
* Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
|
|
||||||
* to and read from 'surface->pixels', using the pixel format stored in
|
|
||||||
* 'surface->format'. Once you are done accessing the surface, you should
|
|
||||||
* use SDL_UnlockSurface() to release it.
|
|
||||||
*
|
|
||||||
* Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
|
|
||||||
* to 0, then you can read and write to the surface at any time, and the
|
|
||||||
* pixel format of the surface will not change. In particular, if the
|
|
||||||
* SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you
|
|
||||||
* will not need to lock the display surface before accessing it.
|
|
||||||
*
|
|
||||||
* No operating system or library calls should be made between lock/unlock
|
|
||||||
* pairs, as critical system locks may be held during this time.
|
|
||||||
*
|
|
||||||
* SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Load a surface from a seekable SDL data source (memory or file.)
|
|
||||||
* If 'freesrc' is non-zero, the source will be closed after being read.
|
|
||||||
* Returns the new surface, or NULL if there was an error.
|
|
||||||
* The new surface should be freed with SDL_FreeSurface().
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc);
|
|
||||||
|
|
||||||
/* Convenience macro -- load a surface from a file */
|
|
||||||
#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Save a surface to a seekable SDL data source (memory or file.)
|
|
||||||
* If 'freedst' is non-zero, the source will be closed after being written.
|
|
||||||
* Returns 0 if successful or -1 if there was an error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
|
|
||||||
(SDL_Surface *surface, SDL_RWops *dst, int freedst);
|
|
||||||
|
|
||||||
/* Convenience macro -- save a surface to a file */
|
|
||||||
#define SDL_SaveBMP(surface, file) \
|
|
||||||
SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets the color key (transparent pixel) in a blittable surface.
|
|
||||||
* If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL),
|
|
||||||
* 'key' will be the transparent pixel in the source image of a blit.
|
|
||||||
* SDL_RLEACCEL requests RLE acceleration for the surface if present,
|
|
||||||
* and removes RLE acceleration if absent.
|
|
||||||
* If 'flag' is 0, this function clears any current color key.
|
|
||||||
* This function returns 0, or -1 if there was an error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SetColorKey
|
|
||||||
(SDL_Surface *surface, Uint32 flag, Uint32 key);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function sets the alpha value for the entire surface, as opposed to
|
|
||||||
* using the alpha component of each pixel. This value measures the range
|
|
||||||
* of transparency of the surface, 0 being completely transparent to 255
|
|
||||||
* being completely opaque. An 'alpha' value of 255 causes blits to be
|
|
||||||
* opaque, the source pixels copied to the destination (the default). Note
|
|
||||||
* that per-surface alpha can be combined with colorkey transparency.
|
|
||||||
*
|
|
||||||
* If 'flag' is 0, alpha blending is disabled for the surface.
|
|
||||||
* If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
|
|
||||||
* OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
|
|
||||||
* surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
|
|
||||||
*
|
|
||||||
* The 'alpha' parameter is ignored for surfaces that have an alpha channel.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets the clipping rectangle for the destination surface in a blit.
|
|
||||||
*
|
|
||||||
* If the clip rectangle is NULL, clipping will be disabled.
|
|
||||||
* If the clip rectangle doesn't intersect the surface, the function will
|
|
||||||
* return SDL_FALSE and blits will be completely clipped. Otherwise the
|
|
||||||
* function returns SDL_TRUE and blits to the surface will be clipped to
|
|
||||||
* the intersection of the surface area and the clipping rectangle.
|
|
||||||
*
|
|
||||||
* Note that blits are automatically clipped to the edges of the source
|
|
||||||
* and destination surfaces.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Gets the clipping rectangle for the destination surface in a blit.
|
|
||||||
* 'rect' must be a pointer to a valid rectangle which will be filled
|
|
||||||
* with the correct values.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Creates a new surface of the specified format, and then copies and maps
|
|
||||||
* the given surface to it so the blit of the converted surface will be as
|
|
||||||
* fast as possible. If this function fails, it returns NULL.
|
|
||||||
*
|
|
||||||
* The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those
|
|
||||||
* semantics. You can also pass SDL_RLEACCEL in the flags parameter and
|
|
||||||
* SDL will try to RLE accelerate colorkey and alpha blits in the resulting
|
|
||||||
* surface.
|
|
||||||
*
|
|
||||||
* This function is used internally by SDL_DisplayFormat().
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface
|
|
||||||
(SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This performs a fast blit from the source surface to the destination
|
|
||||||
* surface. It assumes that the source and destination rectangles are
|
|
||||||
* the same size. If either 'srcrect' or 'dstrect' are NULL, the entire
|
|
||||||
* surface (src or dst) is copied. The final blit rectangles are saved
|
|
||||||
* in 'srcrect' and 'dstrect' after all clipping is performed.
|
|
||||||
* If the blit is successful, it returns 0, otherwise it returns -1.
|
|
||||||
*
|
|
||||||
* The blit function should not be called on a locked surface.
|
|
||||||
*
|
|
||||||
* The blit semantics for surfaces with and without alpha and colorkey
|
|
||||||
* are defined as follows:
|
|
||||||
*
|
|
||||||
* RGBA->RGB:
|
|
||||||
* SDL_SRCALPHA set:
|
|
||||||
* alpha-blend (using alpha-channel).
|
|
||||||
* SDL_SRCCOLORKEY ignored.
|
|
||||||
* SDL_SRCALPHA not set:
|
|
||||||
* copy RGB.
|
|
||||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
|
||||||
* RGB values of the source colour key, ignoring alpha in the
|
|
||||||
* comparison.
|
|
||||||
*
|
|
||||||
* RGB->RGBA:
|
|
||||||
* SDL_SRCALPHA set:
|
|
||||||
* alpha-blend (using the source per-surface alpha value);
|
|
||||||
* set destination alpha to opaque.
|
|
||||||
* SDL_SRCALPHA not set:
|
|
||||||
* copy RGB, set destination alpha to source per-surface alpha value.
|
|
||||||
* both:
|
|
||||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
|
||||||
* source colour key.
|
|
||||||
*
|
|
||||||
* RGBA->RGBA:
|
|
||||||
* SDL_SRCALPHA set:
|
|
||||||
* alpha-blend (using the source alpha channel) the RGB values;
|
|
||||||
* leave destination alpha untouched. [Note: is this correct?]
|
|
||||||
* SDL_SRCCOLORKEY ignored.
|
|
||||||
* SDL_SRCALPHA not set:
|
|
||||||
* copy all of RGBA to the destination.
|
|
||||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
|
||||||
* RGB values of the source colour key, ignoring alpha in the
|
|
||||||
* comparison.
|
|
||||||
*
|
|
||||||
* RGB->RGB:
|
|
||||||
* SDL_SRCALPHA set:
|
|
||||||
* alpha-blend (using the source per-surface alpha value).
|
|
||||||
* SDL_SRCALPHA not set:
|
|
||||||
* copy RGB.
|
|
||||||
* both:
|
|
||||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
|
||||||
* source colour key.
|
|
||||||
*
|
|
||||||
* If either of the surfaces were in video memory, and the blit returns -2,
|
|
||||||
* the video memory was lost, so it should be reloaded with artwork and
|
|
||||||
* re-blitted:
|
|
||||||
while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
|
|
||||||
while ( SDL_LockSurface(image) < 0 )
|
|
||||||
Sleep(10);
|
|
||||||
-- Write image pixels to image->pixels --
|
|
||||||
SDL_UnlockSurface(image);
|
|
||||||
}
|
|
||||||
* This happens under DirectX 5.0 when the system switches away from your
|
|
||||||
* fullscreen application. The lock will also fail until you have access
|
|
||||||
* to the video memory again.
|
|
||||||
*/
|
|
||||||
/* You should call SDL_BlitSurface() unless you know exactly how SDL
|
|
||||||
blitting works internally and how to use the other blit functions.
|
|
||||||
*/
|
|
||||||
#define SDL_BlitSurface SDL_UpperBlit
|
|
||||||
|
|
||||||
/* This is the public blit function, SDL_BlitSurface(), and it performs
|
|
||||||
rectangle validation and clipping before passing it to SDL_LowerBlit()
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_UpperBlit
|
|
||||||
(SDL_Surface *src, SDL_Rect *srcrect,
|
|
||||||
SDL_Surface *dst, SDL_Rect *dstrect);
|
|
||||||
/* This is a semi-private blit function and it performs low-level surface
|
|
||||||
blitting only.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_LowerBlit
|
|
||||||
(SDL_Surface *src, SDL_Rect *srcrect,
|
|
||||||
SDL_Surface *dst, SDL_Rect *dstrect);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function performs a fast fill of the given rectangle with 'color'
|
|
||||||
* The given rectangle is clipped to the destination surface clip area
|
|
||||||
* and the final fill rectangle is saved in the passed in pointer.
|
|
||||||
* If 'dstrect' is NULL, the whole surface will be filled with 'color'
|
|
||||||
* The color should be a pixel of the format used by the surface, and
|
|
||||||
* can be generated by the SDL_MapRGB() function.
|
|
||||||
* This function returns 0 on success, or -1 on error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_FillRect
|
|
||||||
(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function takes a surface and copies it to a new surface of the
|
|
||||||
* pixel format and colors of the video framebuffer, suitable for fast
|
|
||||||
* blitting onto the display surface. It calls SDL_ConvertSurface()
|
|
||||||
*
|
|
||||||
* If you want to take advantage of hardware colorkey or alpha blit
|
|
||||||
* acceleration, you should set the colorkey and alpha value before
|
|
||||||
* calling this function.
|
|
||||||
*
|
|
||||||
* If the conversion fails or runs out of memory, it returns NULL
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function takes a surface and copies it to a new surface of the
|
|
||||||
* pixel format and colors of the video framebuffer (if possible),
|
|
||||||
* suitable for fast alpha blitting onto the display surface.
|
|
||||||
* The new surface will always have an alpha channel.
|
|
||||||
*
|
|
||||||
* If you want to take advantage of hardware colorkey or alpha blit
|
|
||||||
* acceleration, you should set the colorkey and alpha value before
|
|
||||||
* calling this function.
|
|
||||||
*
|
|
||||||
* If the conversion fails or runs out of memory, it returns NULL
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface);
|
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
/* YUV video surface overlay functions */
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
/* This function creates a video output overlay
|
|
||||||
Calling the returned surface an overlay is something of a misnomer because
|
|
||||||
the contents of the display surface underneath the area where the overlay
|
|
||||||
is shown is undefined - it may be overwritten with the converted YUV data.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height,
|
|
||||||
Uint32 format, SDL_Surface *display);
|
|
||||||
|
|
||||||
/* Lock an overlay for direct access, and unlock it when you are done */
|
|
||||||
extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay);
|
|
||||||
|
|
||||||
/* Blit a video overlay to the display surface.
|
|
||||||
The contents of the video surface underneath the blit destination are
|
|
||||||
not defined.
|
|
||||||
The width and height of the destination rectangle may be different from
|
|
||||||
that of the overlay, but currently only 2x scaling is supported.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect);
|
|
||||||
|
|
||||||
/* Free a video overlay */
|
|
||||||
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay);
|
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
/* OpenGL support functions. */
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Dynamically load an OpenGL library, or the default one if path is NULL
|
|
||||||
*
|
|
||||||
* If you do this, you need to retrieve all of the GL functions used in
|
|
||||||
* your program from the dynamic library using SDL_GL_GetProcAddress().
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the address of a GL function
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set an attribute of the OpenGL subsystem before intialization.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get an attribute of the OpenGL subsystem from the windowing
|
|
||||||
* interface, such as glX. This is of course different from getting
|
|
||||||
* the values from SDL's internal OpenGL subsystem, which only
|
|
||||||
* stores the values you request before initialization.
|
|
||||||
*
|
|
||||||
* Developers should track the values they pass into SDL_GL_SetAttribute
|
|
||||||
* themselves if they want to retrieve these values.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Swap the OpenGL buffers, if double-buffering is supported.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Internal functions that should not be called unless you have read
|
|
||||||
* and understood the source code for these functions.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_GL_Lock(void);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_GL_Unlock(void);
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
/* These functions allow interaction with the window manager, if any. */
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets/Gets the title and icon text of the display window (UTF-8 encoded)
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets the icon for the display window.
|
|
||||||
* This function must be called before the first call to SDL_SetVideoMode().
|
|
||||||
* It takes an icon surface, and a mask in MSB format.
|
|
||||||
* If 'mask' is NULL, the entire icon surface will be used as the icon.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function iconifies the window, and returns 1 if it succeeded.
|
|
||||||
* If the function succeeds, it generates an SDL_APPACTIVE loss event.
|
|
||||||
* This function is a noop and returns 0 in non-windowed environments.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Toggle fullscreen mode without changing the contents of the screen.
|
|
||||||
* If the display surface does not require locking before accessing
|
|
||||||
* the pixel information, then the memory pointers will not change.
|
|
||||||
*
|
|
||||||
* If this function was able to toggle fullscreen mode (change from
|
|
||||||
* running in a window to fullscreen, or vice-versa), it will return 1.
|
|
||||||
* If it is not implemented, or fails, it returns 0.
|
|
||||||
*
|
|
||||||
* The next call to SDL_SetVideoMode() will set the mode fullscreen
|
|
||||||
* attribute based on the flags parameter - if SDL_FULLSCREEN is not
|
|
||||||
* set, then the display will be windowed by default where supported.
|
|
||||||
*
|
|
||||||
* This is currently only implemented in the X11 video driver.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function allows you to set and query the input grab state of
|
|
||||||
* the application. It returns the new input grab state.
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
SDL_GRAB_QUERY = -1,
|
|
||||||
SDL_GRAB_OFF = 0,
|
|
||||||
SDL_GRAB_ON = 1,
|
|
||||||
SDL_GRAB_FULLSCREEN /* Used internally */
|
|
||||||
} SDL_GrabMode;
|
|
||||||
/*
|
|
||||||
* Grabbing means that the mouse is confined to the application window,
|
|
||||||
* and nearly all keyboard input is passed directly to the application,
|
|
||||||
* and not interpreted by a window manager, if any.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
|
|
||||||
|
|
||||||
/* Not in public API at the moment - do not use! */
|
|
||||||
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect,
|
|
||||||
SDL_Surface *dst, SDL_Rect *dstrect);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include "close_code.h"
|
|
||||||
|
|
||||||
#endif /* _SDL_video_h */
|
|
|
@ -1,150 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2004 Sam Lantinga
|
|
||||||
|
|
||||||
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
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This file sets things up for C dynamic library function definitions,
|
|
||||||
static inlined functions, and structures aligned at 4-byte alignment.
|
|
||||||
If you don't like ugly C preprocessor code, don't look at this file. :)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This shouldn't be nested -- included it around code only. */
|
|
||||||
#ifdef _begin_code_h
|
|
||||||
#error Nested inclusion of begin_code.h
|
|
||||||
#endif
|
|
||||||
#define _begin_code_h
|
|
||||||
|
|
||||||
/* Some compilers use a special export keyword */
|
|
||||||
#ifndef DECLSPEC
|
|
||||||
# if defined(__BEOS__)
|
|
||||||
# if defined(__GNUC__)
|
|
||||||
# define DECLSPEC __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
# define DECLSPEC __declspec(export)
|
|
||||||
# endif
|
|
||||||
# elif defined(__WIN32__)
|
|
||||||
# ifdef __BORLANDC__
|
|
||||||
# ifdef BUILD_SDL
|
|
||||||
# define DECLSPEC
|
|
||||||
# else
|
|
||||||
# define DECLSPEC __declspec(dllimport)
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# define DECLSPEC __declspec(dllexport)
|
|
||||||
# endif
|
|
||||||
# elif defined(__OS2__)
|
|
||||||
# ifdef __WATCOMC__
|
|
||||||
# ifdef BUILD_SDL
|
|
||||||
# define DECLSPEC __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
# define DECLSPEC
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# define DECLSPEC
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# if defined(__GNUC__) && __GNUC__ >= 4
|
|
||||||
# define DECLSPEC __attribute__ ((visibility("default")))
|
|
||||||
# else
|
|
||||||
# define DECLSPEC
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* By default SDL uses the C calling convention */
|
|
||||||
#ifndef SDLCALL
|
|
||||||
#if defined(__WIN32__) && !defined(__GNUC__)
|
|
||||||
#define SDLCALL __cdecl
|
|
||||||
#else
|
|
||||||
#ifdef __OS2__
|
|
||||||
/* But on OS/2, we use the _System calling convention */
|
|
||||||
/* to be compatible with every compiler */
|
|
||||||
#define SDLCALL _System
|
|
||||||
#else
|
|
||||||
#define SDLCALL
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif /* SDLCALL */
|
|
||||||
|
|
||||||
/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
|
|
||||||
#ifdef __SYMBIAN32__
|
|
||||||
#undef DECLSPEC
|
|
||||||
#define DECLSPEC
|
|
||||||
#endif /* __SYMBIAN32__ */
|
|
||||||
|
|
||||||
/* Force structure packing at 4 byte alignment.
|
|
||||||
This is necessary if the header is included in code which has structure
|
|
||||||
packing set to an alternate value, say for loading structures from disk.
|
|
||||||
The packing is reset to the previous value in close_code.h
|
|
||||||
*/
|
|
||||||
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(disable: 4103)
|
|
||||||
#endif
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma nopackwarning
|
|
||||||
#endif
|
|
||||||
#pragma pack(push,4)
|
|
||||||
#elif (defined(__MWERKS__) && defined(__MACOS__))
|
|
||||||
#pragma options align=mac68k4byte
|
|
||||||
#pragma enumsalwaysint on
|
|
||||||
#endif /* Compiler needs structure packing set */
|
|
||||||
|
|
||||||
/* Set up compiler-specific options for inlining functions */
|
|
||||||
#ifndef SDL_INLINE_OKAY
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define SDL_INLINE_OKAY
|
|
||||||
#else
|
|
||||||
/* Add any special compiler-specific cases here */
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || \
|
|
||||||
defined(__DMC__) || defined(__SC__) || \
|
|
||||||
defined(__WATCOMC__) || defined(__LCC__) || \
|
|
||||||
defined(__DECC)
|
|
||||||
#ifndef __inline__
|
|
||||||
#define __inline__ __inline
|
|
||||||
#endif
|
|
||||||
#define SDL_INLINE_OKAY
|
|
||||||
#else
|
|
||||||
#if !defined(__MRC__) && !defined(_SGI_SOURCE)
|
|
||||||
#define __inline__ inline
|
|
||||||
#define SDL_INLINE_OKAY
|
|
||||||
#endif /* Not a funky compiler */
|
|
||||||
#endif /* Visual C++ */
|
|
||||||
#endif /* GNU C */
|
|
||||||
#endif /* SDL_INLINE_OKAY */
|
|
||||||
|
|
||||||
/* If inlining isn't supported, remove "__inline__", turning static
|
|
||||||
inlined functions into static functions (resulting in code bloat
|
|
||||||
in all files which include the offending header files)
|
|
||||||
*/
|
|
||||||
#ifndef SDL_INLINE_OKAY
|
|
||||||
#define __inline__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Apparently this is needed by several Windows compilers */
|
|
||||||
#if !defined(__MACH__)
|
|
||||||
#ifndef NULL
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define NULL 0
|
|
||||||
#else
|
|
||||||
#define NULL ((void *)0)
|
|
||||||
#endif
|
|
||||||
#endif /* NULL */
|
|
||||||
#endif /* ! Mac OS X - breaks precompiled headers */
|
|
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
SDL - Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2004 Sam Lantinga
|
|
||||||
|
|
||||||
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
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Sam Lantinga
|
|
||||||
slouken@libsdl.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This file reverses the effects of begin_code.h and should be included
|
|
||||||
after you finish any function and structure declarations in your headers
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef _begin_code_h
|
|
||||||
|
|
||||||
/* Reset structure packing at previous byte alignment */
|
|
||||||
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma nopackwarning
|
|
||||||
#endif
|
|
||||||
#if (defined(__MWERKS__) && defined(__MACOS__))
|
|
||||||
#pragma options align=reset
|
|
||||||
#pragma enumsalwaysint reset
|
|
||||||
#else
|
|
||||||
#pragma pack(pop)
|
|
||||||
#endif
|
|
||||||
#endif /* Compiler needs structure packing set */
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
zlib.vcproj.A2.Spacy.user
|
|
||||||
debug
|
|
||||||
release
|
|
|
@ -1,25 +0,0 @@
|
||||||
/.cvsignore/1.1/Sat May 13 16:42:49 2006//
|
|
||||||
/adler32.c/1.1/Fri May 12 21:27:36 2006//
|
|
||||||
/compress.c/1.1/Fri May 12 21:27:36 2006//
|
|
||||||
/crc32.c/1.1/Fri May 12 21:27:36 2006//
|
|
||||||
/crc32.h/1.1/Fri May 12 21:27:36 2006//
|
|
||||||
/deflate.c/1.1/Fri May 12 21:27:36 2006//
|
|
||||||
/deflate.h/1.1/Fri May 12 21:27:36 2006//
|
|
||||||
/gzio.c/1.1/Fri May 12 21:27:36 2006//
|
|
||||||
/infback.c/1.1/Fri May 12 21:27:36 2006//
|
|
||||||
/inffast.c/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/inffast.h/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/inffixed.h/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/inflate.c/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/inflate.h/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/inftrees.c/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/inftrees.h/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/trees.c/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/trees.h/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/uncompr.c/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/zconf.h/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/zlib.h/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/zlib.vcproj/1.5/Wed Aug 23 22:13:30 2006//
|
|
||||||
/zutil.c/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
/zutil.h/1.1/Fri May 12 21:27:37 2006//
|
|
||||||
D
|
|
|
@ -1 +0,0 @@
|
||||||
VisualBoyAdvance/win32/dependencies/zlib
|
|
|
@ -1 +0,0 @@
|
||||||
:pserver:anonymous@vba.cvs.sourceforge.net:/cvsroot/vba
|
|
|
@ -1,149 +0,0 @@
|
||||||
/* adler32.c -- compute the Adler-32 checksum of a data stream
|
|
||||||
* Copyright (C) 1995-2004 Mark Adler
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* @(#) $Id: adler32.c,v 1.1 2006/05/12 21:27:36 spacy51 Exp $ */
|
|
||||||
|
|
||||||
#define ZLIB_INTERNAL
|
|
||||||
#include "zlib.h"
|
|
||||||
|
|
||||||
#define BASE 65521UL /* largest prime smaller than 65536 */
|
|
||||||
#define NMAX 5552
|
|
||||||
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
|
||||||
|
|
||||||
#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
|
|
||||||
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
|
|
||||||
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
|
|
||||||
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
|
|
||||||
#define DO16(buf) DO8(buf,0); DO8(buf,8);
|
|
||||||
|
|
||||||
/* use NO_DIVIDE if your processor does not do division in hardware */
|
|
||||||
#ifdef NO_DIVIDE
|
|
||||||
# define MOD(a) \
|
|
||||||
do { \
|
|
||||||
if (a >= (BASE << 16)) a -= (BASE << 16); \
|
|
||||||
if (a >= (BASE << 15)) a -= (BASE << 15); \
|
|
||||||
if (a >= (BASE << 14)) a -= (BASE << 14); \
|
|
||||||
if (a >= (BASE << 13)) a -= (BASE << 13); \
|
|
||||||
if (a >= (BASE << 12)) a -= (BASE << 12); \
|
|
||||||
if (a >= (BASE << 11)) a -= (BASE << 11); \
|
|
||||||
if (a >= (BASE << 10)) a -= (BASE << 10); \
|
|
||||||
if (a >= (BASE << 9)) a -= (BASE << 9); \
|
|
||||||
if (a >= (BASE << 8)) a -= (BASE << 8); \
|
|
||||||
if (a >= (BASE << 7)) a -= (BASE << 7); \
|
|
||||||
if (a >= (BASE << 6)) a -= (BASE << 6); \
|
|
||||||
if (a >= (BASE << 5)) a -= (BASE << 5); \
|
|
||||||
if (a >= (BASE << 4)) a -= (BASE << 4); \
|
|
||||||
if (a >= (BASE << 3)) a -= (BASE << 3); \
|
|
||||||
if (a >= (BASE << 2)) a -= (BASE << 2); \
|
|
||||||
if (a >= (BASE << 1)) a -= (BASE << 1); \
|
|
||||||
if (a >= BASE) a -= BASE; \
|
|
||||||
} while (0)
|
|
||||||
# define MOD4(a) \
|
|
||||||
do { \
|
|
||||||
if (a >= (BASE << 4)) a -= (BASE << 4); \
|
|
||||||
if (a >= (BASE << 3)) a -= (BASE << 3); \
|
|
||||||
if (a >= (BASE << 2)) a -= (BASE << 2); \
|
|
||||||
if (a >= (BASE << 1)) a -= (BASE << 1); \
|
|
||||||
if (a >= BASE) a -= BASE; \
|
|
||||||
} while (0)
|
|
||||||
#else
|
|
||||||
# define MOD(a) a %= BASE
|
|
||||||
# define MOD4(a) a %= BASE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
uLong ZEXPORT adler32(adler, buf, len)
|
|
||||||
uLong adler;
|
|
||||||
const Bytef *buf;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
unsigned long sum2;
|
|
||||||
unsigned n;
|
|
||||||
|
|
||||||
/* split Adler-32 into component sums */
|
|
||||||
sum2 = (adler >> 16) & 0xffff;
|
|
||||||
adler &= 0xffff;
|
|
||||||
|
|
||||||
/* in case user likes doing a byte at a time, keep it fast */
|
|
||||||
if (len == 1) {
|
|
||||||
adler += buf[0];
|
|
||||||
if (adler >= BASE)
|
|
||||||
adler -= BASE;
|
|
||||||
sum2 += adler;
|
|
||||||
if (sum2 >= BASE)
|
|
||||||
sum2 -= BASE;
|
|
||||||
return adler | (sum2 << 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initial Adler-32 value (deferred check for len == 1 speed) */
|
|
||||||
if (buf == Z_NULL)
|
|
||||||
return 1L;
|
|
||||||
|
|
||||||
/* in case short lengths are provided, keep it somewhat fast */
|
|
||||||
if (len < 16) {
|
|
||||||
while (len--) {
|
|
||||||
adler += *buf++;
|
|
||||||
sum2 += adler;
|
|
||||||
}
|
|
||||||
if (adler >= BASE)
|
|
||||||
adler -= BASE;
|
|
||||||
MOD4(sum2); /* only added so many BASE's */
|
|
||||||
return adler | (sum2 << 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* do length NMAX blocks -- requires just one modulo operation */
|
|
||||||
while (len >= NMAX) {
|
|
||||||
len -= NMAX;
|
|
||||||
n = NMAX / 16; /* NMAX is divisible by 16 */
|
|
||||||
do {
|
|
||||||
DO16(buf); /* 16 sums unrolled */
|
|
||||||
buf += 16;
|
|
||||||
} while (--n);
|
|
||||||
MOD(adler);
|
|
||||||
MOD(sum2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* do remaining bytes (less than NMAX, still just one modulo) */
|
|
||||||
if (len) { /* avoid modulos if none remaining */
|
|
||||||
while (len >= 16) {
|
|
||||||
len -= 16;
|
|
||||||
DO16(buf);
|
|
||||||
buf += 16;
|
|
||||||
}
|
|
||||||
while (len--) {
|
|
||||||
adler += *buf++;
|
|
||||||
sum2 += adler;
|
|
||||||
}
|
|
||||||
MOD(adler);
|
|
||||||
MOD(sum2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* return recombined sums */
|
|
||||||
return adler | (sum2 << 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
|
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off_t len2;
|
|
||||||
{
|
|
||||||
unsigned long sum1;
|
|
||||||
unsigned long sum2;
|
|
||||||
unsigned rem;
|
|
||||||
|
|
||||||
/* the derivation of this formula is left as an exercise for the reader */
|
|
||||||
rem = (unsigned)(len2 % BASE);
|
|
||||||
sum1 = adler1 & 0xffff;
|
|
||||||
sum2 = rem * sum1;
|
|
||||||
MOD(sum2);
|
|
||||||
sum1 += (adler2 & 0xffff) + BASE - 1;
|
|
||||||
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
|
|
||||||
if (sum1 > BASE) sum1 -= BASE;
|
|
||||||
if (sum1 > BASE) sum1 -= BASE;
|
|
||||||
if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
|
|
||||||
if (sum2 > BASE) sum2 -= BASE;
|
|
||||||
return sum1 | (sum2 << 16);
|
|
||||||
}
|
|
|
@ -1,79 +0,0 @@
|
||||||
/* compress.c -- compress a memory buffer
|
|
||||||
* Copyright (C) 1995-2003 Jean-loup Gailly.
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* @(#) $Id: compress.c,v 1.1 2006/05/12 21:27:36 spacy51 Exp $ */
|
|
||||||
|
|
||||||
#define ZLIB_INTERNAL
|
|
||||||
#include "zlib.h"
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
Compresses the source buffer into the destination buffer. The level
|
|
||||||
parameter has the same meaning as in deflateInit. sourceLen is the byte
|
|
||||||
length of the source buffer. Upon entry, destLen is the total size of the
|
|
||||||
destination buffer, which must be at least 0.1% larger than sourceLen plus
|
|
||||||
12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
|
|
||||||
|
|
||||||
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
|
||||||
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
|
||||||
Z_STREAM_ERROR if the level parameter is invalid.
|
|
||||||
*/
|
|
||||||
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
|
|
||||||
Bytef *dest;
|
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
int level;
|
|
||||||
{
|
|
||||||
z_stream stream;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
stream.next_in = (Bytef*)source;
|
|
||||||
stream.avail_in = (uInt)sourceLen;
|
|
||||||
#ifdef MAXSEG_64K
|
|
||||||
/* Check for source > 64K on 16-bit machine: */
|
|
||||||
if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
|
|
||||||
#endif
|
|
||||||
stream.next_out = dest;
|
|
||||||
stream.avail_out = (uInt)*destLen;
|
|
||||||
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
|
|
||||||
|
|
||||||
stream.zalloc = (alloc_func)0;
|
|
||||||
stream.zfree = (free_func)0;
|
|
||||||
stream.opaque = (voidpf)0;
|
|
||||||
|
|
||||||
err = deflateInit(&stream, level);
|
|
||||||
if (err != Z_OK) return err;
|
|
||||||
|
|
||||||
err = deflate(&stream, Z_FINISH);
|
|
||||||
if (err != Z_STREAM_END) {
|
|
||||||
deflateEnd(&stream);
|
|
||||||
return err == Z_OK ? Z_BUF_ERROR : err;
|
|
||||||
}
|
|
||||||
*destLen = stream.total_out;
|
|
||||||
|
|
||||||
err = deflateEnd(&stream);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
*/
|
|
||||||
int ZEXPORT compress (dest, destLen, source, sourceLen)
|
|
||||||
Bytef *dest;
|
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
If the default memLevel or windowBits for deflateInit() is changed, then
|
|
||||||
this function needs to be updated.
|
|
||||||
*/
|
|
||||||
uLong ZEXPORT compressBound (sourceLen)
|
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
|
|
||||||
}
|
|
|
@ -1,423 +0,0 @@
|
||||||
/* crc32.c -- compute the CRC-32 of a data stream
|
|
||||||
* Copyright (C) 1995-2005 Mark Adler
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
*
|
|
||||||
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
|
|
||||||
* CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
|
|
||||||
* tables for updating the shift register in one step with three exclusive-ors
|
|
||||||
* instead of four steps with four exclusive-ors. This results in about a
|
|
||||||
* factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* @(#) $Id: crc32.c,v 1.1 2006/05/12 21:27:36 spacy51 Exp $ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
|
|
||||||
protection on the static variables used to control the first-use generation
|
|
||||||
of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should
|
|
||||||
first call get_crc_table() to initialize the tables before allowing more than
|
|
||||||
one thread to use crc32().
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef MAKECRCH
|
|
||||||
# include <stdio.h>
|
|
||||||
# ifndef DYNAMIC_CRC_TABLE
|
|
||||||
# define DYNAMIC_CRC_TABLE
|
|
||||||
# endif /* !DYNAMIC_CRC_TABLE */
|
|
||||||
#endif /* MAKECRCH */
|
|
||||||
|
|
||||||
#include "zutil.h" /* for STDC and FAR definitions */
|
|
||||||
|
|
||||||
#define local static
|
|
||||||
|
|
||||||
/* Find a four-byte integer type for crc32_little() and crc32_big(). */
|
|
||||||
#ifndef NOBYFOUR
|
|
||||||
# ifdef STDC /* need ANSI C limits.h to determine sizes */
|
|
||||||
# include <limits.h>
|
|
||||||
# define BYFOUR
|
|
||||||
# if (UINT_MAX == 0xffffffffUL)
|
|
||||||
typedef unsigned int u4;
|
|
||||||
# else
|
|
||||||
# if (ULONG_MAX == 0xffffffffUL)
|
|
||||||
typedef unsigned long u4;
|
|
||||||
# else
|
|
||||||
# if (USHRT_MAX == 0xffffffffUL)
|
|
||||||
typedef unsigned short u4;
|
|
||||||
# else
|
|
||||||
# undef BYFOUR /* can't find a four-byte integer type! */
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif /* STDC */
|
|
||||||
#endif /* !NOBYFOUR */
|
|
||||||
|
|
||||||
/* Definitions for doing the crc four data bytes at a time. */
|
|
||||||
#ifdef BYFOUR
|
|
||||||
# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
|
|
||||||
(((w)&0xff00)<<8)+(((w)&0xff)<<24))
|
|
||||||
local unsigned long crc32_little OF((unsigned long,
|
|
||||||
const unsigned char FAR *, unsigned));
|
|
||||||
local unsigned long crc32_big OF((unsigned long,
|
|
||||||
const unsigned char FAR *, unsigned));
|
|
||||||
# define TBLS 8
|
|
||||||
#else
|
|
||||||
# define TBLS 1
|
|
||||||
#endif /* BYFOUR */
|
|
||||||
|
|
||||||
/* Local functions for crc concatenation */
|
|
||||||
local unsigned long gf2_matrix_times OF((unsigned long *mat,
|
|
||||||
unsigned long vec));
|
|
||||||
local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
|
|
||||||
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
|
||||||
|
|
||||||
local volatile int crc_table_empty = 1;
|
|
||||||
local unsigned long FAR crc_table[TBLS][256];
|
|
||||||
local void make_crc_table OF((void));
|
|
||||||
#ifdef MAKECRCH
|
|
||||||
local void write_table OF((FILE *, const unsigned long FAR *));
|
|
||||||
#endif /* MAKECRCH */
|
|
||||||
/*
|
|
||||||
Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
|
|
||||||
x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
|
|
||||||
|
|
||||||
Polynomials over GF(2) are represented in binary, one bit per coefficient,
|
|
||||||
with the lowest powers in the most significant bit. Then adding polynomials
|
|
||||||
is just exclusive-or, and multiplying a polynomial by x is a right shift by
|
|
||||||
one. If we call the above polynomial p, and represent a byte as the
|
|
||||||
polynomial q, also with the lowest power in the most significant bit (so the
|
|
||||||
byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
|
|
||||||
where a mod b means the remainder after dividing a by b.
|
|
||||||
|
|
||||||
This calculation is done using the shift-register method of multiplying and
|
|
||||||
taking the remainder. The register is initialized to zero, and for each
|
|
||||||
incoming bit, x^32 is added mod p to the register if the bit is a one (where
|
|
||||||
x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
|
|
||||||
x (which is shifting right by one and adding x^32 mod p if the bit shifted
|
|
||||||
out is a one). We start with the highest power (least significant bit) of
|
|
||||||
q and repeat for all eight bits of q.
|
|
||||||
|
|
||||||
The first table is simply the CRC of all possible eight bit values. This is
|
|
||||||
all the information needed to generate CRCs on data a byte at a time for all
|
|
||||||
combinations of CRC register values and incoming bytes. The remaining tables
|
|
||||||
allow for word-at-a-time CRC calculation for both big-endian and little-
|
|
||||||
endian machines, where a word is four bytes.
|
|
||||||
*/
|
|
||||||
local void make_crc_table()
|
|
||||||
{
|
|
||||||
unsigned long c;
|
|
||||||
int n, k;
|
|
||||||
unsigned long poly; /* polynomial exclusive-or pattern */
|
|
||||||
/* terms of polynomial defining this crc (except x^32): */
|
|
||||||
static volatile int first = 1; /* flag to limit concurrent making */
|
|
||||||
static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
|
|
||||||
|
|
||||||
/* See if another task is already doing this (not thread-safe, but better
|
|
||||||
than nothing -- significantly reduces duration of vulnerability in
|
|
||||||
case the advice about DYNAMIC_CRC_TABLE is ignored) */
|
|
||||||
if (first) {
|
|
||||||
first = 0;
|
|
||||||
|
|
||||||
/* make exclusive-or pattern from polynomial (0xedb88320UL) */
|
|
||||||
poly = 0UL;
|
|
||||||
for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
|
|
||||||
poly |= 1UL << (31 - p[n]);
|
|
||||||
|
|
||||||
/* generate a crc for every 8-bit value */
|
|
||||||
for (n = 0; n < 256; n++) {
|
|
||||||
c = (unsigned long)n;
|
|
||||||
for (k = 0; k < 8; k++)
|
|
||||||
c = c & 1 ? poly ^ (c >> 1) : c >> 1;
|
|
||||||
crc_table[0][n] = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef BYFOUR
|
|
||||||
/* generate crc for each value followed by one, two, and three zeros,
|
|
||||||
and then the byte reversal of those as well as the first table */
|
|
||||||
for (n = 0; n < 256; n++) {
|
|
||||||
c = crc_table[0][n];
|
|
||||||
crc_table[4][n] = REV(c);
|
|
||||||
for (k = 1; k < 4; k++) {
|
|
||||||
c = crc_table[0][c & 0xff] ^ (c >> 8);
|
|
||||||
crc_table[k][n] = c;
|
|
||||||
crc_table[k + 4][n] = REV(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* BYFOUR */
|
|
||||||
|
|
||||||
crc_table_empty = 0;
|
|
||||||
}
|
|
||||||
else { /* not first */
|
|
||||||
/* wait for the other guy to finish (not efficient, but rare) */
|
|
||||||
while (crc_table_empty)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef MAKECRCH
|
|
||||||
/* write out CRC tables to crc32.h */
|
|
||||||
{
|
|
||||||
FILE *out;
|
|
||||||
|
|
||||||
out = fopen("crc32.h", "w");
|
|
||||||
if (out == NULL) return;
|
|
||||||
fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
|
|
||||||
fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
|
|
||||||
fprintf(out, "local const unsigned long FAR ");
|
|
||||||
fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
|
|
||||||
write_table(out, crc_table[0]);
|
|
||||||
# ifdef BYFOUR
|
|
||||||
fprintf(out, "#ifdef BYFOUR\n");
|
|
||||||
for (k = 1; k < 8; k++) {
|
|
||||||
fprintf(out, " },\n {\n");
|
|
||||||
write_table(out, crc_table[k]);
|
|
||||||
}
|
|
||||||
fprintf(out, "#endif\n");
|
|
||||||
# endif /* BYFOUR */
|
|
||||||
fprintf(out, " }\n};\n");
|
|
||||||
fclose(out);
|
|
||||||
}
|
|
||||||
#endif /* MAKECRCH */
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef MAKECRCH
|
|
||||||
local void write_table(out, table)
|
|
||||||
FILE *out;
|
|
||||||
const unsigned long FAR *table;
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
|
|
||||||
for (n = 0; n < 256; n++)
|
|
||||||
fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n],
|
|
||||||
n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
|
|
||||||
}
|
|
||||||
#endif /* MAKECRCH */
|
|
||||||
|
|
||||||
#else /* !DYNAMIC_CRC_TABLE */
|
|
||||||
/* ========================================================================
|
|
||||||
* Tables of CRC-32s of all single-byte values, made by make_crc_table().
|
|
||||||
*/
|
|
||||||
#include "crc32.h"
|
|
||||||
#endif /* DYNAMIC_CRC_TABLE */
|
|
||||||
|
|
||||||
/* =========================================================================
|
|
||||||
* This function can be used by asm versions of crc32()
|
|
||||||
*/
|
|
||||||
const unsigned long FAR * ZEXPORT get_crc_table()
|
|
||||||
{
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
|
||||||
if (crc_table_empty)
|
|
||||||
make_crc_table();
|
|
||||||
#endif /* DYNAMIC_CRC_TABLE */
|
|
||||||
return (const unsigned long FAR *)crc_table;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
|
|
||||||
#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
unsigned long ZEXPORT crc32(crc, buf, len)
|
|
||||||
unsigned long crc;
|
|
||||||
const unsigned char FAR *buf;
|
|
||||||
unsigned len;
|
|
||||||
{
|
|
||||||
if (buf == Z_NULL) return 0UL;
|
|
||||||
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
|
||||||
if (crc_table_empty)
|
|
||||||
make_crc_table();
|
|
||||||
#endif /* DYNAMIC_CRC_TABLE */
|
|
||||||
|
|
||||||
#ifdef BYFOUR
|
|
||||||
if (sizeof(void *) == sizeof(ptrdiff_t)) {
|
|
||||||
u4 endian;
|
|
||||||
|
|
||||||
endian = 1;
|
|
||||||
if (*((unsigned char *)(&endian)))
|
|
||||||
return crc32_little(crc, buf, len);
|
|
||||||
else
|
|
||||||
return crc32_big(crc, buf, len);
|
|
||||||
}
|
|
||||||
#endif /* BYFOUR */
|
|
||||||
crc = crc ^ 0xffffffffUL;
|
|
||||||
while (len >= 8) {
|
|
||||||
DO8;
|
|
||||||
len -= 8;
|
|
||||||
}
|
|
||||||
if (len) do {
|
|
||||||
DO1;
|
|
||||||
} while (--len);
|
|
||||||
return crc ^ 0xffffffffUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef BYFOUR
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
#define DOLIT4 c ^= *buf4++; \
|
|
||||||
c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
|
|
||||||
crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
|
|
||||||
#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
local unsigned long crc32_little(crc, buf, len)
|
|
||||||
unsigned long crc;
|
|
||||||
const unsigned char FAR *buf;
|
|
||||||
unsigned len;
|
|
||||||
{
|
|
||||||
register u4 c;
|
|
||||||
register const u4 FAR *buf4;
|
|
||||||
|
|
||||||
c = (u4)crc;
|
|
||||||
c = ~c;
|
|
||||||
while (len && ((ptrdiff_t)buf & 3)) {
|
|
||||||
c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
|
|
||||||
len--;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf4 = (const u4 FAR *)(const void FAR *)buf;
|
|
||||||
while (len >= 32) {
|
|
||||||
DOLIT32;
|
|
||||||
len -= 32;
|
|
||||||
}
|
|
||||||
while (len >= 4) {
|
|
||||||
DOLIT4;
|
|
||||||
len -= 4;
|
|
||||||
}
|
|
||||||
buf = (const unsigned char FAR *)buf4;
|
|
||||||
|
|
||||||
if (len) do {
|
|
||||||
c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
|
|
||||||
} while (--len);
|
|
||||||
c = ~c;
|
|
||||||
return (unsigned long)c;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
#define DOBIG4 c ^= *++buf4; \
|
|
||||||
c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
|
|
||||||
crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
|
|
||||||
#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
local unsigned long crc32_big(crc, buf, len)
|
|
||||||
unsigned long crc;
|
|
||||||
const unsigned char FAR *buf;
|
|
||||||
unsigned len;
|
|
||||||
{
|
|
||||||
register u4 c;
|
|
||||||
register const u4 FAR *buf4;
|
|
||||||
|
|
||||||
c = REV((u4)crc);
|
|
||||||
c = ~c;
|
|
||||||
while (len && ((ptrdiff_t)buf & 3)) {
|
|
||||||
c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
|
|
||||||
len--;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf4 = (const u4 FAR *)(const void FAR *)buf;
|
|
||||||
buf4--;
|
|
||||||
while (len >= 32) {
|
|
||||||
DOBIG32;
|
|
||||||
len -= 32;
|
|
||||||
}
|
|
||||||
while (len >= 4) {
|
|
||||||
DOBIG4;
|
|
||||||
len -= 4;
|
|
||||||
}
|
|
||||||
buf4++;
|
|
||||||
buf = (const unsigned char FAR *)buf4;
|
|
||||||
|
|
||||||
if (len) do {
|
|
||||||
c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
|
|
||||||
} while (--len);
|
|
||||||
c = ~c;
|
|
||||||
return (unsigned long)(REV(c));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* BYFOUR */
|
|
||||||
|
|
||||||
#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
local unsigned long gf2_matrix_times(mat, vec)
|
|
||||||
unsigned long *mat;
|
|
||||||
unsigned long vec;
|
|
||||||
{
|
|
||||||
unsigned long sum;
|
|
||||||
|
|
||||||
sum = 0;
|
|
||||||
while (vec) {
|
|
||||||
if (vec & 1)
|
|
||||||
sum ^= *mat;
|
|
||||||
vec >>= 1;
|
|
||||||
mat++;
|
|
||||||
}
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
local void gf2_matrix_square(square, mat)
|
|
||||||
unsigned long *square;
|
|
||||||
unsigned long *mat;
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
|
|
||||||
for (n = 0; n < GF2_DIM; n++)
|
|
||||||
square[n] = gf2_matrix_times(mat, mat[n]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
uLong ZEXPORT crc32_combine(crc1, crc2, len2)
|
|
||||||
uLong crc1;
|
|
||||||
uLong crc2;
|
|
||||||
z_off_t len2;
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
unsigned long row;
|
|
||||||
unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
|
|
||||||
unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
|
|
||||||
|
|
||||||
/* degenerate case */
|
|
||||||
if (len2 == 0)
|
|
||||||
return crc1;
|
|
||||||
|
|
||||||
/* put operator for one zero bit in odd */
|
|
||||||
odd[0] = 0xedb88320L; /* CRC-32 polynomial */
|
|
||||||
row = 1;
|
|
||||||
for (n = 1; n < GF2_DIM; n++) {
|
|
||||||
odd[n] = row;
|
|
||||||
row <<= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* put operator for two zero bits in even */
|
|
||||||
gf2_matrix_square(even, odd);
|
|
||||||
|
|
||||||
/* put operator for four zero bits in odd */
|
|
||||||
gf2_matrix_square(odd, even);
|
|
||||||
|
|
||||||
/* apply len2 zeros to crc1 (first square will put the operator for one
|
|
||||||
zero byte, eight zero bits, in even) */
|
|
||||||
do {
|
|
||||||
/* apply zeros operator for this bit of len2 */
|
|
||||||
gf2_matrix_square(even, odd);
|
|
||||||
if (len2 & 1)
|
|
||||||
crc1 = gf2_matrix_times(even, crc1);
|
|
||||||
len2 >>= 1;
|
|
||||||
|
|
||||||
/* if no more bits set, then done */
|
|
||||||
if (len2 == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* another iteration of the loop with odd and even swapped */
|
|
||||||
gf2_matrix_square(odd, even);
|
|
||||||
if (len2 & 1)
|
|
||||||
crc1 = gf2_matrix_times(odd, crc1);
|
|
||||||
len2 >>= 1;
|
|
||||||
|
|
||||||
/* if no more bits set, then done */
|
|
||||||
} while (len2 != 0);
|
|
||||||
|
|
||||||
/* return combined crc */
|
|
||||||
crc1 ^= crc2;
|
|
||||||
return crc1;
|
|
||||||
}
|
|
|
@ -1,441 +0,0 @@
|
||||||
/* crc32.h -- tables for rapid CRC calculation
|
|
||||||
* Generated automatically by crc32.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
local const unsigned long FAR crc_table[TBLS][256] =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
|
|
||||||
0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
|
|
||||||
0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
|
|
||||||
0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
|
|
||||||
0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
|
|
||||||
0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
|
|
||||||
0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
|
|
||||||
0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
|
|
||||||
0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
|
|
||||||
0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
|
|
||||||
0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
|
|
||||||
0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
|
|
||||||
0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
|
|
||||||
0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
|
|
||||||
0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
|
|
||||||
0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
|
|
||||||
0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
|
|
||||||
0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
|
|
||||||
0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
|
|
||||||
0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
|
|
||||||
0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
|
|
||||||
0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
|
|
||||||
0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
|
|
||||||
0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
|
|
||||||
0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
|
|
||||||
0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
|
|
||||||
0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
|
|
||||||
0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
|
|
||||||
0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
|
|
||||||
0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
|
|
||||||
0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
|
|
||||||
0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
|
|
||||||
0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
|
|
||||||
0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
|
|
||||||
0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
|
|
||||||
0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
|
|
||||||
0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
|
|
||||||
0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
|
|
||||||
0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
|
|
||||||
0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
|
|
||||||
0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
|
|
||||||
0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
|
|
||||||
0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
|
|
||||||
0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
|
|
||||||
0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
|
|
||||||
0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
|
|
||||||
0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
|
|
||||||
0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
|
|
||||||
0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
|
|
||||||
0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
|
|
||||||
0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
|
|
||||||
0x2d02ef8dUL
|
|
||||||
#ifdef BYFOUR
|
|
||||||
},
|
|
||||||
{
|
|
||||||
0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
|
|
||||||
0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
|
|
||||||
0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
|
|
||||||
0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
|
|
||||||
0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
|
|
||||||
0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
|
|
||||||
0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
|
|
||||||
0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
|
|
||||||
0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
|
|
||||||
0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
|
|
||||||
0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
|
|
||||||
0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
|
|
||||||
0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
|
|
||||||
0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
|
|
||||||
0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
|
|
||||||
0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
|
|
||||||
0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
|
|
||||||
0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
|
|
||||||
0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
|
|
||||||
0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
|
|
||||||
0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
|
|
||||||
0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
|
|
||||||
0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
|
|
||||||
0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
|
|
||||||
0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
|
|
||||||
0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
|
|
||||||
0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
|
|
||||||
0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
|
|
||||||
0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
|
|
||||||
0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
|
|
||||||
0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
|
|
||||||
0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
|
|
||||||
0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
|
|
||||||
0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
|
|
||||||
0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
|
|
||||||
0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
|
|
||||||
0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
|
|
||||||
0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
|
|
||||||
0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
|
|
||||||
0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
|
|
||||||
0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
|
|
||||||
0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
|
|
||||||
0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
|
|
||||||
0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
|
|
||||||
0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
|
|
||||||
0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
|
|
||||||
0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
|
|
||||||
0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
|
|
||||||
0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
|
|
||||||
0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
|
|
||||||
0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
|
|
||||||
0x9324fd72UL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
|
|
||||||
0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
|
|
||||||
0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
|
|
||||||
0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
|
|
||||||
0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
|
|
||||||
0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
|
|
||||||
0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
|
|
||||||
0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
|
|
||||||
0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
|
|
||||||
0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
|
|
||||||
0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
|
|
||||||
0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
|
|
||||||
0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
|
|
||||||
0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
|
|
||||||
0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
|
|
||||||
0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
|
|
||||||
0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
|
|
||||||
0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
|
|
||||||
0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
|
|
||||||
0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
|
|
||||||
0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
|
|
||||||
0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
|
|
||||||
0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
|
|
||||||
0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
|
|
||||||
0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
|
|
||||||
0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
|
|
||||||
0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
|
|
||||||
0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
|
|
||||||
0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
|
|
||||||
0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
|
|
||||||
0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
|
|
||||||
0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
|
|
||||||
0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
|
|
||||||
0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
|
|
||||||
0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
|
|
||||||
0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
|
|
||||||
0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
|
|
||||||
0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
|
|
||||||
0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
|
|
||||||
0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
|
|
||||||
0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
|
|
||||||
0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
|
|
||||||
0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
|
|
||||||
0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
|
|
||||||
0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
|
|
||||||
0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
|
|
||||||
0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
|
|
||||||
0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
|
|
||||||
0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
|
|
||||||
0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
|
|
||||||
0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
|
|
||||||
0xbe9834edUL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
|
|
||||||
0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
|
|
||||||
0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
|
|
||||||
0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
|
|
||||||
0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
|
|
||||||
0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
|
|
||||||
0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
|
|
||||||
0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
|
|
||||||
0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
|
|
||||||
0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
|
|
||||||
0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
|
|
||||||
0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
|
|
||||||
0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
|
|
||||||
0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
|
|
||||||
0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
|
|
||||||
0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
|
|
||||||
0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
|
|
||||||
0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
|
|
||||||
0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
|
|
||||||
0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
|
|
||||||
0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
|
|
||||||
0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
|
|
||||||
0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
|
|
||||||
0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
|
|
||||||
0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
|
|
||||||
0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
|
|
||||||
0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
|
|
||||||
0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
|
|
||||||
0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
|
|
||||||
0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
|
|
||||||
0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
|
|
||||||
0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
|
|
||||||
0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
|
|
||||||
0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
|
|
||||||
0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
|
|
||||||
0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
|
|
||||||
0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
|
|
||||||
0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
|
|
||||||
0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
|
|
||||||
0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
|
|
||||||
0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
|
|
||||||
0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
|
|
||||||
0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
|
|
||||||
0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
|
|
||||||
0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
|
|
||||||
0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
|
|
||||||
0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
|
|
||||||
0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
|
|
||||||
0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
|
|
||||||
0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
|
|
||||||
0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
|
|
||||||
0xde0506f1UL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
|
|
||||||
0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
|
|
||||||
0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
|
|
||||||
0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
|
|
||||||
0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
|
|
||||||
0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
|
|
||||||
0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
|
|
||||||
0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
|
|
||||||
0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
|
|
||||||
0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
|
|
||||||
0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
|
|
||||||
0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
|
|
||||||
0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
|
|
||||||
0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
|
|
||||||
0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
|
|
||||||
0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
|
|
||||||
0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
|
|
||||||
0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
|
|
||||||
0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
|
|
||||||
0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
|
|
||||||
0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
|
|
||||||
0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
|
|
||||||
0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
|
|
||||||
0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
|
|
||||||
0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
|
|
||||||
0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
|
|
||||||
0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
|
|
||||||
0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
|
|
||||||
0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
|
|
||||||
0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
|
|
||||||
0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
|
|
||||||
0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
|
|
||||||
0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
|
|
||||||
0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
|
|
||||||
0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
|
|
||||||
0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
|
|
||||||
0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
|
|
||||||
0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
|
|
||||||
0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
|
|
||||||
0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
|
|
||||||
0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
|
|
||||||
0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
|
|
||||||
0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
|
|
||||||
0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
|
|
||||||
0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
|
|
||||||
0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
|
|
||||||
0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
|
|
||||||
0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
|
|
||||||
0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
|
|
||||||
0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
|
|
||||||
0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
|
|
||||||
0x8def022dUL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
|
|
||||||
0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
|
|
||||||
0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
|
|
||||||
0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
|
|
||||||
0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
|
|
||||||
0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
|
|
||||||
0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
|
|
||||||
0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
|
|
||||||
0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
|
|
||||||
0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
|
|
||||||
0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
|
|
||||||
0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
|
|
||||||
0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
|
|
||||||
0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
|
|
||||||
0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
|
|
||||||
0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
|
|
||||||
0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
|
|
||||||
0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
|
|
||||||
0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
|
|
||||||
0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
|
|
||||||
0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
|
|
||||||
0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
|
|
||||||
0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
|
|
||||||
0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
|
|
||||||
0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
|
|
||||||
0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
|
|
||||||
0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
|
|
||||||
0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
|
|
||||||
0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
|
|
||||||
0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
|
|
||||||
0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
|
|
||||||
0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
|
|
||||||
0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
|
|
||||||
0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
|
|
||||||
0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
|
|
||||||
0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
|
|
||||||
0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
|
|
||||||
0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
|
|
||||||
0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
|
|
||||||
0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
|
|
||||||
0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
|
|
||||||
0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
|
|
||||||
0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
|
|
||||||
0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
|
|
||||||
0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
|
|
||||||
0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
|
|
||||||
0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
|
|
||||||
0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
|
|
||||||
0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
|
|
||||||
0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
|
|
||||||
0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
|
|
||||||
0x72fd2493UL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
|
|
||||||
0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
|
|
||||||
0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
|
|
||||||
0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
|
|
||||||
0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
|
|
||||||
0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
|
|
||||||
0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
|
|
||||||
0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
|
|
||||||
0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
|
|
||||||
0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
|
|
||||||
0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
|
|
||||||
0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
|
|
||||||
0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
|
|
||||||
0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
|
|
||||||
0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
|
|
||||||
0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
|
|
||||||
0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
|
|
||||||
0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
|
|
||||||
0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
|
|
||||||
0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
|
|
||||||
0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
|
|
||||||
0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
|
|
||||||
0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
|
|
||||||
0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
|
|
||||||
0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
|
|
||||||
0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
|
|
||||||
0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
|
|
||||||
0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
|
|
||||||
0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
|
|
||||||
0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
|
|
||||||
0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
|
|
||||||
0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
|
|
||||||
0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
|
|
||||||
0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
|
|
||||||
0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
|
|
||||||
0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
|
|
||||||
0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
|
|
||||||
0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
|
|
||||||
0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
|
|
||||||
0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
|
|
||||||
0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
|
|
||||||
0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
|
|
||||||
0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
|
|
||||||
0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
|
|
||||||
0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
|
|
||||||
0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
|
|
||||||
0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
|
|
||||||
0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
|
|
||||||
0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
|
|
||||||
0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
|
|
||||||
0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
|
|
||||||
0xed3498beUL
|
|
||||||
},
|
|
||||||
{
|
|
||||||
0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
|
|
||||||
0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
|
|
||||||
0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
|
|
||||||
0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
|
|
||||||
0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
|
|
||||||
0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
|
|
||||||
0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
|
|
||||||
0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
|
|
||||||
0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
|
|
||||||
0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
|
|
||||||
0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
|
|
||||||
0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
|
|
||||||
0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
|
|
||||||
0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
|
|
||||||
0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
|
|
||||||
0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
|
|
||||||
0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
|
|
||||||
0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
|
|
||||||
0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
|
|
||||||
0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
|
|
||||||
0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
|
|
||||||
0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
|
|
||||||
0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
|
|
||||||
0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
|
|
||||||
0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
|
|
||||||
0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
|
|
||||||
0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
|
|
||||||
0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
|
|
||||||
0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
|
|
||||||
0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
|
|
||||||
0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
|
|
||||||
0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
|
|
||||||
0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
|
|
||||||
0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
|
|
||||||
0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
|
|
||||||
0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
|
|
||||||
0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
|
|
||||||
0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
|
|
||||||
0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
|
|
||||||
0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
|
|
||||||
0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
|
|
||||||
0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
|
|
||||||
0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
|
|
||||||
0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
|
|
||||||
0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
|
|
||||||
0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
|
|
||||||
0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
|
|
||||||
0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
|
|
||||||
0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
|
|
||||||
0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
|
|
||||||
0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
|
|
||||||
0xf10605deUL
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
};
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,331 +0,0 @@
|
||||||
/* deflate.h -- internal compression state
|
|
||||||
* Copyright (C) 1995-2004 Jean-loup Gailly
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WARNING: this file should *not* be used by applications. It is
|
|
||||||
part of the implementation of the compression library and is
|
|
||||||
subject to change. Applications should only use zlib.h.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* @(#) $Id: deflate.h,v 1.1 2006/05/12 21:27:36 spacy51 Exp $ */
|
|
||||||
|
|
||||||
#ifndef DEFLATE_H
|
|
||||||
#define DEFLATE_H
|
|
||||||
|
|
||||||
#include "zutil.h"
|
|
||||||
|
|
||||||
/* define NO_GZIP when compiling if you want to disable gzip header and
|
|
||||||
trailer creation by deflate(). NO_GZIP would be used to avoid linking in
|
|
||||||
the crc code when it is not needed. For shared libraries, gzip encoding
|
|
||||||
should be left enabled. */
|
|
||||||
#ifndef NO_GZIP
|
|
||||||
# define GZIP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
* Internal compression state.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define LENGTH_CODES 29
|
|
||||||
/* number of length codes, not counting the special END_BLOCK code */
|
|
||||||
|
|
||||||
#define LITERALS 256
|
|
||||||
/* number of literal bytes 0..255 */
|
|
||||||
|
|
||||||
#define L_CODES (LITERALS+1+LENGTH_CODES)
|
|
||||||
/* number of Literal or Length codes, including the END_BLOCK code */
|
|
||||||
|
|
||||||
#define D_CODES 30
|
|
||||||
/* number of distance codes */
|
|
||||||
|
|
||||||
#define BL_CODES 19
|
|
||||||
/* number of codes used to transfer the bit lengths */
|
|
||||||
|
|
||||||
#define HEAP_SIZE (2*L_CODES+1)
|
|
||||||
/* maximum heap size */
|
|
||||||
|
|
||||||
#define MAX_BITS 15
|
|
||||||
/* All codes must not exceed MAX_BITS bits */
|
|
||||||
|
|
||||||
#define INIT_STATE 42
|
|
||||||
#define EXTRA_STATE 69
|
|
||||||
#define NAME_STATE 73
|
|
||||||
#define COMMENT_STATE 91
|
|
||||||
#define HCRC_STATE 103
|
|
||||||
#define BUSY_STATE 113
|
|
||||||
#define FINISH_STATE 666
|
|
||||||
/* Stream status */
|
|
||||||
|
|
||||||
|
|
||||||
/* Data structure describing a single value and its code string. */
|
|
||||||
typedef struct ct_data_s {
|
|
||||||
union {
|
|
||||||
ush freq; /* frequency count */
|
|
||||||
ush code; /* bit string */
|
|
||||||
} fc;
|
|
||||||
union {
|
|
||||||
ush dad; /* father node in Huffman tree */
|
|
||||||
ush len; /* length of bit string */
|
|
||||||
} dl;
|
|
||||||
} FAR ct_data;
|
|
||||||
|
|
||||||
#define Freq fc.freq
|
|
||||||
#define Code fc.code
|
|
||||||
#define Dad dl.dad
|
|
||||||
#define Len dl.len
|
|
||||||
|
|
||||||
typedef struct static_tree_desc_s static_tree_desc;
|
|
||||||
|
|
||||||
typedef struct tree_desc_s {
|
|
||||||
ct_data *dyn_tree; /* the dynamic tree */
|
|
||||||
int max_code; /* largest code with non zero frequency */
|
|
||||||
static_tree_desc *stat_desc; /* the corresponding static tree */
|
|
||||||
} FAR tree_desc;
|
|
||||||
|
|
||||||
typedef ush Pos;
|
|
||||||
typedef Pos FAR Posf;
|
|
||||||
typedef unsigned IPos;
|
|
||||||
|
|
||||||
/* A Pos is an index in the character window. We use short instead of int to
|
|
||||||
* save space in the various tables. IPos is used only for parameter passing.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct internal_state {
|
|
||||||
z_streamp strm; /* pointer back to this zlib stream */
|
|
||||||
int status; /* as the name implies */
|
|
||||||
Bytef *pending_buf; /* output still pending */
|
|
||||||
ulg pending_buf_size; /* size of pending_buf */
|
|
||||||
Bytef *pending_out; /* next pending byte to output to the stream */
|
|
||||||
uInt pending; /* nb of bytes in the pending buffer */
|
|
||||||
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
|
|
||||||
gz_headerp gzhead; /* gzip header information to write */
|
|
||||||
uInt gzindex; /* where in extra, name, or comment */
|
|
||||||
Byte method; /* STORED (for zip only) or DEFLATED */
|
|
||||||
int last_flush; /* value of flush param for previous deflate call */
|
|
||||||
|
|
||||||
/* used by deflate.c: */
|
|
||||||
|
|
||||||
uInt w_size; /* LZ77 window size (32K by default) */
|
|
||||||
uInt w_bits; /* log2(w_size) (8..16) */
|
|
||||||
uInt w_mask; /* w_size - 1 */
|
|
||||||
|
|
||||||
Bytef *window;
|
|
||||||
/* Sliding window. Input bytes are read into the second half of the window,
|
|
||||||
* and move to the first half later to keep a dictionary of at least wSize
|
|
||||||
* bytes. With this organization, matches are limited to a distance of
|
|
||||||
* wSize-MAX_MATCH bytes, but this ensures that IO is always
|
|
||||||
* performed with a length multiple of the block size. Also, it limits
|
|
||||||
* the window size to 64K, which is quite useful on MSDOS.
|
|
||||||
* To do: use the user input buffer as sliding window.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ulg window_size;
|
|
||||||
/* Actual size of window: 2*wSize, except when the user input buffer
|
|
||||||
* is directly used as sliding window.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Posf *prev;
|
|
||||||
/* Link to older string with same hash index. To limit the size of this
|
|
||||||
* array to 64K, this link is maintained only for the last 32K strings.
|
|
||||||
* An index in this array is thus a window index modulo 32K.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Posf *head; /* Heads of the hash chains or NIL. */
|
|
||||||
|
|
||||||
uInt ins_h; /* hash index of string to be inserted */
|
|
||||||
uInt hash_size; /* number of elements in hash table */
|
|
||||||
uInt hash_bits; /* log2(hash_size) */
|
|
||||||
uInt hash_mask; /* hash_size-1 */
|
|
||||||
|
|
||||||
uInt hash_shift;
|
|
||||||
/* Number of bits by which ins_h must be shifted at each input
|
|
||||||
* step. It must be such that after MIN_MATCH steps, the oldest
|
|
||||||
* byte no longer takes part in the hash key, that is:
|
|
||||||
* hash_shift * MIN_MATCH >= hash_bits
|
|
||||||
*/
|
|
||||||
|
|
||||||
long block_start;
|
|
||||||
/* Window position at the beginning of the current output block. Gets
|
|
||||||
* negative when the window is moved backwards.
|
|
||||||
*/
|
|
||||||
|
|
||||||
uInt match_length; /* length of best match */
|
|
||||||
IPos prev_match; /* previous match */
|
|
||||||
int match_available; /* set if previous match exists */
|
|
||||||
uInt strstart; /* start of string to insert */
|
|
||||||
uInt match_start; /* start of matching string */
|
|
||||||
uInt lookahead; /* number of valid bytes ahead in window */
|
|
||||||
|
|
||||||
uInt prev_length;
|
|
||||||
/* Length of the best match at previous step. Matches not greater than this
|
|
||||||
* are discarded. This is used in the lazy match evaluation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
uInt max_chain_length;
|
|
||||||
/* To speed up deflation, hash chains are never searched beyond this
|
|
||||||
* length. A higher limit improves compression ratio but degrades the
|
|
||||||
* speed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
uInt max_lazy_match;
|
|
||||||
/* Attempt to find a better match only when the current match is strictly
|
|
||||||
* smaller than this value. This mechanism is used only for compression
|
|
||||||
* levels >= 4.
|
|
||||||
*/
|
|
||||||
# define max_insert_length max_lazy_match
|
|
||||||
/* Insert new strings in the hash table only if the match length is not
|
|
||||||
* greater than this length. This saves time but degrades compression.
|
|
||||||
* max_insert_length is used only for compression levels <= 3.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int level; /* compression level (1..9) */
|
|
||||||
int strategy; /* favor or force Huffman coding*/
|
|
||||||
|
|
||||||
uInt good_match;
|
|
||||||
/* Use a faster search when the previous match is longer than this */
|
|
||||||
|
|
||||||
int nice_match; /* Stop searching when current match exceeds this */
|
|
||||||
|
|
||||||
/* used by trees.c: */
|
|
||||||
/* Didn't use ct_data typedef below to supress compiler warning */
|
|
||||||
struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
|
|
||||||
struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
|
|
||||||
struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
|
|
||||||
|
|
||||||
struct tree_desc_s l_desc; /* desc. for literal tree */
|
|
||||||
struct tree_desc_s d_desc; /* desc. for distance tree */
|
|
||||||
struct tree_desc_s bl_desc; /* desc. for bit length tree */
|
|
||||||
|
|
||||||
ush bl_count[MAX_BITS+1];
|
|
||||||
/* number of codes at each bit length for an optimal tree */
|
|
||||||
|
|
||||||
int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
|
|
||||||
int heap_len; /* number of elements in the heap */
|
|
||||||
int heap_max; /* element of largest frequency */
|
|
||||||
/* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
|
|
||||||
* The same heap array is used to build all trees.
|
|
||||||
*/
|
|
||||||
|
|
||||||
uch depth[2*L_CODES+1];
|
|
||||||
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
|
||||||
*/
|
|
||||||
|
|
||||||
uchf *l_buf; /* buffer for literals or lengths */
|
|
||||||
|
|
||||||
uInt lit_bufsize;
|
|
||||||
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
|
||||||
* limiting lit_bufsize to 64K:
|
|
||||||
* - frequencies can be kept in 16 bit counters
|
|
||||||
* - if compression is not successful for the first block, all input
|
|
||||||
* data is still in the window so we can still emit a stored block even
|
|
||||||
* when input comes from standard input. (This can also be done for
|
|
||||||
* all blocks if lit_bufsize is not greater than 32K.)
|
|
||||||
* - if compression is not successful for a file smaller than 64K, we can
|
|
||||||
* even emit a stored file instead of a stored block (saving 5 bytes).
|
|
||||||
* This is applicable only for zip (not gzip or zlib).
|
|
||||||
* - creating new Huffman trees less frequently may not provide fast
|
|
||||||
* adaptation to changes in the input data statistics. (Take for
|
|
||||||
* example a binary file with poorly compressible code followed by
|
|
||||||
* a highly compressible string table.) Smaller buffer sizes give
|
|
||||||
* fast adaptation but have of course the overhead of transmitting
|
|
||||||
* trees more frequently.
|
|
||||||
* - I can't count above 4
|
|
||||||
*/
|
|
||||||
|
|
||||||
uInt last_lit; /* running index in l_buf */
|
|
||||||
|
|
||||||
ushf *d_buf;
|
|
||||||
/* Buffer for distances. To simplify the code, d_buf and l_buf have
|
|
||||||
* the same number of elements. To use different lengths, an extra flag
|
|
||||||
* array would be necessary.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ulg opt_len; /* bit length of current block with optimal trees */
|
|
||||||
ulg static_len; /* bit length of current block with static trees */
|
|
||||||
uInt matches; /* number of string matches in current block */
|
|
||||||
int last_eob_len; /* bit length of EOB code for last block */
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
ulg compressed_len; /* total bit length of compressed file mod 2^32 */
|
|
||||||
ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ush bi_buf;
|
|
||||||
/* Output buffer. bits are inserted starting at the bottom (least
|
|
||||||
* significant bits).
|
|
||||||
*/
|
|
||||||
int bi_valid;
|
|
||||||
/* Number of valid bits in bi_buf. All bits above the last valid bit
|
|
||||||
* are always zero.
|
|
||||||
*/
|
|
||||||
|
|
||||||
} FAR deflate_state;
|
|
||||||
|
|
||||||
/* Output a byte on the stream.
|
|
||||||
* IN assertion: there is enough room in pending_buf.
|
|
||||||
*/
|
|
||||||
#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
|
|
||||||
|
|
||||||
|
|
||||||
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
|
|
||||||
/* Minimum amount of lookahead, except at the end of the input file.
|
|
||||||
* See deflate.c for comments about the MIN_MATCH+1.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
|
|
||||||
/* In order to simplify the code, particularly on 16 bit machines, match
|
|
||||||
* distances are limited to MAX_DIST instead of WSIZE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* in trees.c */
|
|
||||||
void _tr_init OF((deflate_state *s));
|
|
||||||
int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
|
|
||||||
void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
|
||||||
int eof));
|
|
||||||
void _tr_align OF((deflate_state *s));
|
|
||||||
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
|
||||||
int eof));
|
|
||||||
|
|
||||||
#define d_code(dist) \
|
|
||||||
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
|
||||||
/* Mapping from a distance to a distance code. dist is the distance - 1 and
|
|
||||||
* must not have side effects. _dist_code[256] and _dist_code[257] are never
|
|
||||||
* used.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef DEBUG
|
|
||||||
/* Inline versions of _tr_tally for speed: */
|
|
||||||
|
|
||||||
#if defined(GEN_TREES_H) || !defined(STDC)
|
|
||||||
extern uch _length_code[];
|
|
||||||
extern uch _dist_code[];
|
|
||||||
#else
|
|
||||||
extern const uch _length_code[];
|
|
||||||
extern const uch _dist_code[];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# define _tr_tally_lit(s, c, flush) \
|
|
||||||
{ uch cc = (c); \
|
|
||||||
s->d_buf[s->last_lit] = 0; \
|
|
||||||
s->l_buf[s->last_lit++] = cc; \
|
|
||||||
s->dyn_ltree[cc].Freq++; \
|
|
||||||
flush = (s->last_lit == s->lit_bufsize-1); \
|
|
||||||
}
|
|
||||||
# define _tr_tally_dist(s, distance, length, flush) \
|
|
||||||
{ uch len = (length); \
|
|
||||||
ush dist = (distance); \
|
|
||||||
s->d_buf[s->last_lit] = dist; \
|
|
||||||
s->l_buf[s->last_lit++] = len; \
|
|
||||||
dist--; \
|
|
||||||
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
|
|
||||||
s->dyn_dtree[d_code(dist)].Freq++; \
|
|
||||||
flush = (s->last_lit == s->lit_bufsize-1); \
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
|
||||||
# define _tr_tally_dist(s, distance, length, flush) \
|
|
||||||
flush = _tr_tally(s, distance, length)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* DEFLATE_H */
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,623 +0,0 @@
|
||||||
/* infback.c -- inflate using a call-back interface
|
|
||||||
* Copyright (C) 1995-2005 Mark Adler
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
This code is largely copied from inflate.c. Normally either infback.o or
|
|
||||||
inflate.o would be linked into an application--not both. The interface
|
|
||||||
with inffast.c is retained so that optimized assembler-coded versions of
|
|
||||||
inflate_fast() can be used with either inflate.c or infback.c.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "zutil.h"
|
|
||||||
#include "inftrees.h"
|
|
||||||
#include "inflate.h"
|
|
||||||
#include "inffast.h"
|
|
||||||
|
|
||||||
/* function prototypes */
|
|
||||||
local void fixedtables OF((struct inflate_state FAR *state));
|
|
||||||
|
|
||||||
/*
|
|
||||||
strm provides memory allocation functions in zalloc and zfree, or
|
|
||||||
Z_NULL to use the library memory allocation functions.
|
|
||||||
|
|
||||||
windowBits is in the range 8..15, and window is a user-supplied
|
|
||||||
window and output buffer that is 2**windowBits bytes.
|
|
||||||
*/
|
|
||||||
int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
|
|
||||||
z_streamp strm;
|
|
||||||
int windowBits;
|
|
||||||
unsigned char FAR *window;
|
|
||||||
const char *version;
|
|
||||||
int stream_size;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
|
||||||
|
|
||||||
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
|
||||||
stream_size != (int)(sizeof(z_stream)))
|
|
||||||
return Z_VERSION_ERROR;
|
|
||||||
if (strm == Z_NULL || window == Z_NULL ||
|
|
||||||
windowBits < 8 || windowBits > 15)
|
|
||||||
return Z_STREAM_ERROR;
|
|
||||||
strm->msg = Z_NULL; /* in case we return an error */
|
|
||||||
if (strm->zalloc == (alloc_func)0) {
|
|
||||||
strm->zalloc = zcalloc;
|
|
||||||
strm->opaque = (voidpf)0;
|
|
||||||
}
|
|
||||||
if (strm->zfree == (free_func)0) strm->zfree = zcfree;
|
|
||||||
state = (struct inflate_state FAR *)ZALLOC(strm, 1,
|
|
||||||
sizeof(struct inflate_state));
|
|
||||||
if (state == Z_NULL) return Z_MEM_ERROR;
|
|
||||||
Tracev((stderr, "inflate: allocated\n"));
|
|
||||||
strm->state = (struct internal_state FAR *)state;
|
|
||||||
state->dmax = 32768U;
|
|
||||||
state->wbits = windowBits;
|
|
||||||
state->wsize = 1U << windowBits;
|
|
||||||
state->window = window;
|
|
||||||
state->write = 0;
|
|
||||||
state->whave = 0;
|
|
||||||
return Z_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return state with length and distance decoding tables and index sizes set to
|
|
||||||
fixed code decoding. Normally this returns fixed tables from inffixed.h.
|
|
||||||
If BUILDFIXED is defined, then instead this routine builds the tables the
|
|
||||||
first time it's called, and returns those tables the first time and
|
|
||||||
thereafter. This reduces the size of the code by about 2K bytes, in
|
|
||||||
exchange for a little execution time. However, BUILDFIXED should not be
|
|
||||||
used for threaded applications, since the rewriting of the tables and virgin
|
|
||||||
may not be thread-safe.
|
|
||||||
*/
|
|
||||||
local void fixedtables(state)
|
|
||||||
struct inflate_state FAR *state;
|
|
||||||
{
|
|
||||||
#ifdef BUILDFIXED
|
|
||||||
static int virgin = 1;
|
|
||||||
static code *lenfix, *distfix;
|
|
||||||
static code fixed[544];
|
|
||||||
|
|
||||||
/* build fixed huffman tables if first call (may not be thread safe) */
|
|
||||||
if (virgin) {
|
|
||||||
unsigned sym, bits;
|
|
||||||
static code *next;
|
|
||||||
|
|
||||||
/* literal/length table */
|
|
||||||
sym = 0;
|
|
||||||
while (sym < 144) state->lens[sym++] = 8;
|
|
||||||
while (sym < 256) state->lens[sym++] = 9;
|
|
||||||
while (sym < 280) state->lens[sym++] = 7;
|
|
||||||
while (sym < 288) state->lens[sym++] = 8;
|
|
||||||
next = fixed;
|
|
||||||
lenfix = next;
|
|
||||||
bits = 9;
|
|
||||||
inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
|
|
||||||
|
|
||||||
/* distance table */
|
|
||||||
sym = 0;
|
|
||||||
while (sym < 32) state->lens[sym++] = 5;
|
|
||||||
distfix = next;
|
|
||||||
bits = 5;
|
|
||||||
inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
|
|
||||||
|
|
||||||
/* do this just once */
|
|
||||||
virgin = 0;
|
|
||||||
}
|
|
||||||
#else /* !BUILDFIXED */
|
|
||||||
# include "inffixed.h"
|
|
||||||
#endif /* BUILDFIXED */
|
|
||||||
state->lencode = lenfix;
|
|
||||||
state->lenbits = 9;
|
|
||||||
state->distcode = distfix;
|
|
||||||
state->distbits = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Macros for inflateBack(): */
|
|
||||||
|
|
||||||
/* Load returned state from inflate_fast() */
|
|
||||||
#define LOAD() \
|
|
||||||
do { \
|
|
||||||
put = strm->next_out; \
|
|
||||||
left = strm->avail_out; \
|
|
||||||
next = strm->next_in; \
|
|
||||||
have = strm->avail_in; \
|
|
||||||
hold = state->hold; \
|
|
||||||
bits = state->bits; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* Set state from registers for inflate_fast() */
|
|
||||||
#define RESTORE() \
|
|
||||||
do { \
|
|
||||||
strm->next_out = put; \
|
|
||||||
strm->avail_out = left; \
|
|
||||||
strm->next_in = next; \
|
|
||||||
strm->avail_in = have; \
|
|
||||||
state->hold = hold; \
|
|
||||||
state->bits = bits; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* Clear the input bit accumulator */
|
|
||||||
#define INITBITS() \
|
|
||||||
do { \
|
|
||||||
hold = 0; \
|
|
||||||
bits = 0; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* Assure that some input is available. If input is requested, but denied,
|
|
||||||
then return a Z_BUF_ERROR from inflateBack(). */
|
|
||||||
#define PULL() \
|
|
||||||
do { \
|
|
||||||
if (have == 0) { \
|
|
||||||
have = in(in_desc, &next); \
|
|
||||||
if (have == 0) { \
|
|
||||||
next = Z_NULL; \
|
|
||||||
ret = Z_BUF_ERROR; \
|
|
||||||
goto inf_leave; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* Get a byte of input into the bit accumulator, or return from inflateBack()
|
|
||||||
with an error if there is no input available. */
|
|
||||||
#define PULLBYTE() \
|
|
||||||
do { \
|
|
||||||
PULL(); \
|
|
||||||
have--; \
|
|
||||||
hold += (unsigned long)(*next++) << bits; \
|
|
||||||
bits += 8; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* Assure that there are at least n bits in the bit accumulator. If there is
|
|
||||||
not enough available input to do that, then return from inflateBack() with
|
|
||||||
an error. */
|
|
||||||
#define NEEDBITS(n) \
|
|
||||||
do { \
|
|
||||||
while (bits < (unsigned)(n)) \
|
|
||||||
PULLBYTE(); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* Return the low n bits of the bit accumulator (n < 16) */
|
|
||||||
#define BITS(n) \
|
|
||||||
((unsigned)hold & ((1U << (n)) - 1))
|
|
||||||
|
|
||||||
/* Remove n bits from the bit accumulator */
|
|
||||||
#define DROPBITS(n) \
|
|
||||||
do { \
|
|
||||||
hold >>= (n); \
|
|
||||||
bits -= (unsigned)(n); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* Remove zero to seven bits as needed to go to a byte boundary */
|
|
||||||
#define BYTEBITS() \
|
|
||||||
do { \
|
|
||||||
hold >>= bits & 7; \
|
|
||||||
bits -= bits & 7; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* Assure that some output space is available, by writing out the window
|
|
||||||
if it's full. If the write fails, return from inflateBack() with a
|
|
||||||
Z_BUF_ERROR. */
|
|
||||||
#define ROOM() \
|
|
||||||
do { \
|
|
||||||
if (left == 0) { \
|
|
||||||
put = state->window; \
|
|
||||||
left = state->wsize; \
|
|
||||||
state->whave = left; \
|
|
||||||
if (out(out_desc, put, left)) { \
|
|
||||||
ret = Z_BUF_ERROR; \
|
|
||||||
goto inf_leave; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/*
|
|
||||||
strm provides the memory allocation functions and window buffer on input,
|
|
||||||
and provides information on the unused input on return. For Z_DATA_ERROR
|
|
||||||
returns, strm will also provide an error message.
|
|
||||||
|
|
||||||
in() and out() are the call-back input and output functions. When
|
|
||||||
inflateBack() needs more input, it calls in(). When inflateBack() has
|
|
||||||
filled the window with output, or when it completes with data in the
|
|
||||||
window, it calls out() to write out the data. The application must not
|
|
||||||
change the provided input until in() is called again or inflateBack()
|
|
||||||
returns. The application must not change the window/output buffer until
|
|
||||||
inflateBack() returns.
|
|
||||||
|
|
||||||
in() and out() are called with a descriptor parameter provided in the
|
|
||||||
inflateBack() call. This parameter can be a structure that provides the
|
|
||||||
information required to do the read or write, as well as accumulated
|
|
||||||
information on the input and output such as totals and check values.
|
|
||||||
|
|
||||||
in() should return zero on failure. out() should return non-zero on
|
|
||||||
failure. If either in() or out() fails, than inflateBack() returns a
|
|
||||||
Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
|
|
||||||
was in() or out() that caused in the error. Otherwise, inflateBack()
|
|
||||||
returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
|
|
||||||
error, or Z_MEM_ERROR if it could not allocate memory for the state.
|
|
||||||
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
|
||||||
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
|
||||||
*/
|
|
||||||
int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
|
|
||||||
z_streamp strm;
|
|
||||||
in_func in;
|
|
||||||
void FAR *in_desc;
|
|
||||||
out_func out;
|
|
||||||
void FAR *out_desc;
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
|
||||||
unsigned char FAR *next; /* next input */
|
|
||||||
unsigned char FAR *put; /* next output */
|
|
||||||
unsigned have, left; /* available input and output */
|
|
||||||
unsigned long hold; /* bit buffer */
|
|
||||||
unsigned bits; /* bits in bit buffer */
|
|
||||||
unsigned copy; /* number of stored or match bytes to copy */
|
|
||||||
unsigned char FAR *from; /* where to copy match bytes from */
|
|
||||||
code this; /* current decoding table entry */
|
|
||||||
code last; /* parent table entry */
|
|
||||||
unsigned len; /* length to copy for repeats, bits to drop */
|
|
||||||
int ret; /* return code */
|
|
||||||
static const unsigned short order[19] = /* permutation of code lengths */
|
|
||||||
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
|
|
||||||
|
|
||||||
/* Check that the strm exists and that the state was initialized */
|
|
||||||
if (strm == Z_NULL || strm->state == Z_NULL)
|
|
||||||
return Z_STREAM_ERROR;
|
|
||||||
state = (struct inflate_state FAR *)strm->state;
|
|
||||||
|
|
||||||
/* Reset the state */
|
|
||||||
strm->msg = Z_NULL;
|
|
||||||
state->mode = TYPE;
|
|
||||||
state->last = 0;
|
|
||||||
state->whave = 0;
|
|
||||||
next = strm->next_in;
|
|
||||||
have = next != Z_NULL ? strm->avail_in : 0;
|
|
||||||
hold = 0;
|
|
||||||
bits = 0;
|
|
||||||
put = state->window;
|
|
||||||
left = state->wsize;
|
|
||||||
|
|
||||||
/* Inflate until end of block marked as last */
|
|
||||||
for (;;)
|
|
||||||
switch (state->mode) {
|
|
||||||
case TYPE:
|
|
||||||
/* determine and dispatch block type */
|
|
||||||
if (state->last) {
|
|
||||||
BYTEBITS();
|
|
||||||
state->mode = DONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
NEEDBITS(3);
|
|
||||||
state->last = BITS(1);
|
|
||||||
DROPBITS(1);
|
|
||||||
switch (BITS(2)) {
|
|
||||||
case 0: /* stored block */
|
|
||||||
Tracev((stderr, "inflate: stored block%s\n",
|
|
||||||
state->last ? " (last)" : ""));
|
|
||||||
state->mode = STORED;
|
|
||||||
break;
|
|
||||||
case 1: /* fixed block */
|
|
||||||
fixedtables(state);
|
|
||||||
Tracev((stderr, "inflate: fixed codes block%s\n",
|
|
||||||
state->last ? " (last)" : ""));
|
|
||||||
state->mode = LEN; /* decode codes */
|
|
||||||
break;
|
|
||||||
case 2: /* dynamic block */
|
|
||||||
Tracev((stderr, "inflate: dynamic codes block%s\n",
|
|
||||||
state->last ? " (last)" : ""));
|
|
||||||
state->mode = TABLE;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
strm->msg = (char *)"invalid block type";
|
|
||||||
state->mode = BAD;
|
|
||||||
}
|
|
||||||
DROPBITS(2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STORED:
|
|
||||||
/* get and verify stored block length */
|
|
||||||
BYTEBITS(); /* go to byte boundary */
|
|
||||||
NEEDBITS(32);
|
|
||||||
if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
|
|
||||||
strm->msg = (char *)"invalid stored block lengths";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
state->length = (unsigned)hold & 0xffff;
|
|
||||||
Tracev((stderr, "inflate: stored length %u\n",
|
|
||||||
state->length));
|
|
||||||
INITBITS();
|
|
||||||
|
|
||||||
/* copy stored block from input to output */
|
|
||||||
while (state->length != 0) {
|
|
||||||
copy = state->length;
|
|
||||||
PULL();
|
|
||||||
ROOM();
|
|
||||||
if (copy > have) copy = have;
|
|
||||||
if (copy > left) copy = left;
|
|
||||||
zmemcpy(put, next, copy);
|
|
||||||
have -= copy;
|
|
||||||
next += copy;
|
|
||||||
left -= copy;
|
|
||||||
put += copy;
|
|
||||||
state->length -= copy;
|
|
||||||
}
|
|
||||||
Tracev((stderr, "inflate: stored end\n"));
|
|
||||||
state->mode = TYPE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TABLE:
|
|
||||||
/* get dynamic table entries descriptor */
|
|
||||||
NEEDBITS(14);
|
|
||||||
state->nlen = BITS(5) + 257;
|
|
||||||
DROPBITS(5);
|
|
||||||
state->ndist = BITS(5) + 1;
|
|
||||||
DROPBITS(5);
|
|
||||||
state->ncode = BITS(4) + 4;
|
|
||||||
DROPBITS(4);
|
|
||||||
#ifndef PKZIP_BUG_WORKAROUND
|
|
||||||
if (state->nlen > 286 || state->ndist > 30) {
|
|
||||||
strm->msg = (char *)"too many length or distance symbols";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
Tracev((stderr, "inflate: table sizes ok\n"));
|
|
||||||
|
|
||||||
/* get code length code lengths (not a typo) */
|
|
||||||
state->have = 0;
|
|
||||||
while (state->have < state->ncode) {
|
|
||||||
NEEDBITS(3);
|
|
||||||
state->lens[order[state->have++]] = (unsigned short)BITS(3);
|
|
||||||
DROPBITS(3);
|
|
||||||
}
|
|
||||||
while (state->have < 19)
|
|
||||||
state->lens[order[state->have++]] = 0;
|
|
||||||
state->next = state->codes;
|
|
||||||
state->lencode = (code const FAR *)(state->next);
|
|
||||||
state->lenbits = 7;
|
|
||||||
ret = inflate_table(CODES, state->lens, 19, &(state->next),
|
|
||||||
&(state->lenbits), state->work);
|
|
||||||
if (ret) {
|
|
||||||
strm->msg = (char *)"invalid code lengths set";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Tracev((stderr, "inflate: code lengths ok\n"));
|
|
||||||
|
|
||||||
/* get length and distance code code lengths */
|
|
||||||
state->have = 0;
|
|
||||||
while (state->have < state->nlen + state->ndist) {
|
|
||||||
for (;;) {
|
|
||||||
this = state->lencode[BITS(state->lenbits)];
|
|
||||||
if ((unsigned)(this.bits) <= bits) break;
|
|
||||||
PULLBYTE();
|
|
||||||
}
|
|
||||||
if (this.val < 16) {
|
|
||||||
NEEDBITS(this.bits);
|
|
||||||
DROPBITS(this.bits);
|
|
||||||
state->lens[state->have++] = this.val;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (this.val == 16) {
|
|
||||||
NEEDBITS(this.bits + 2);
|
|
||||||
DROPBITS(this.bits);
|
|
||||||
if (state->have == 0) {
|
|
||||||
strm->msg = (char *)"invalid bit length repeat";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
len = (unsigned)(state->lens[state->have - 1]);
|
|
||||||
copy = 3 + BITS(2);
|
|
||||||
DROPBITS(2);
|
|
||||||
}
|
|
||||||
else if (this.val == 17) {
|
|
||||||
NEEDBITS(this.bits + 3);
|
|
||||||
DROPBITS(this.bits);
|
|
||||||
len = 0;
|
|
||||||
copy = 3 + BITS(3);
|
|
||||||
DROPBITS(3);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
NEEDBITS(this.bits + 7);
|
|
||||||
DROPBITS(this.bits);
|
|
||||||
len = 0;
|
|
||||||
copy = 11 + BITS(7);
|
|
||||||
DROPBITS(7);
|
|
||||||
}
|
|
||||||
if (state->have + copy > state->nlen + state->ndist) {
|
|
||||||
strm->msg = (char *)"invalid bit length repeat";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
while (copy--)
|
|
||||||
state->lens[state->have++] = (unsigned short)len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* handle error breaks in while */
|
|
||||||
if (state->mode == BAD) break;
|
|
||||||
|
|
||||||
/* build code tables */
|
|
||||||
state->next = state->codes;
|
|
||||||
state->lencode = (code const FAR *)(state->next);
|
|
||||||
state->lenbits = 9;
|
|
||||||
ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
|
|
||||||
&(state->lenbits), state->work);
|
|
||||||
if (ret) {
|
|
||||||
strm->msg = (char *)"invalid literal/lengths set";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
state->distcode = (code const FAR *)(state->next);
|
|
||||||
state->distbits = 6;
|
|
||||||
ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
|
|
||||||
&(state->next), &(state->distbits), state->work);
|
|
||||||
if (ret) {
|
|
||||||
strm->msg = (char *)"invalid distances set";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Tracev((stderr, "inflate: codes ok\n"));
|
|
||||||
state->mode = LEN;
|
|
||||||
|
|
||||||
case LEN:
|
|
||||||
/* use inflate_fast() if we have enough input and output */
|
|
||||||
if (have >= 6 && left >= 258) {
|
|
||||||
RESTORE();
|
|
||||||
if (state->whave < state->wsize)
|
|
||||||
state->whave = state->wsize - left;
|
|
||||||
inflate_fast(strm, state->wsize);
|
|
||||||
LOAD();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get a literal, length, or end-of-block code */
|
|
||||||
for (;;) {
|
|
||||||
this = state->lencode[BITS(state->lenbits)];
|
|
||||||
if ((unsigned)(this.bits) <= bits) break;
|
|
||||||
PULLBYTE();
|
|
||||||
}
|
|
||||||
if (this.op && (this.op & 0xf0) == 0) {
|
|
||||||
last = this;
|
|
||||||
for (;;) {
|
|
||||||
this = state->lencode[last.val +
|
|
||||||
(BITS(last.bits + last.op) >> last.bits)];
|
|
||||||
if ((unsigned)(last.bits + this.bits) <= bits) break;
|
|
||||||
PULLBYTE();
|
|
||||||
}
|
|
||||||
DROPBITS(last.bits);
|
|
||||||
}
|
|
||||||
DROPBITS(this.bits);
|
|
||||||
state->length = (unsigned)this.val;
|
|
||||||
|
|
||||||
/* process literal */
|
|
||||||
if (this.op == 0) {
|
|
||||||
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
|
|
||||||
"inflate: literal '%c'\n" :
|
|
||||||
"inflate: literal 0x%02x\n", this.val));
|
|
||||||
ROOM();
|
|
||||||
*put++ = (unsigned char)(state->length);
|
|
||||||
left--;
|
|
||||||
state->mode = LEN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* process end of block */
|
|
||||||
if (this.op & 32) {
|
|
||||||
Tracevv((stderr, "inflate: end of block\n"));
|
|
||||||
state->mode = TYPE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* invalid code */
|
|
||||||
if (this.op & 64) {
|
|
||||||
strm->msg = (char *)"invalid literal/length code";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* length code -- get extra bits, if any */
|
|
||||||
state->extra = (unsigned)(this.op) & 15;
|
|
||||||
if (state->extra != 0) {
|
|
||||||
NEEDBITS(state->extra);
|
|
||||||
state->length += BITS(state->extra);
|
|
||||||
DROPBITS(state->extra);
|
|
||||||
}
|
|
||||||
Tracevv((stderr, "inflate: length %u\n", state->length));
|
|
||||||
|
|
||||||
/* get distance code */
|
|
||||||
for (;;) {
|
|
||||||
this = state->distcode[BITS(state->distbits)];
|
|
||||||
if ((unsigned)(this.bits) <= bits) break;
|
|
||||||
PULLBYTE();
|
|
||||||
}
|
|
||||||
if ((this.op & 0xf0) == 0) {
|
|
||||||
last = this;
|
|
||||||
for (;;) {
|
|
||||||
this = state->distcode[last.val +
|
|
||||||
(BITS(last.bits + last.op) >> last.bits)];
|
|
||||||
if ((unsigned)(last.bits + this.bits) <= bits) break;
|
|
||||||
PULLBYTE();
|
|
||||||
}
|
|
||||||
DROPBITS(last.bits);
|
|
||||||
}
|
|
||||||
DROPBITS(this.bits);
|
|
||||||
if (this.op & 64) {
|
|
||||||
strm->msg = (char *)"invalid distance code";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
state->offset = (unsigned)this.val;
|
|
||||||
|
|
||||||
/* get distance extra bits, if any */
|
|
||||||
state->extra = (unsigned)(this.op) & 15;
|
|
||||||
if (state->extra != 0) {
|
|
||||||
NEEDBITS(state->extra);
|
|
||||||
state->offset += BITS(state->extra);
|
|
||||||
DROPBITS(state->extra);
|
|
||||||
}
|
|
||||||
if (state->offset > state->wsize - (state->whave < state->wsize ?
|
|
||||||
left : 0)) {
|
|
||||||
strm->msg = (char *)"invalid distance too far back";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Tracevv((stderr, "inflate: distance %u\n", state->offset));
|
|
||||||
|
|
||||||
/* copy match from window to output */
|
|
||||||
do {
|
|
||||||
ROOM();
|
|
||||||
copy = state->wsize - state->offset;
|
|
||||||
if (copy < left) {
|
|
||||||
from = put + copy;
|
|
||||||
copy = left - copy;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
from = put - state->offset;
|
|
||||||
copy = left;
|
|
||||||
}
|
|
||||||
if (copy > state->length) copy = state->length;
|
|
||||||
state->length -= copy;
|
|
||||||
left -= copy;
|
|
||||||
do {
|
|
||||||
*put++ = *from++;
|
|
||||||
} while (--copy);
|
|
||||||
} while (state->length != 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DONE:
|
|
||||||
/* inflate stream terminated properly -- write leftover output */
|
|
||||||
ret = Z_STREAM_END;
|
|
||||||
if (left < state->wsize) {
|
|
||||||
if (out(out_desc, state->window, state->wsize - left))
|
|
||||||
ret = Z_BUF_ERROR;
|
|
||||||
}
|
|
||||||
goto inf_leave;
|
|
||||||
|
|
||||||
case BAD:
|
|
||||||
ret = Z_DATA_ERROR;
|
|
||||||
goto inf_leave;
|
|
||||||
|
|
||||||
default: /* can't happen, but makes compilers happy */
|
|
||||||
ret = Z_STREAM_ERROR;
|
|
||||||
goto inf_leave;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return unused input */
|
|
||||||
inf_leave:
|
|
||||||
strm->next_in = next;
|
|
||||||
strm->avail_in = have;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ZEXPORT inflateBackEnd(strm)
|
|
||||||
z_streamp strm;
|
|
||||||
{
|
|
||||||
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
|
|
||||||
return Z_STREAM_ERROR;
|
|
||||||
ZFREE(strm, strm->state);
|
|
||||||
strm->state = Z_NULL;
|
|
||||||
Tracev((stderr, "inflate: end\n"));
|
|
||||||
return Z_OK;
|
|
||||||
}
|
|
|
@ -1,318 +0,0 @@
|
||||||
/* inffast.c -- fast decoding
|
|
||||||
* Copyright (C) 1995-2004 Mark Adler
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "zutil.h"
|
|
||||||
#include "inftrees.h"
|
|
||||||
#include "inflate.h"
|
|
||||||
#include "inffast.h"
|
|
||||||
|
|
||||||
#ifndef ASMINF
|
|
||||||
|
|
||||||
/* Allow machine dependent optimization for post-increment or pre-increment.
|
|
||||||
Based on testing to date,
|
|
||||||
Pre-increment preferred for:
|
|
||||||
- PowerPC G3 (Adler)
|
|
||||||
- MIPS R5000 (Randers-Pehrson)
|
|
||||||
Post-increment preferred for:
|
|
||||||
- none
|
|
||||||
No measurable difference:
|
|
||||||
- Pentium III (Anderson)
|
|
||||||
- M68060 (Nikl)
|
|
||||||
*/
|
|
||||||
#ifdef POSTINC
|
|
||||||
# define OFF 0
|
|
||||||
# define PUP(a) *(a)++
|
|
||||||
#else
|
|
||||||
# define OFF 1
|
|
||||||
# define PUP(a) *++(a)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
Decode literal, length, and distance codes and write out the resulting
|
|
||||||
literal and match bytes until either not enough input or output is
|
|
||||||
available, an end-of-block is encountered, or a data error is encountered.
|
|
||||||
When large enough input and output buffers are supplied to inflate(), for
|
|
||||||
example, a 16K input buffer and a 64K output buffer, more than 95% of the
|
|
||||||
inflate execution time is spent in this routine.
|
|
||||||
|
|
||||||
Entry assumptions:
|
|
||||||
|
|
||||||
state->mode == LEN
|
|
||||||
strm->avail_in >= 6
|
|
||||||
strm->avail_out >= 258
|
|
||||||
start >= strm->avail_out
|
|
||||||
state->bits < 8
|
|
||||||
|
|
||||||
On return, state->mode is one of:
|
|
||||||
|
|
||||||
LEN -- ran out of enough output space or enough available input
|
|
||||||
TYPE -- reached end of block code, inflate() to interpret next block
|
|
||||||
BAD -- error in block data
|
|
||||||
|
|
||||||
Notes:
|
|
||||||
|
|
||||||
- The maximum input bits used by a length/distance pair is 15 bits for the
|
|
||||||
length code, 5 bits for the length extra, 15 bits for the distance code,
|
|
||||||
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
|
|
||||||
Therefore if strm->avail_in >= 6, then there is enough input to avoid
|
|
||||||
checking for available input while decoding.
|
|
||||||
|
|
||||||
- The maximum bytes that a single length/distance pair can output is 258
|
|
||||||
bytes, which is the maximum length that can be coded. inflate_fast()
|
|
||||||
requires strm->avail_out >= 258 for each loop to avoid checking for
|
|
||||||
output space.
|
|
||||||
*/
|
|
||||||
void inflate_fast(strm, start)
|
|
||||||
z_streamp strm;
|
|
||||||
unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
||||||
{
|
|
||||||
struct inflate_state FAR *state;
|
|
||||||
unsigned char FAR *in; /* local strm->next_in */
|
|
||||||
unsigned char FAR *last; /* while in < last, enough input available */
|
|
||||||
unsigned char FAR *out; /* local strm->next_out */
|
|
||||||
unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
|
|
||||||
unsigned char FAR *end; /* while out < end, enough space available */
|
|
||||||
#ifdef INFLATE_STRICT
|
|
||||||
unsigned dmax; /* maximum distance from zlib header */
|
|
||||||
#endif
|
|
||||||
unsigned wsize; /* window size or zero if not using window */
|
|
||||||
unsigned whave; /* valid bytes in the window */
|
|
||||||
unsigned write; /* window write index */
|
|
||||||
unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
|
|
||||||
unsigned long hold; /* local strm->hold */
|
|
||||||
unsigned bits; /* local strm->bits */
|
|
||||||
code const FAR *lcode; /* local strm->lencode */
|
|
||||||
code const FAR *dcode; /* local strm->distcode */
|
|
||||||
unsigned lmask; /* mask for first level of length codes */
|
|
||||||
unsigned dmask; /* mask for first level of distance codes */
|
|
||||||
code this; /* retrieved table entry */
|
|
||||||
unsigned op; /* code bits, operation, extra bits, or */
|
|
||||||
/* window position, window bytes to copy */
|
|
||||||
unsigned len; /* match length, unused bytes */
|
|
||||||
unsigned dist; /* match distance */
|
|
||||||
unsigned char FAR *from; /* where to copy match from */
|
|
||||||
|
|
||||||
/* copy state to local variables */
|
|
||||||
state = (struct inflate_state FAR *)strm->state;
|
|
||||||
in = strm->next_in - OFF;
|
|
||||||
last = in + (strm->avail_in - 5);
|
|
||||||
out = strm->next_out - OFF;
|
|
||||||
beg = out - (start - strm->avail_out);
|
|
||||||
end = out + (strm->avail_out - 257);
|
|
||||||
#ifdef INFLATE_STRICT
|
|
||||||
dmax = state->dmax;
|
|
||||||
#endif
|
|
||||||
wsize = state->wsize;
|
|
||||||
whave = state->whave;
|
|
||||||
write = state->write;
|
|
||||||
window = state->window;
|
|
||||||
hold = state->hold;
|
|
||||||
bits = state->bits;
|
|
||||||
lcode = state->lencode;
|
|
||||||
dcode = state->distcode;
|
|
||||||
lmask = (1U << state->lenbits) - 1;
|
|
||||||
dmask = (1U << state->distbits) - 1;
|
|
||||||
|
|
||||||
/* decode literals and length/distances until end-of-block or not enough
|
|
||||||
input data or output space */
|
|
||||||
do {
|
|
||||||
if (bits < 15) {
|
|
||||||
hold += (unsigned long)(PUP(in)) << bits;
|
|
||||||
bits += 8;
|
|
||||||
hold += (unsigned long)(PUP(in)) << bits;
|
|
||||||
bits += 8;
|
|
||||||
}
|
|
||||||
this = lcode[hold & lmask];
|
|
||||||
dolen:
|
|
||||||
op = (unsigned)(this.bits);
|
|
||||||
hold >>= op;
|
|
||||||
bits -= op;
|
|
||||||
op = (unsigned)(this.op);
|
|
||||||
if (op == 0) { /* literal */
|
|
||||||
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
|
|
||||||
"inflate: literal '%c'\n" :
|
|
||||||
"inflate: literal 0x%02x\n", this.val));
|
|
||||||
PUP(out) = (unsigned char)(this.val);
|
|
||||||
}
|
|
||||||
else if (op & 16) { /* length base */
|
|
||||||
len = (unsigned)(this.val);
|
|
||||||
op &= 15; /* number of extra bits */
|
|
||||||
if (op) {
|
|
||||||
if (bits < op) {
|
|
||||||
hold += (unsigned long)(PUP(in)) << bits;
|
|
||||||
bits += 8;
|
|
||||||
}
|
|
||||||
len += (unsigned)hold & ((1U << op) - 1);
|
|
||||||
hold >>= op;
|
|
||||||
bits -= op;
|
|
||||||
}
|
|
||||||
Tracevv((stderr, "inflate: length %u\n", len));
|
|
||||||
if (bits < 15) {
|
|
||||||
hold += (unsigned long)(PUP(in)) << bits;
|
|
||||||
bits += 8;
|
|
||||||
hold += (unsigned long)(PUP(in)) << bits;
|
|
||||||
bits += 8;
|
|
||||||
}
|
|
||||||
this = dcode[hold & dmask];
|
|
||||||
dodist:
|
|
||||||
op = (unsigned)(this.bits);
|
|
||||||
hold >>= op;
|
|
||||||
bits -= op;
|
|
||||||
op = (unsigned)(this.op);
|
|
||||||
if (op & 16) { /* distance base */
|
|
||||||
dist = (unsigned)(this.val);
|
|
||||||
op &= 15; /* number of extra bits */
|
|
||||||
if (bits < op) {
|
|
||||||
hold += (unsigned long)(PUP(in)) << bits;
|
|
||||||
bits += 8;
|
|
||||||
if (bits < op) {
|
|
||||||
hold += (unsigned long)(PUP(in)) << bits;
|
|
||||||
bits += 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dist += (unsigned)hold & ((1U << op) - 1);
|
|
||||||
#ifdef INFLATE_STRICT
|
|
||||||
if (dist > dmax) {
|
|
||||||
strm->msg = (char *)"invalid distance too far back";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
hold >>= op;
|
|
||||||
bits -= op;
|
|
||||||
Tracevv((stderr, "inflate: distance %u\n", dist));
|
|
||||||
op = (unsigned)(out - beg); /* max distance in output */
|
|
||||||
if (dist > op) { /* see if copy from window */
|
|
||||||
op = dist - op; /* distance back in window */
|
|
||||||
if (op > whave) {
|
|
||||||
strm->msg = (char *)"invalid distance too far back";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
from = window - OFF;
|
|
||||||
if (write == 0) { /* very common case */
|
|
||||||
from += wsize - op;
|
|
||||||
if (op < len) { /* some from window */
|
|
||||||
len -= op;
|
|
||||||
do {
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
} while (--op);
|
|
||||||
from = out - dist; /* rest from output */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (write < op) { /* wrap around window */
|
|
||||||
from += wsize + write - op;
|
|
||||||
op -= write;
|
|
||||||
if (op < len) { /* some from end of window */
|
|
||||||
len -= op;
|
|
||||||
do {
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
} while (--op);
|
|
||||||
from = window - OFF;
|
|
||||||
if (write < len) { /* some from start of window */
|
|
||||||
op = write;
|
|
||||||
len -= op;
|
|
||||||
do {
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
} while (--op);
|
|
||||||
from = out - dist; /* rest from output */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { /* contiguous in window */
|
|
||||||
from += write - op;
|
|
||||||
if (op < len) { /* some from window */
|
|
||||||
len -= op;
|
|
||||||
do {
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
} while (--op);
|
|
||||||
from = out - dist; /* rest from output */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (len > 2) {
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
len -= 3;
|
|
||||||
}
|
|
||||||
if (len) {
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
if (len > 1)
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
from = out - dist; /* copy direct from output */
|
|
||||||
do { /* minimum length is three */
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
len -= 3;
|
|
||||||
} while (len > 2);
|
|
||||||
if (len) {
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
if (len > 1)
|
|
||||||
PUP(out) = PUP(from);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((op & 64) == 0) { /* 2nd level distance code */
|
|
||||||
this = dcode[this.val + (hold & ((1U << op) - 1))];
|
|
||||||
goto dodist;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
strm->msg = (char *)"invalid distance code";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((op & 64) == 0) { /* 2nd level length code */
|
|
||||||
this = lcode[this.val + (hold & ((1U << op) - 1))];
|
|
||||||
goto dolen;
|
|
||||||
}
|
|
||||||
else if (op & 32) { /* end-of-block */
|
|
||||||
Tracevv((stderr, "inflate: end of block\n"));
|
|
||||||
state->mode = TYPE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
strm->msg = (char *)"invalid literal/length code";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (in < last && out < end);
|
|
||||||
|
|
||||||
/* return unused bytes (on entry, bits < 8, so in won't go too far back) */
|
|
||||||
len = bits >> 3;
|
|
||||||
in -= len;
|
|
||||||
bits -= len << 3;
|
|
||||||
hold &= (1U << bits) - 1;
|
|
||||||
|
|
||||||
/* update state and return */
|
|
||||||
strm->next_in = in + OFF;
|
|
||||||
strm->next_out = out + OFF;
|
|
||||||
strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
|
|
||||||
strm->avail_out = (unsigned)(out < end ?
|
|
||||||
257 + (end - out) : 257 - (out - end));
|
|
||||||
state->hold = hold;
|
|
||||||
state->bits = bits;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
|
|
||||||
- Using bit fields for code structure
|
|
||||||
- Different op definition to avoid & for extra bits (do & for table bits)
|
|
||||||
- Three separate decoding do-loops for direct, window, and write == 0
|
|
||||||
- Special case for distance > 1 copies to do overlapped load and store copy
|
|
||||||
- Explicit branch predictions (based on measured branch probabilities)
|
|
||||||
- Deferring match copy and interspersed it with decoding subsequent codes
|
|
||||||
- Swapping literal/length else
|
|
||||||
- Swapping window/direct else
|
|
||||||
- Larger unrolled copy loops (three is about right)
|
|
||||||
- Moving len -= 3 statement into middle of loop
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* !ASMINF */
|
|
|
@ -1,11 +0,0 @@
|
||||||
/* inffast.h -- header to use inffast.c
|
|
||||||
* Copyright (C) 1995-2003 Mark Adler
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WARNING: this file should *not* be used by applications. It is
|
|
||||||
part of the implementation of the compression library and is
|
|
||||||
subject to change. Applications should only use zlib.h.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void inflate_fast OF((z_streamp strm, unsigned start));
|
|
|
@ -1,94 +0,0 @@
|
||||||
/* inffixed.h -- table for decoding fixed codes
|
|
||||||
* Generated automatically by makefixed().
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WARNING: this file should *not* be used by applications. It
|
|
||||||
is part of the implementation of the compression library and
|
|
||||||
is subject to change. Applications should only use zlib.h.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static const code lenfix[512] = {
|
|
||||||
{96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
|
|
||||||
{0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
|
|
||||||
{0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
|
|
||||||
{0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
|
|
||||||
{0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
|
|
||||||
{21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
|
|
||||||
{0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
|
|
||||||
{0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
|
|
||||||
{18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
|
|
||||||
{0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
|
|
||||||
{0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
|
|
||||||
{0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
|
|
||||||
{20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
|
|
||||||
{0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
|
|
||||||
{0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
|
|
||||||
{0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
|
|
||||||
{16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
|
|
||||||
{0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
|
|
||||||
{0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
|
|
||||||
{0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
|
|
||||||
{0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
|
|
||||||
{0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
|
|
||||||
{0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
|
|
||||||
{0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
|
|
||||||
{17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
|
|
||||||
{0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
|
|
||||||
{0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
|
|
||||||
{0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
|
|
||||||
{19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
|
|
||||||
{0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
|
|
||||||
{0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
|
|
||||||
{0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
|
|
||||||
{16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
|
|
||||||
{0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
|
|
||||||
{0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
|
|
||||||
{0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
|
|
||||||
{0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
|
|
||||||
{20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
|
|
||||||
{0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
|
|
||||||
{0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
|
|
||||||
{17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
|
|
||||||
{0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
|
|
||||||
{0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
|
|
||||||
{0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
|
|
||||||
{20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
|
|
||||||
{0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
|
|
||||||
{0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
|
|
||||||
{0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
|
|
||||||
{16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
|
|
||||||
{0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
|
|
||||||
{0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
|
|
||||||
{0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
|
|
||||||
{0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
|
|
||||||
{0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
|
|
||||||
{0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
|
|
||||||
{0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
|
|
||||||
{16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
|
|
||||||
{0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
|
|
||||||
{0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
|
|
||||||
{0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
|
|
||||||
{19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
|
|
||||||
{0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
|
|
||||||
{0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
|
|
||||||
{0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
|
|
||||||
{16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
|
|
||||||
{0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
|
|
||||||
{0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
|
|
||||||
{0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
|
|
||||||
{0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
|
|
||||||
{64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
|
|
||||||
{0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
|
|
||||||
{0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
|
|
||||||
{18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
|
|
||||||
{0,9,255}
|
|
||||||
};
|
|
||||||
|
|
||||||
static const code distfix[32] = {
|
|
||||||
{16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
|
|
||||||
{21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
|
|
||||||
{18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
|
|
||||||
{19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
|
|
||||||
{16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
|
|
||||||
{22,5,193},{64,5,0}
|
|
||||||
};
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue